Skip to contents

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.

Usage

rSab_fc(a, b, Sab0=NULL, eta0=NULL, rvar=TRUE, cvar=TRUE, symmetric=FALSE,
  center=FALSE, tiny=1e-8)

Arguments

a

vector of row random effects (additive sender effects)

b

vector of column random effects (additive receiver effects)

Sab0

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 joint update) passes Sab0 raw under this same convention, so a given prior$Sab0 means the same prior everywhere. Default is diag(2) (weakly informative).

eta0

prior degrees of freedom for the prior distribution. Default is 4, the smallest integer giving a finite prior mean for a 2x2 covariance.

rvar

logical: should row variance be updated? (default TRUE)

cvar

logical: should column variance be updated? (default TRUE)

symmetric

logical: is this a symmetric network? (default FALSE)

center

Logical: are the supplied actor effects constrained to sum to zero? If so, remove one degree of freedom from the covariance update. Defaults to FALSE for unconstrained effects.

tiny

the variance a margin that is switched off (rvar or cvar FALSE) keeps: 1e-8 in the unit of the response (default 1e-8, the value for a link-fixed latent scale).

Value

Updated covariance matrix Sab (2x2 matrix with variances on diagonal and covariance off-diagonal)

Details

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

Author

Cassy Dorff, Shahryar Minhas, Tosin Salau