Skip to contents

An MCMC routine providing a fit to an additive and multiplicative effects (AME) regression model to cross-sectional relational data of various types. This function supports both unipartite (square) and bipartite (rectangular) networks. For longitudinal networks, use the lame function. The additive and multiplicative effects framework is due to Hoff (2005, 2021).

Usage

ame(
  Y,
  Xdyad = NULL,
  Xrow = NULL,
  Xcol = NULL,
  rvar = TRUE,
  cvar = TRUE,
  dcor = !symmetric,
  nvar = TRUE,
  R = 0,
  R_row = NULL,
  R_col = NULL,
  mode = c("unipartite", "bipartite"),
  family = "normal",
  intercept = !(family == "ordinal"),
  symmetric = FALSE,
  prior = list(),
  g = NA,
  seed = 6886,
  nscan = 10000,
  burn = 500,
  odens = 25,
  verbose = TRUE,
  gof = TRUE,
  custom_gof = NULL,
  plot = FALSE,
  start_vals = NULL,
  periodic_save = FALSE,
  out_file = NULL,
  save_interval = 0.25,
  posterior_opts = NULL,
  cores = NULL,
  chains = .lame_chains_default(),
  use_sparse_matrices = FALSE,
  method = c("mcmc", "als"),
  bootstrap = 0L,
  bootstrap_type = c("parametric", "block"),
  bootstrap_block_length = 1L,
  bootstrap_seed = NULL,
  multistart = c("none", "cheap", "full"),
  save_log_lik = FALSE,
  ordinal_cutpoints = c("data_induced", "explicit"),
  ...,
  log_lik_method = c("observed_exact", "observed_approx"),
  model.name = NULL
)

Arguments

Y

For unipartite: an n x n square relational matrix. For bipartite: an nA x nB rectangular relational matrix where nA is the number of row nodes and nB is the number of column nodes. A cross-sectional netify object is also accepted and converted with netify::to_lame(); when family or mode is omitted, the value inferred by netify is used. See family below for data types.

Xdyad

For unipartite: an n x n x pd array of dyadic covariates (e.g. distance, shared group). For bipartite: an nA x nB x pd array. A 2-D matrix (single dyadic covariate) must be wrapped as array(x, dim = c(n, n, 1)); Inf/NaN entries are rejected.

Xrow

