Gibbs sampling for the covariance matrix of additive row and column effects in the AME model. This function implements the inverse-Wishart posterior update for the covariance matrix Sab.
rSab_fc(a, b, Sab0=NULL, eta0=NULL, rvar=TRUE, cvar=TRUE, symmetric=FALSE)Updated covariance matrix Sab (2x2 matrix with variances on diagonal and covariance off-diagonal)
vector of row random effects (additive sender effects)
vector of column random effects (additive receiver effects)
prior scale matrix. Convention (Hoff/amen):
Sab0 is passed raw; the inverse-Wishart scale used
internally is \(\eta_0 \cdot Sab0\), so the prior mean of Sab is
\(\eta_0 Sab0/(\eta_0-3) \approx Sab0\) and the prior mode is
\(\eta_0 Sab0/(\eta_0+3)\). Every call site in the package (ame()
unipartite and bipartite, lame() unipartite and bipartite, and the
raSab_bin/cbin/frn joint updates) passes Sab0 raw under this
same convention, so a given prior$Sab0 means the same prior
everywhere. Default is diag(2) (weakly informative).
prior degrees of freedom for the prior distribution. Default is 4, which is the minimum for a proper prior with 2x2 matrix.
logical: should row variance be updated? (default TRUE)
logical: should column variance be updated? (default TRUE)
logical: is this a symmetric network? (default FALSE)
Cassy Dorff, Shahryar Minhas, Tosin Salau
The function implements different update strategies:
Full update: When both rvar and cvar are TRUE, updates the full 2x2 covariance matrix using an inverse-Wishart distribution
Row variance only: When only rvar is TRUE, updates only Sab[1,1]
Column variance only: When only cvar is TRUE, updates only Sab[2,2]
Symmetric case: When symmetric is TRUE, draws a single shared variance for the row and column effects (inverse-gamma update) with zero covariance