For unipartite: an n x pr matrix of sender (row) covariates (e.g. sender's age, group). For bipartite: an nA x pr matrix of row-node covariates. A data.frame is accepted and coerced to numeric matrix internally. In a symmetric model (symmetric = TRUE) each node covariate enters a dyad through both of its actors.

Xcol

For unipartite: an n x pc matrix of receiver (column) covariates. For bipartite: an nB x pc matrix of column-node covariates. A data.frame is accepted and coerced internally. In a symmetric model a node covariate may be given in Xrow, in Xcol or in both, and each distinct covariate enters once, as <name>_node.

rvar

logical: fit row random effects (asymmetric case)?

cvar

logical: fit column random effects (asymmetric case)?

dcor

logical: fit a dyadic correlation (asymmetric case)? Note: not used for bipartite networks. With method = "als" the argument goes to ame_als, whose directed binary probit, Poisson or normal fit then has the correlation in its likelihood.

nvar

logical: fit nodal random effects (symmetric case)?

R

integer: dimension of the multiplicative effects (can be zero). For bipartite networks, this is used as the default for both R_row and R_col if they are not specified. A binary fit whose multiplicative term reproduces the observed ties exactly is separated: the size of the term is then set by its prior, the fit says so, and the signs and the fitted probabilities are what the data determine; a smaller R (down to zero for a panel whose ties barely change over time) reproduces them without saturating.

R_row

integer: for bipartite networks, dimension of row node multiplicative effects (defaults to R)

R_col

integer: for bipartite networks, dimension of column node multiplicative effects (defaults to R)

mode

character: either "unipartite" (default) for square networks or "bipartite" for rectangular networks. Not all combinations of family and mode are supported – see the table under Supported family x mode combinations below.

family

character: one of "normal","binary","ordinal","poisson". See the Supported family x mode combinations table below for which combinations are valid; see Details for the model assumptions behind each family.

intercept

logical: fit model with an intercept?

symmetric

logical: Is the sociomatrix symmetric by design?

prior

a list containing hyperparameters for the prior distributions. Available options and their defaults:

Sab0

Prior scale matrix for the additive-effects covariance. A 2x2 matrix where Sab0\[1,1\] is the prior variance for row effects, Sab0\[2,2\] is the prior variance for column effects, and off-diagonals control correlation between row and column effects. For a unipartite fit this defaults to diag(2) scaled to the observed sender/receiver heterogeneity in Y (unconditionally for the continuous families, conditionally for the discrete ones); a bipartite fit is scaled the same way, with one scale for both sides. See the note on the additive-effects variance scale in Details. Pass diag(2) explicitly for a fixed unit-scale prior.

eta0

Prior degrees of freedom for the additive-effects covariance \(\Sigma_{ab}\) (default: 1 for a "poisson" fit, centred at the fast route's effects covariance (see Details); round(4 + 3 \* n/100) for a normal fit, unipartite or bipartite (n is then the number of row actors, as in lame), and round(4 \* vdfmlt) for a discrete-family fit, where n is the number of actors and vdfmlt is a probit-moment variance multiplier estimated from Y). Higher values impose stronger shrinkage of the row/column effects toward the prior scale. The multiplicative-effects degrees of freedom are controlled by kappa0, not eta0.

etaab

Prior degrees of freedom for covariance of additive effects (default: 4 + 3 \* n/100). Controls shrinkage of row/column random effects. Larger values shrink effects toward zero. Used by the bipartite and longitudinal paths; ignored for a unipartite cross-sectional ame() fit, which controls the additive prior through Sab0 and eta0.

s20

Fixed positive prior scale for the dyadic residual variance \(v_e\). The prior has one degree of freedom. By default, normal fits use the variance of the observed responses, computed once before sampling; constant responses use their mean square, or 1 if all zero. Poisson fits use 1 on the latent log-rate scale. The resolved scale is reported as fit$s2_prior_scale. It is never recomputed from the current residuals. A supplied value overrides this default. In a bipartite cross-sectional ame() fit, s20 also multiplies the coefficient prior variance (g * s20); its default there is the variance of the response for the normal family (so that the prior is the same in any unit of the response) and 1 on the latent scale of the other families; elsewhere that prior is controlled separately by g.

s2u0

Prior variance for multiplicative effects (default: 1). Used by the bipartite and longitudinal paths.

Suv0

Inverse-Wishart (inverse) scale matrix for the multiplicative-effects covariance. The prior scale is kappa0 * Suv0 and the prior mean is kappa0 * Suv0 / (kappa0 - 2 * R - 1). When not supplied it is s * diag(2 * R), \(s\) the scale of the additive effects estimated from the data, the one the default Sab0 reads: for "binary", the variance of the actor means of the standardised residuals \((y - \bar y) / \phi(\Phi^{-1}(\bar y))\) of the less frequent value; for "ordinal", the same probit moments of the ranks; for "poisson", the variance of the centred log row and column rates; for "normal", the square root of the mean variance of the row and column means of the centred response (in the unit of the response, as the product \(u_i'v_j\) is). Every period of a lame panel enters, and a single period gives the value of ame(). lame has the same default. A bipartite network has no covariance of this kind (the rows of its factors have a unit-free N(0, I) prior and the interaction matrix carries the scale), and supplying Suv0 or kappa0 for one is an error of class "lame_prior_unused".

kappa0

Prior degrees of freedom for the multiplicative-effects covariance \(\Sigma_{uv}\). The default when R > 0 is round((2 * R + 2) * m): \(2R + 2\), the smallest value for which the prior has a finite mean, times \(m = 0.25 / \overline{p(1 - p)}\), the inverse Bernoulli information of the cells relative to a cell at \(p = 1/2\), with \(p\) the probit fit of the additive moments, for the "binary" family (\(m \ge 1\)), and \(m = 1\) for the others. A sparse network has little information per cell about its factors, and the prior then holds \(\Sigma_{uv}\) near the data scale \(s I\) with more pseudo-observations; \(m\) depends on the density, not on the number of actors. Higher values impose stronger shrinkage of the latent factors toward the prior scale.

actor_move

Logical, default TRUE. For "poisson" and "ordinal" fits (unipartite, directed or symmetric, and bipartite): translate each actor's level together with the latent values of its row and column (an exact draw: the Gaussian density of the latent array is unchanged, so the conditional is the level prior times the Poisson factor, or the interval the ranks or cutpoints allow), draw the location of the latent array (ordinal), and, for the Poisson family, translate the coefficients and move the dyadic variance and correlation together with the latent residuals and redraw the positions with the latent values of their rows and columns. The augmented sweep moves an actor with no events, and the intercept and the spread of the levels with it, by steps of order sqrt(s2 / number of cells), which takes thousands of sweeps on a sparse panel; the updates leave the posterior unchanged. For binary fits (unipartite, directed or symmetric, with any additive margin in the model, a fit with none drawing the positions alone, and bipartite; complete or with missing cells and actors): redraw each actor's level and static position from its exact conditional with the latent array integrated out (an elliptical slice step). The augmented sweep moves an actor whose cells hold no events by a step of order 1 / sqrt(number of cells) however wide its posterior is, so such an actor relaxes slowly; the update leaves the posterior unchanged. A bipartite fit of any family with an intercept also draws, exactly, along the ridge that the intercept shares with the means of its (uncentred) additive effects (a shift of the intercept and the opposite shift of the levels changes no predictor, so the draw has no likelihood term). FALSE omits them; the work is recorded in fit$actor_move.

chain_extensions

Number of times the chains are continued while the drift check or the between-chain check flags them (a drifting chain, an R-hat above its threshold, or a series with too few effective draws to compare the chains; default 3). Chains that still drift or disagree after the last extension are returned with a warning of class lame_chain_unsettled and fit$auto_extend$settled = FALSE; chains still too short to compare are returned with a warning of class lame_chain_not_compared; 0 decides on the first block. An extension is a block of nscan sweeps, longer when series are short of effective draws (see the convergence policy).

actor_move_every

Number of sweeps between visits of that update (default 10, and 2 for the Poisson translations; 1 for the draw along the intercept ridge of bipartite fits).

uv_g_scale_move

Logical, default TRUE. For bipartite fits with positions: each sweep also draws, exactly, the factors by which the columns of the positions and the rows and columns of the interaction matrix are rescaled, and the shears between columns of a side (each a Gaussian draw), without changing their product, because the unit priors anchor the split of scale between them weakly and the conditional updates cross it slowly. FALSE omits it; its work is recorded in fit$uv_g_scale_move.

uv_split_move

Logical, default TRUE. For directed fits with latent factors (R > 0): draw the split of the scale between \(U\) and \(V\) exactly (\(U \to cU\), \(V \to V/c\) leaves the product and the likelihood unchanged; with the covariance of the rows integrated out \(\log c\) has the matrix-t density along the orbit and is drawn by a slice step). The conditional draws moved the split by a few percent per sweep against a posterior sd of 0.2 to 0.5. At R >= 2 the rest of the gauge \(U \to UA\), \(V \to VA^{-T}\) is drawn the same way, one slice step for the scale of each column and one for each shear \(A = I + h e_k e_l'\); for symmetric fits each column of \(U\) is split against its eigen-weight. lame() draws the same split for position paths (dynamic_uv = TRUE, directed and bipartite), and with prior$uv_rotation_move the orientation of each period of directed paths at R >= 2. Recorded in fit$uv_split_move.

sparse_position_move

Logical, default TRUE. For directed "ordinal" fits with latent factors (R > 0): each sweep also draws the position of every sender and receiver together with the latent values of its row or column, exactly. Moving \(u_i\) changes the predictor of row \(i\) by a different amount in each column; carrying the latent values along changes no residual, so the conditional of the position is its prior times the indicator that the shifted row is still a latent row the data allow, drawn by an elliptical slice step. Actors the data bound on one side only (only the lowest category) move across their wide posterior in a few sweeps instead of by random walk. Recorded in fit$sparse_position_move. An ordinal fit that runs it visits the level translations of actor_move every sweep unless actor_move_every says otherwise.

sparse_position_every

Sweeps between visits of sparse_position_move (default 1: every sweep).

cov_ridge_move

Logical, default TRUE. For bipartite fits with a row or column covariate (a design slice that is constant along the columns or the rows): each sweep also draws, exactly, the amount by which the coefficient and the additive effects of that margin trade against one another without changing any cell's predictor. The two conditional draws cross this ridge slowly. Directed unipartite fits of ame() and lame() (static or dynamic additive effects, static coefficients) take the same draw. FALSE omits it.

ab_shift_move

Logical, default TRUE. For bipartite fits without an intercept (intercept = FALSE, the default of "ordinal") with row and column effects (rvar and cvar): each sweep also draws, exactly, the shift of the row effects against the column effects. Adding \(c\) to every \(a_i\) and subtracting it from every \(b_j\) leaves every \(a_i + b_j\), so the likelihood, unchanged; only the prior of the effects pins \(c\), and the draws of \(a\) given \(b\) and \(b\) given \(a\) cross it slowly, so \(c\) is drawn from its normal conditional. Directed unipartite fits draw the coefficients and both effects jointly and need no such draw; lame() takes it for directed and bipartite fits. Recorded in fit$ab_shift_move. FALSE omits it.

ordinal_scale_move

Logical, default TRUE. For "ordinal" fits: each sweep also draws, exactly, the scale of the whole state (the coefficients, the additive effects and the latent array together, with the free cutpoints of ordinal_cutpoints = "explicit") and, with the default data-induced cutpoints, the shift and the scale of the latent array alone, along transformations that keep every rank. The windows the ranks leave the latent values move the implied cutpoints by steps of 1 / number of cells, while the scale of the configuration has a posterior of width 1 / sqrt(number of cells) and the coefficients and the dyadic correlation follow it: on 150 actors a dyadic coefficient had 8 effective draws of 600 and the correlation 95, now 600 and 400. FALSE omits it; its work is recorded in fit$ordinal_scale_move. See lame.

binary_scale_move

Logical, default TRUE. For "binary" fits: every binary_scale_every sweeps the coefficients and the additive effects are multiplied by a factor drawn exactly from its conditional density, with the latent array integrated out. The augmented sweep crosses that direction by steps of 1 / sqrt(number of cells), and when a covariate separates the ties the posterior along it is tens of times wider: on 30 actors, after 8,000 sweeps, the separating coefficient of a directed panel had 12 effective draws of 2,000, now 460, and that of a bipartite panel, which had drifted over those sweeps (14.0 and 15.6 for two seeds), now has a posterior mean of 59 at 2,000, 8,000 and 32,000 sweeps. FALSE omits it; its work is recorded in fit$binary_scale_move. See lame.

binary_scale_every

Positive whole number, default 5: the sweeps between the draws of that factor.

Common usage: prior = list(Sab0 = diag(c(2, 2)), eta0 = 10) for moderate shrinkage, or prior = list(Sab0 = diag(c(0.5, 0.5))) for tighter control. For a unipartite cross-sectional ame() fit the prior is controlled by Sab0, eta0, Suv0 and g.

g

optional scalar regression prior scale, independent of the residual variance. The unipartite Gaussian block uses precision (XtX + 1e-6 * diag(diag(XtX))) / g; an all-ones first column additionally receives intercept variance 100 * g / XtX[1,1]. If not specified, g = n_observed_cells * var(Y) for normal data and g = n_observed_cells otherwise, where observed cells exclude the diagonal (before covariate-missingness propagation). Per-coefficient (vector) g is not supported by the unipartite path. A bipartite fit has the prior N(0, g s20) on each coefficient, with default g = nA * nB over the mean square of the covariate for a slope, so the unit of a covariate only rescales its coefficient. A finite positive g is required when regression coefficients are fitted; invalid scales are not replaced or clipped. The default is a unit-information prior on the scale of a unit-variance Gaussian response. In a binary model a cell carries about a tenth of that information, so the default acts like about ten cells. On sparse or weak data it stabilises the coefficients and holds separated ones finite; when the signal is very strong it pulls slopes toward zero by about ten cells over the number of observed cells, 1 to 2 percent on networks of 500 to 1,000 cells. A larger g weakens the prior. In a unipartite fit ame() leaves the intercept nearly flat, while lame() gives it the same unit information, so the two can differ on a covariate collinear with the intercept. Note: g is a top-level argument to ame(), not an element of prior = list(...); passing prior = list(g = 0.1) is a no-op (warned about).

seed

random seed for the MCMC sampler (default 6886). The sampler is seeded internally with this value, so results are reproducible by default and an external set.seed() call has no effect on the chain – pass a different seed here to vary the draws (e.g. when running multiple chains). The caller's .Random.seed is restored on exit, so fitting never perturbs your RNG stream.

nscan

number of iterations of the Markov chain (beyond burn-in)

burn

burn in for the Markov chain. Typical use is burn far smaller than nscan; burn > nscan is allowed but warns.

odens

output density (thinning interval) for the Markov chain. nscan / odens samples are stored.

verbose

logical: print progress while running? Default TRUE.

gof

logical: calculate goodness of fit statistics? Setting to TRUE adds approximately 2-5% to runtime. For faster sampling without GOF overhead, set gof=FALSE and use gof() after model fitting.

custom_gof

optional function or list of named functions for computing custom goodness-of-fit statistics. Each function must accept a single matrix Y as input and return a numeric vector. If a single function is provided, it should return a named vector. If a list of functions is provided, each function should return a single value and will be named according to the list names. Custom statistics will be computed in addition to default statistics. Example: custom_gof = function(Y) c(density = mean(Y > 0, na.rm = TRUE))

plot

logical: with chains > 1, plot the pooled fit (plot.ame) once the chains have run. A single chain draws no live panels. Default FALSE.

start_vals

List from previous model run containing parameter starting values for new MCMC

periodic_save

logical: indicating whether to periodically save MCMC results

out_file

character vector indicating name and path in which file should be stored if periodic_save is selected. For example, on an Apple OS out_file="~/Desktop/ameFit.rda".

save_interval

quantile interval indicating when to save during the post-burn-in period.

posterior_opts

optional list of posterior draw-storage options, usually built with posterior_options. Recognised names (unknown names trigger a warning): save_UV, save_UV_draws, save_ab, thin_UV, thin_ab. save_UV = TRUE stores per-iteration latent-position draws on fit$U_samples / fit$V_samples ([actor, dim, draw] arrays; bipartite fits also store the interaction-matrix draws on fit$G_samples); save_UV_draws (the lame spelling) is accepted as an alias. save_ab = TRUE stores additive-effect draws on fit$a_samples / fit$b_samples (a symmetric fit has one effect per actor: the two hold the same draws). thin_UV / thin_ab thin the stored draws. Default NULL.

cores

integer or NULL: workers for the chains. The chains run forked on Unix, at most one worker per chain; NULL uses getOption("lame.cores") if set and otherwise all cores but one. Windows runs the chains one after the other.

chains

integer: the number of independently seeded chains (default 2, or getOption("lame.chains")). Chain \(k\) runs with seed seed + 1000 * (k - 1). With chains > 1 the chains are checked, compared and pooled (see the convergence policy); chains = 1 runs one chain and the drift check only.

use_sparse_matrices

logical: use sparse matrix storage for large networks? (default: FALSE). Recommended only for truly sparse networks (< 10% non-zero entries).

method

character: "mcmc" (default, the Bayesian MCMC fit) or "als" (the fast, MCMC-free empirical-Bayes fit, which reports a standard error for every estimate). When method = "als", MCMC-specific arguments (nscan, burn, odens, ...) are warned about and ignored; the call forwards to ame_als, which uses prior$s20. With method = "als", a binary network whose observed density \(d\) has \(\min(d, 1 - d) < 0.20\) (ties among the observed cells, the diagonal of a one-mode network left out, pooled over periods) is fitted with a warning: there the sampler is the better choice.

bootstrap

integer (only used when method = "als"): number of bootstrap replicates. 0 (default) skips the bootstrap: the fit already carries analytic standard errors. N >= 30 runs N replicates and attaches the result so that vcov(), confint and summary() report bootstrap errors for the coefficients, with the analytic error kept where the bootstrap gives none (a smaller positive N is an error); see bootstrap in ame_als.

bootstrap_type

character (only used when method = "als"): "parametric" (default) or "block"; a single network runs the parametric scheme.

bootstrap_block_length

integer: block length for the block bootstrap.

bootstrap_seed

optional integer seed for the bootstrap.

multistart

character (only used when method = "als" and R > 0): "none" (default), "cheap" (4 starts), or "full" (8 starts). Forwarded to ame_als, which reruns the block-coordinate fit from several starts and keeps the one with the lowest objective.

save_log_lik

logical: attach a per-iteration matrix of matched observed marginal scores. LOO and WAIC additionally require a verified observed likelihood factorization; directed residual dyad correlation prevents cellwise factorization. Default FALSE.

ordinal_cutpoints

character: cutpoint convention for family = "ordinal". "data_induced" (default) uses the data-induced cutpoints; "explicit" samples ordered cutpoints with the first fixed at zero and unit latent residual variance. Independent directed and symmetric models use the Cowles (1996) marginal Metropolis-Hastings update. Directed models with dcor = TRUE use cutpoint Gibbs updates conditional on the correlated latent observations. Explicit cutpoints are supported for unipartite models; predictions retain the original numeric category labels and use each saved cutpoint draw. Ignored for other families.

...

reserved for future use. Passing lame()-only arguments (e.g. dynamic_beta, period_exposure) here triggers a clean abort directing you to lame; passing any other unrecognised name warns so typos are visible rather than silently dropped.

log_lik_method

"observed_exact" (default) supports normal, binary, Poisson-lognormal and explicit-cutpoint ordinal marginal scores. Poisson integration uses an adaptive log-integral with concavity tail bounds. Data-induced ordinal models are refused. "observed_approx" retains the existing approximate diagnostic scores for them without claiming an observed likelihood. AME does not save latent Z draws for augmented scoring. Inspect fit$log_lik_contract; approximate diagnostics cannot be used for observed-data LOO or WAIC.

model.name

optional string for model selection output

Value

Posterior Samples (full MCMC chains):

BETA

Regression coefficients (nscan/odens x p matrix; one row per stored draw)

VC

Variance components (nscan/odens x k matrix)

GOF

Goodness-of-fit statistics ((nscan/odens + 1) x 5 matrix; three columns, sd.rowmean, sd.colmean and four.cycles, for mode = "bipartite"). First row contains observed values, remaining rows contain posterior predictive samples. See gof for post-hoc computation and gof_plot for visualization.

Posterior Means (averaged over chain):

APM

Additive row/sender effects (n-vector)

APM_sd, BPM_sd

posterior standard deviation of each additive effect (static effects), used by simulate() to draw the effects

BPM

Additive column/receiver effects (m-vector); NULL for symmetric networks

U

Multiplicative row/sender factors (n xR matrix): the factors of the posterior mean product UVPM at rank R, columns in decreasing order of its singular values (see latent_positions)

V

Multiplicative column/receiver factors (m xR matrix); NULL for symmetric networks

L

Eigenvalue matrix (R xR diagonal); symmetric networks only

G

Bipartite networks only: the interaction matrix of \(U G V'\), the identity, so that \(U G V'\) is the best rank-R part of UVPM

U_sd, V_sd

With saved latent draws (posterior_options(save_UV = TRUE)), the posterior standard deviation of each coordinate of U and V, each draw matched onto the reported positions by a move that leaves its product unchanged

YPM

Stored response-scale fitted value: the average over the stored draws of the mean response given each draw, which is the tie probability for binary fits, the linear predictor for normal fits and the expected category value for ordinal fits with explicit cutpoints. For data-induced ordinal fits it is the average of ten outcomes replicated at each stored draw. For Poisson fits it is the mean count \(\exp(\eta + \sigma^2 / 2)\) at the posterior means of the linear predictor and of the residual variance; see the Poisson model details.

Metadata:

family

Model family (normal, binary, etc.)

mode

Network mode (unipartite or bipartite)

sampler_health

For MCMC fits, counts of numerical failures, separated from valid prior-bound rejections. A numerical failure (a caught collapsed reciprocity or utility-refresh error in unipartite fits, a failed U, V or G draw in bipartite ones) aborts the fit with an error of class lame_sampler_failure that carries the counts in its health field, so a returned fit has none. A proposal outside the prior's box (prior$uv_max_abs, prior$G_max) is a Metropolis rejection of the model: that conditional keeps its state, and the rejections are counted here. U and V proposal counts in bipartite fits are per proposed actor row and G counts per Gaussian interaction-matrix draw.

sampler_health_iterations

Number of burn-in plus production sweeps included in the MCMC health counts. U and V proposal counts in bipartite fits can exceed this number because each sweep visits multiple actor rows.

exact_fallbacks

Named counts of the times a step kept its state after a numerical failure where keeping it leaves the posterior invariant; they do not stop the fit, summary() states them and a count above a tenth of the sweeps warns with class lame_exact_fallbacks. Empty when there was none.

ab_shift_move

For bipartite fits without an intercept, the sweeps the shift of the row effects against the column effects was drawn (visits) and the sweeps at which it moved them (moved; see ab_shift_move in prior); absent when the draw did not run

uv_g_scale_move

For bipartite fits with positions, the number of sweeps and of rescaled coordinates of the draw along the scale ridge of the positions and the interaction matrix (see uv_g_scale_move in prior); absent when the update did not run

ordinal_scale_move

For "ordinal" fits, the sweeps the scale moves visited (visits) and the sweeps at which the scale of the whole state moved (orbit_moved); absent when the moves did not run

poisson_period_move

For "poisson" fits, the sweeps the scale move visited (visits) and its proposals and accepts (scale_attempts, scale_accepts, and for the correlation alone scale_rho_attempts, scale_rho_accepts); absent when the move did not run

binary_scale_move

For "binary" fits, the draws of the scale of the linear predictor (visits), the evaluations of its density they used (evals) and the draws that moved the state (moved); absent when the draw did not run

actor_move

For Poisson and ordinal fits, the work of the translations of the levels with the latent array: visits, the level translations drawn (level_calls), the likelihood evaluations of the Poisson ones (level_evals), stuck and skipped steps, the draws of the location of the latent array (location_calls, ordinal), the coefficient translations (coef_calls, coef_evals, coef_stuck; Poisson), the position steps (uv_calls, uv_evals, uv_stuck; Poisson with positions) and the attempts and accepts of the scale move of the dyadic variance and correlation (scale_attempts, scale_accepts, rho_attempts, rho_accepts; Poisson); for binary fits, the work of the collapsed per-actor update: visits, the slice steps of the level translations (level_calls) and of the static positions (uv_calls), the likelihood evaluations they used (level_evals, uv_evals), the steps that failed to terminate (stuck) and, for bipartite fits, the draws along the ridge of the intercept and the additive-effect means (ridge_calls); for the other families of a bipartite fit with an intercept, visits and the draws along the ridge of the intercept and the level means (ridge_calls); absent when the updates did not run (see actor_move in prior)

symmetric

Logical indicating if network is symmetric

R

Dimension of multiplicative effects

prior_supplied

TRUE when prior carried Sab0, eta0 or etaab

Optional Posterior Samples (if requested via posterior_options):

U_samples

Samples of U (n x R x iterations array)

V_samples

Samples of V (m x R x iterations array)

a_samples

Samples of row effects (n x iterations matrix)

b_samples

Samples of column effects (m x iterations matrix); in a symmetric fit the same draws as a_samples

Note on the latent-scale matrices: The posterior-mean multiplicative product is stored on the fit (UVPM, or ULUPM for symmetric fits); EZ (the expected latent network) is not stored, to save memory. Accessors:

  • reconstruct_EZ(fit) - Returns linear predictor (link scale, not response scale)

  • reconstruct_UVPM(fit) - Returns the stored posterior-mean multiplicative product (UVPM / ULUPM) when present, otherwise U\

Generating posterior distributions: Use simulate_posterior(fit, component="UV") to generate posterior samples for components where only means are stored, or use posterior_options() during model fitting to save full posterior samples.

model.name

Name of the model (if provided)

Details

This command provides posterior inference for parameters in AME models of cross-sectional relational data, assuming one of six possible data types/models. The function supports both unipartite networks (square adjacency matrices) and bipartite networks (rectangular adjacency matrices with distinct row and column node sets) for single time point analysis.

Model. For a dyad \((i, j)\) the AME linear predictor is

$$\eta_{ij} = \beta_0 + x_{ij}'\beta + a_i + b_j + u_i' D v_j,$$

where \(\beta\) are regression coefficients on dyadic / nodal covariates, \(a_i\) is a row (sender) random effect, \(b_j\) is a column (receiver) random effect, and \(u_i' D v_j\) is the multiplicative latent-factor term (rank R). The observation model is \(Y_{ij} \sim F(\eta_{ij}, \theta)\) with \(F\) specified by family (Gaussian for "normal", probit for "binary", etc.). For unipartite (symmetric = FALSE) the residual error has dyad-level correlation \(\rho\) between \((i, j)\) and \((j, i)\); for bipartite, dyad correlation is fixed at 0.

Priors (in brief). \(\beta\) has a Zellner-style g-prior (g); \((a_i, b_i)\) are jointly Normal with covariance \(\Sigma_{ab}\) (Inverse-Wishart prior Sab0 / eta0); \(u_i, v_j\) are independent Normal with covariance \(\Sigma_{uv}\) (Inverse-Wishart prior with scale kappa0 * Suv0 and kappa0 degrees of freedom); the dyad-correlation \(\rho\) has a flat prior on \((-1, 1)\) (the prior lame uses), updated with Metropolis steps. See prior_summary(fit) for the priors actually used.

Choosing R. The multiplicative rank R controls the dimensionality of latent homophily / heterogeneity not explained by covariates and additive effects. R = 0 fits an additive-only social-relations model; R = 1 or 2 is typical for small / medium networks. A rank above floor(n/3) is fitted like any other (on 18-actor panels with a rank-2 truth, ranks 6 to 17 ran without numerical failure; the chain mixed more slowly and the fitted values lost accuracy gradually as the rank grew past the truth), so compare ranks by their fit rather than by a cap. Latent factors capture unobserved structure (clusters, hub patterns, transitive triangles the covariates miss) and are accessed at fit$U, fit$V.

Identifiability. The latent factor term \(u_i' D v_j\) is invariant to rotation and reflection of \(U, V\); the package canonicalises with an SVD so successive draws are interpretable. For fits with both resolved actor margins enabled, one-mode and bipartite, reporting centers static latent positions and transfers the removed row, column and grand-mean components to the actor effects and intercept. A symmetric shared actor absorbs half the grand constant in each margin when no intercept is fitted. Restricted models retain sampled coordinates in their stored factor draws. This reporting map preserves each draw's predictor and leaves the sampler state unchanged. For visual stability across posterior summaries see procrustes_align and latent_positions.

Theoretical Foundation:

The AME model decomposes network structure into several components: $$y_{ij} = \beta'x_{ij} + a_i + b_j + u_i'v_j + \epsilon_{ij}$$ where:

  • \(\beta'x_{ij}\): Fixed effects of dyadic/nodal covariates

  • \(a_i\): Additive sender (row) effect for node i

  • \(b_j\): Additive receiver (column) effect for node j

  • \(u_i'v_j\): Multiplicative interaction between latent factors

  • \(\epsilon_{ij}\): Dyadic error term (may be correlated)

This specification generalizes the social relations model (Warner et al. 1979) and latent space models (Hoff et al. 2002) within a unified framework.

Prior Distributions:

The model uses conjugate and semi-conjugate priors where possible:

  • Regression coefficients: \(\beta \sim N(0, g\sigma^2(X'X)^{-1})\) (g-prior)

  • Additive effects: \((a_i, b_i)' \sim N(0, \Sigma_{ab})\) jointly

  • Covariance: \(\Sigma_{ab} \sim IW(\eta_0, \eta_0 S_{ab0})\) (inverse-Wishart)

  • Multiplicative effects: Hierarchical shrinkage via \(\eta_0\)

  • Dyadic correlation: flat prior on \((-1, 1)\) (the prior of lame), with Metropolis updates

The inverse-Wishart prior on \(\Sigma_{ab}\) allows learning correlation between sender and receiver effects, capturing reciprocity patterns.

Note on the additive-effects variance scale: for a unipartite fit Sab0 defaults to a data-scaled matrix rather than a fixed diag(2). For the "normal" and "poisson" families the default is Sab0 = diag(2) * vscale, where vscale is an empirical-Bayes moment estimate of the sender/receiver variance: the mean of the variances of the centred row means and column means of Y. For "poisson" the default prior has the weight of one actor (eta0 = 1) and is centred at the effects covariance (va, cab, vb; va and vb for a bipartite fit) that the fast route (ame_als) estimates for the same network, design and rank; where that fit fails, the centre is the variance of the centred log row and column rates. The "binary" and "ordinal" families apply the same idea to a probit-moment residual, but only when start_vals is not supplied and the design has at least one column; otherwise they fall back to Sab0 = diag(2) with eta0 = 4. A bipartite fit scales Sab0 the same way (one scale for both sides). Call prior_summary() on a fitted object to see the prior actually used.

The data scaling matters because the inverse-Wishart prior contributes pseudo-data on the scale of eta0 * Sab0 no matter what units Y is in, so a fixed Sab0 = diag(2) pulls the additive-effects variances va/vb upward whenever the true sender/receiver variance is well below 1, most visibly at small \(n\). The data-scaled default sets the prior on the scale of Y; prior_summary() prints it.

To use a fixed identity scale instead, pass prior = list(Sab0 = diag(2), eta0 = 4). Changing this prior can affect other jointly estimated quantities as well as va, vb and cab. Matching these prior settings alone does not establish equivalence to another package's posterior.

Multiplicative Effects (Latent Factors):

When R > 0, the model includes R-dimensional latent factors:

  • Asymmetric case: \(u_i, v_j \in \mathbb{R}^R\) with \(u_i'v_j\) interaction

  • Symmetric case: \(u_i = v_i\) with eigendecomposition \(ULU'\)

  • Captures homophily, transitivity, and community structure

  • R chosen via model selection or set to 2-3 for visualization

Estimation Algorithm:

The model uses a Gibbs sampler with the following updates:

  1. Sample latent Z given parameters (data augmentation for non-normal families)

  2. Update regression coefficients \(\beta\) via g-prior conjugate update

  3. Update additive effects (a,b) jointly with \(\beta\)

  4. Update covariance \(\Sigma_{ab}\) from inverse-Wishart

  5. Update multiplicative effects U,V via Gibbs or Metropolis-Hastings

  6. Update dyadic correlation \(\rho\) via Metropolis-Hastings

  7. Update variance \(\sigma^2\) (for continuous families)

Standard Model Types:

The following data types/models are available:

"normal": A normal AME model (identity link: \(E[Y] = \eta\)).

"binary": A binary probit AME model (probit link: \(P(Y=1) = \Phi(\eta)\)).

"ordinal": An ordinal probit AME model (cumulative probit link). An intercept is not identifiable with data-induced cutpoints. Explicit cutpoints anchored at zero support an intercept.

"poisson": An overdispersed Poisson-lognormal model for counts (negative or non-integer observed values are an error): \(Y \sim \mathrm{Poisson}(e \exp(z))\) with \(z \sim N(\eta, \sigma^2)\). Given \(\eta\) and \(\sigma^2\), a cell's mean count is \(e \exp(\eta + \sigma^2/2)\). YPM, fitted() and predict(type = "response") report it at the posterior mean \(\eta\) of the linear predictor and the posterior mean \(\sigma^2\) of the residual variance, the form the fast estimators report. Predictive quantiles and event probabilities come from posterior predictive draws (simulate(), predict(type = "distribution")). Zero exposure gives a structural zero count (cross-sectional fits use unit exposure).

Supported family x mode combinations

Every family is supported under both modes. The bipartite Z-samplers live in R/rZ_bipartite.R and dispatch per family; see also the inline comment in R/lame.R (the rectangular samplers live in R/rZ_bipartite.R).

familyunipartitebipartite
normalyesyes
binaryyesyes
ordinalyesyes
poissonyesyes

Symmetric (symmetric = TRUE) fits require a symmetric Y and symmetric Xdyad slices: the regression term of a symmetric fit is symmetric, so an asymmetric slice is an error (class lame_symmetric_xdyad) that names the slice. Replace it by (X + t(X)) / 2. A value missing in one triangle of a slice is not an asymmetry: it is filled from the other triangle (see Missing covariates). lame applies the same checks to every period, and the ALS routes (method = "als", ame_als) refuse an asymmetric slice the same way. family = "ordinal" with symmetric = TRUE is supported via the unit-variance unordered-dyad samplers for either cutpoint convention, which mirror upper-triangle draws to the lower triangle so \(Z = t(Z)\) holds at every sweep.

Symmetric input with one triangle missing. When symmetric = TRUE and one triangle of Y is fully NA (the user stored only the lower or upper triangle), the symmetry check any(is.finite(Y - t(Y))) is FALSE, and the call stops with an error instead of mirroring the populated triangle. Symmetrize Y explicitly (for example Y[lower.tri(Y)] <- t(Y)[lower.tri(Y)]) before calling; lame() applies the same check to every period.

Data preparation

ame() accepts a matrix directly. For long-format edgelists, bipartite data, and covariates, use netify to build the network object and pass that object as Y. ame() will call netify::to_lame() internally. If you already have an igraph or network object and only need a plain adjacency matrix, as_lame_y is still available as a small convenience helper.

Directed normal MCMC models with estimated reciprocity use a flat prior on the full open interval \((-1,1)\). If every observed reciprocal response pair is exactly equal, the posterior can be improper at \(\rho = 1\). A conservative structural check counts reciprocal pairs and bounds the antisymmetric actor/regression design dimension. With multiplicative rank R, it also includes a conservative n * R factor bound. The check refuses cases where the pair count exceeds that combined bound by two or more (the posterior is improper from that excess under this prior); it does not certify propriety of other designs. For an undirected network, use symmetric = TRUE; to fix reciprocity at zero in a directed model, use dcor = FALSE. An exactly symmetric Y fitted with symmetric = FALSE is allowed: the two cells of a dyad are equal, so the residuals of reciprocal cells are equal and the posterior of the dyadic correlation concentrates near one (with dcor = FALSE the two cells count as two observations). A message says so and points at symmetric = TRUE, which fits the undirected model.

For an undirected/symmetric network, pass symmetric = TRUE; for a rectangular two-mode network (students x courses, donors x candidates), pass mode = "bipartite" or build the netify object with mode = "bipartite". Xrow and Xcol accept either a numeric matrix or a data.frame (coerced internally); Xdyad must be a 3-D array n x n x p of numeric covariates with no Inf/NaN.

Missing covariates

A cell whose dyadic covariate, sender (row) covariate or receiver (column) covariate is missing is an unobserved tie, for unipartite and bipartite networks alike: it is set to NA in Y before the design is built, the sampler augments it like any other missing cell, and the covariate coefficients are estimated from the complete cells. A message gives the number of such cells. A missing value is never modelled as 0, which would bias the coefficient of a covariate that is not centred. In an undirected network (symmetric = TRUE) a dyad has one covariate value: a hole in one triangle of a dyadic covariate is filled from the other triangle (a message gives the number of values), so the slice stays symmetric and the dyad stays observed, and a dyad missing in both triangles is unobserved. A missing node covariate removes the actor's row and column. A covariate that is missing everywhere stops the fit. lame (per period) and the ALS routes (ame_als) apply the same rule and give the same messages.

Collinear covariates

A regression design whose columns are aliased over the observed cells (a covariate that duplicates another, or one that is a linear combination of others, counting the intercept and the sender and receiver covariates) is an error of class lame_design_rank. It names the aliased columns and the combination each equals: the data cannot separate their coefficients, so the posterior along that direction would be the prior's alone. A column is aliased when it is a combination of the columns before it to a relative 1.5e-7, the collinearity below which the cross products the coefficient updates work with keep fewer than two digits; a design that is only nearly collinear is fitted.

When to use AME vs ERGM

AME and ERGM are complementary tools for binary network analysis, not direct substitutes. ERGM is a class of exponential-family models built around explicit network statistics (counts of edges, mutual ties, triangles, geometrically-weighted shared partners, ...). You write the statistics you think matter, ERGM gives you their coefficients. ERGM excels when you have a substantive theory about which configurations drive tie formation.

AME models latent homophily / heterogeneity directly via sender, receiver, and multiplicative latent-factor effects. You don't enumerate triadic terms; the multiplicative-effects rank R captures higher-order structure (clustering, transitivity, hub patterns) implicitly. AME excels when (a) you have dyadic / nodal covariates whose effects you want to interpret cleanly without ERGM degeneracy, (b) higher-order structure is "nuisance" that you want to absorb but not parameterise, or (c) you need a posterior distribution over predictions for forecasting or imputation.

Practical guidance: if your research question is "do nodes that share attribute X tend to form triangles together?", reach for ERGM's gwesp. If your research question is "controlling for unobserved sender / receiver heterogeneity and latent clustering, what is the effect of dyadic covariate X?", reach for AME. The R = 0 additive-only case is the social relations model (Warner, Kenny, Stoto 1979); R >= 1 adds latent space.

ERGM to AME translation

For users coming from statnet::ergm, the rough analogues are:

ERGM termAME analogue
edgesintercept (probit link, not logit)
nodecov("x")Xrow = x or Xcol = x
nodematch("g")dyadic covariate via nodematch(g) into Xdyad
nodefactor("g")dyadic covariate via nodefactor(g) into Xdyad (drop one level)
absdiff("z")dyadic covariate via absdiff(z) into Xdyad
mutualdcor = TRUE -> the rho parameter (probit-scale, not log-odds; not numerically comparable to ERGM's mutual)
gwesp / transitivityR >= 1 multiplicative latent factors (not the same statistic)
sender activity heterogeneityrvar = TRUE, gives a_i, va
receiver popularity heterog.cvar = TRUE, gives b_j, vb

For family = "binary" the link is probit, so the intercept is on the probit scale; do not compare it to an ERGM edges estimate by simple arithmetic.

Migration from amen

Both amen and lame export ame(); loading both packages fires a startup warning telling you to call lame::ame(...) or amen::ame(...) explicitly.

For default cross-sectional calls, lame::ame() follows the amen::ame() interface: the fit$BETA slot is a 2-D [n_stored, p] matrix in both packages, so scripts that call colMeans(fit$BETA) or apply(fit$BETA, 2, mean) continue to work unchanged. lame additionally accepts family = "binary" (which amen 1.4.5 no longer accepts; amen requires "bin"). Progress output is controlled by verbose, which takes the place of the print argument of amen::ame(); a call that passes print = ... warns that the argument is unrecognised.

The cross-sectional path has no dynamic_beta option (an AR(1) prior on a single-period coefficient is unidentified), so the BETA 3-D shape that lame() can produce never arises from ame(). See lame for the longitudinal path and the silent-aggregation hazard with 2-D apply(fit$BETA, 2, mean) scripts under dynamic_beta = TRUE.

Notes on priors

  • The regression-coefficient prior is a Zellner g-prior (beta ~ N(0, g * sigma^2 * (XtX)^-1) where XtX is the design cross-product). g is a top-level argument of ame(), not an entry in prior = list(...) (a common slip).

  • There is no per-coefficient prior knob. If you need student_t, horseshoe, or to centre a slope away from zero, AME does not currently expose it; the g-prior structure is the only knob.

  • Unknown names in prior = list(...) are warned about (a typo like Sab = ... instead of Sab0 would otherwise be silently dropped).

Chains and convergence policy

ame() runs chains chains (default 2; options(lame.chains = k) sets another default). Chain \(k\) is seeded with seed + 1000 * (k - 1), so chains = 1 is the first chain of a two-chain fit. On Unix the chains run forked, on at most cores workers (all cores but one by default); on Windows they run one after the other. The draws do not depend on the number of workers. The result is the pooled fit of combine_ame_chains, with fit$chains, fit$chain_seeds, fit$rhat (the R-hat of each monitored series with its effective draws per split chain, pooled ess and of the least-mixing chain ess_chain, its threshold, whether the chains hold enough effective draws to be compared on it, informative, and how many that takes, ess_needed; ess and ess_chain count effective draws per split chain, half of one chain, while the ESS column of summary() is the total over all chains), the state each chain stopped in, and the chain_indicator that as_draws() and trace_plot() use. Two chains cost twice the CPU time and about the same wall time on a multicore machine.

At the end of the post-burn run every chain is checked, and the chains are compared with each other. Within a chain, the first and last thirds of the stored draws of the intercept (or first coefficient), va, vb, ve and rho are compared with batch-means standard errors (ten batches per third); a quantity is flagged when the two means differ by more than half a posterior standard deviation of the whole series and by more standard errors than the drift threshold. Between chains, the split rank-normalised R-hat (Vehtari et al., 2021) of each series of the monitored set is compared with its threshold, the larger of 1.05 and the value settled chains of the same length and autocorrelation stay under. Both thresholds are set so that chance alone flags settled chains anywhere in the fit with probability about 1 percent per check. The chains are compared on a series only when they hold enough effective draws (about 35 to 40 per split chain) for its threshold to catch chains one posterior standard deviation apart at least 95 percent of the time; a series with fewer is flagged as having too few effective draws to compare (see Gate thresholds in lame). The monitored set is every regression coefficient, va, vb, cab, ve, rho, and summaries of the additive and latent structure recorded at every stored draw (the rms of a and b, the largest actor effect, the rms of the latent product \(UV'\), the norm of G of a bipartite fit and the split of scale between U and V of a directed fit). The dyadic products are not monitored. Quantities a fit reports as not estimated are left out, and a run with fewer than 60 stored draws per chain is not checked (print() says so). The gate is computed on the draws the returned fit holds (the last block of every chain), and summary() and compute_mcmc_diagnostics report the same statistic of the same draws: the Rhat and Threshold columns of summary() are fit$rhat for every monitored coefficient and variance component.

When a chain drifts, an R-hat exceeds its threshold or a series has too few effective draws to compare, every chain is extended by a block of sweeps from its own final state (the seeds advance by the sweeps already run); the flagged block counts as extra burn-in, its draws are discarded, and both checks run again. The block is nscan sweeps or, when series are short of effective draws, long enough for each to hold a quarter more than it needs at its autocorrelation (at most four times nscan; the stored draws grow with the block). Up to prior$chain_extensions extensions are made (default 3). The returned fit holds the draws of the last block, and fit$auto_extend records the extensions, the sweeps discarded, the length of the last block (block_nscan) and the quantities that triggered each. If a chain of the last block still drifts or an R-hat is still above its threshold (or prior$chain_extensions is 0), ame() returns the fit with its draws and a warning of class lame_chain_unsettled that names the quantities still moving; fit$auto_extend$settled is FALSE, fit$auto_extend$moving lists them, fit$rhat holds the monitored table (R-hat, effective draws, threshold and verdict of every series), print() and summary() say that the chain had not settled, and lame_resume(fit, nscan = nscan) continues every chain. Inspect the traces or run longer before relying on such a fit. If the chains of the last block only hold too few effective draws on some series, the fit is returned with a warning of class lame_chain_not_compared that names them and the nscan that would be enough, and fit$rhat marks them informative = FALSE. prior = list(chain_extensions = 0) decides on the first block; chains = 1 runs one chain with the drift check only. No chain that still drifts, or an R-hat still above its threshold, after the last extension is returned with its draws. The measured rates are in lame.

See also

lame for longitudinal models, gof for post-hoc goodness-of-fit computation, gof_plot for visualizing GOF results, latent_positions for extracting latent positions as a tidy data frame, procrustes_align for Procrustes alignment of latent positions, summary.ame for model summaries, coef.ame for coefficient extraction

Author

Cassy Dorff, Shahryar Minhas, Tosin Salau

Examples

# \donttest{
data(YX_nrm)
# the default runs two chains and compares them on the regression
# coefficients, variance components and effect summaries; 120 stored draws
# per chain hold enough effective draws to compare them
fit <- ame(YX_nrm$Y, Xdyad = YX_nrm$X, burn = 100, nscan = 1200, odens = 10,
           verbose = FALSE)
summary(fit)
#> 
#> ── AME model summary ───────────────────────────────────────────────────────────
#> 
#> ── Call 
#> Y ~ dyad(intercept, rgpa, rsmoke, cgpa, csmoke, igrade, igpa, ismoke) + a[i] + b[j] + rho*e[ji], family = 'normal'
#> 
#> ── Regression coefficients 
#>                Estimate StdError z_value p_value CI_lower CI_upper  Rhat
#> intercept_dyad   -2.692    0.105 -25.665       0   -2.878   -2.488 1.012
#> rgpa_dyad         0.223    0.098   2.268   0.023    0.041    0.412 1.005
#> rsmoke_dyad       0.253    0.151   1.671   0.095   -0.041    0.528 1.008
#> cgpa_dyad         0.169    0.034   4.889       0    0.107    0.239 0.994
#> csmoke_dyad        0.11    0.046   2.401   0.016    0.023    0.196 1.002
#> igrade_dyad       1.134    0.032  35.958       0     1.08    1.199 0.993
#> igpa_dyad         0.055    0.015   3.558       0    0.019    0.083 1.015
#> ismoke_dyad       0.028     0.03   0.949   0.343   -0.033    0.084 0.996
#>                Threshold     ESS    
#> intercept_dyad      1.05     240 ***
#> rgpa_dyad          1.058     240   *
#> rsmoke_dyad        1.056     240   .
#> cgpa_dyad           1.05     240 ***
#> csmoke_dyad         1.05     240   *
#> igrade_dyad         1.05     240 ***
#> igpa_dyad          1.072 159.484 ***
#> ismoke_dyad        1.051     240    
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ℹ Stars are a visual hint from the posterior mean / SD only; for inference use
#>   the credible intervals.
#> 
#> ── Variance components 
#>     Estimate StdError  Rhat Threshold ESS
#> va     0.832    0.117 1.009     1.054 240
#> cab    0.100    0.029 1.000     1.050 240
#> vb     0.084    0.013 0.998     1.054 240
#> rho    0.920    0.002 1.002     1.050 240
#> ve     1.057    0.020 1.005     1.050 240
#>   va = sender variance, cab = sender-receiver covariance, vb = receiver
#>   variance, rho = dyadic correlation, ve = residual variance
#> ℹ Threshold is the R-hat the between-chain gate held each monitored quantity
#>   to: 1.05, or the R-hat that settled chains with the same effective draws
#>   reach by chance, if larger.
#> ✔ The chains agree on every monitored quantity (R-hat at most its threshold, with enough effective draws to compare).
fit$rhat  # between-chain split R-hat, threshold and verdict of every series
#>         parameter      rhat      ess ess_chain threshold informative ess_needed
#> 1  intercept_dyad 1.0123475 58.76502  50.96452  1.050000        TRUE   35.83402
#> 2       rgpa_dyad 1.0053923 48.79951  48.30246  1.057691        TRUE   35.83402
#> 3     rsmoke_dyad 1.0078978 49.78991  53.58882  1.056330        TRUE   35.83402
#> 4       cgpa_dyad 0.9943543 60.00000  50.10016  1.050000        TRUE   35.83402
#> 5     csmoke_dyad 1.0015196 56.60553  43.75756  1.050000        TRUE   35.83402
#> 6     igrade_dyad 0.9931265 58.97941  52.58859  1.050000        TRUE   35.83402
#> 7       igpa_dyad 1.0150390 40.41347  35.38898  1.071996        TRUE   35.83402
#> 8     ismoke_dyad 0.9961999 53.77508  42.32155  1.051381        TRUE   35.83402
#> 9              va 1.0087514 51.69619  46.95752  1.053864        TRUE   35.83402
#> 10            cab 1.0001741 58.30750  55.84584  1.050000        TRUE   35.83402
#> 11             vb 0.9979477 51.64208  45.62170  1.053932        TRUE   35.83402
#> 12            rho 1.0020546 60.00000  54.05457  1.050000        TRUE   35.83402
#> 13             ve 1.0047601 57.93700  47.35582  1.050000        TRUE   35.83402
#> 14          a_rms 1.0005906 60.00000  60.00000  1.050000        TRUE   35.83402
#> 15          a_max 1.0044228 57.61228  39.34527  1.050000        TRUE   35.83402
#> 16          b_rms 1.0287023 54.44643  34.39379  1.050621        TRUE   35.83402
#> 17          b_max 0.9959933 58.41778  48.89802  1.050000        TRUE   35.83402
# the defaults (burn = 500, nscan = 10000, odens = 25) are the length of a final run
# }