Fits an additive and multiplicative effects (AME) model to a longitudinal
(replicated) network by iterative block coordinate descent,
producing a fast fit without MCMC that reports a standard error for every
estimate. For
normal, binary and Poisson data it is an empirical-Bayes / variational
estimator of the model that lame samples (see
ame_als); its vcov() and confint() are Laplace
approximations.
This is the longitudinal counterpart of ame_als; the
estimated effects (mu, beta, a, b, U,
V) are static (pooled across time), as in a non-dynamic
lame fit.
The estimation algorithm adapts the iterative block coordinate descent
estimator of the Social Influence Regression model of Hoff & Minhas
(sir::sir_alsfit()) to the AME model; it is a port and adaptation,
not original lame methodology. See ame_als for the
algorithm details.
Usage
lame_als(
Y,
Xdyad = NULL,
Xrow = NULL,
Xcol = NULL,
R = 0,
family = "normal",
mode = c("unipartite", "bipartite"),
symmetric = FALSE,
max_iter = 200,
tol = 1e-06,
link = c("probit", "logit"),
linear_solver = c("eigen", "qr", "auto"),
multistart = c("none", "cheap", "full"),
bootstrap = 0L,
bootstrap_type = c("parametric", "block"),
bootstrap_block_length = 1L,
bootstrap_seed = NULL,
verbose = TRUE,
seed = 6886,
dcor = !symmetric,
prior = NULL
)Arguments
- Y
a list of
trelational matrices, or a 3d array[n_row, n_col, t]. A named list may have changing actor composition; every slice must carry row and column names so actors can be aligned to the union panel. Unnamed lists and arrays are treated positionally and must have one fixed layout. A longitudinal netify object is also accepted and converted withnetify::to_lame(lame = TRUE).- Xdyad
a list of
Tdyadic covariate matrices/arrays, orNULL.- Xrow
a list of
Trow/sender covariate matrices, orNULL. In a symmetric model (symmetric = TRUE) each node covariate enters a dyad through both of its actors.- Xcol
a list of
Tcolumn/receiver covariate matrices, orNULL. In a symmetric model a node covariate may be given inXrow, inXcolor in both, and each distinct covariate enters once, as<name>_node.- R
integer dimension of the multiplicative effects (default
0). The covariate coefficients are conditional on this choice. The multiplicative term \(u_i'v_j\) is a flexible high-variance regressor that can correlate with the dyadic covariates, so the estimatedbetacan shift – and occasionally change sign – asRincreases. Comparing against anR = 0fit is a useful check on whether the covariate story is being driven by the latent rank.- family
one of
"normal","binary", or"poisson". The ordinal family is MCMC-only.- mode
"unipartite"(square) or"bipartite"(rectangular).- symmetric
logical; fit a symmetric (undirected) model. Unipartite only. Every dyadic covariate slice must be symmetric: an asymmetric one is an error of class
lame_symmetric_xdyadthat names the slice (and, for a panel, its first period), as inameandlame.- max_iter
maximum number of block coordinate descent iterations (default 200), and maximum number of outer reweighting steps for IRLS. A fit that does not settle within it follows the rank rule of Choosing the rank in
ame_als(a retired column, or a warning of class"lame_als_unsettled"); withmax_iterbelow 200 a stop at the limit is not retired but continued, then returned at its last iterate with that warning. A reweighting step runs at most five sweeps (it refreshes the weights, the Laplace correction and the variance updates after them). The variational stage runs at most20 * max_iteriterations (2 * max_iterwithoptions(lame.eb_scale = "plugin")). A fit whose iteration does not settle retires its weakest latent column and fits the next rank down when that fit's lower bound is at least as high (see A rank the data do not support); amax_iterbelow 200 disables that for an iteration that merely ran out of it.- tol
convergence tolerance on the relative change in residual sum of squares (default
1e-6). IRLS additionally requires the largest penalized likelihood score, scaled by the square root of its Fisher information plus penalty curvature, and the largest absolute log variance update to be at mostsqrt(tol).- link
link of a
binaryfit:"probit"(default; matchesame/lame) or"logit".poissonalways uses the log link; ignored otherwise.- linear_solver
solver for the regression block:
"eigen"(default) eigendecomposes the normal equations;"qr"uses a QR factorisation of the observed design, which is more stable for ill-conditioned covariates;"auto"picks"qr"when the design is ill-conditioned but full rank. All give the same answer for well-conditioned designs.- multistart
for
R > 0(a non-convex objective),"none"(default) fits from a single deterministic start;"cheap"(4 starts) and"full"(8 starts) also try random low-rank starts and keep the converged start with the lowest value of the criterion, evaluated at that start's own scales: the Laplace marginal likelihood of the start, minus twice its logarithm ("Laplace marginal likelihood"; see Choosing the rank), which integrates the effects and the factors and does not move with the scale of a factor column the data do not use (with the default variational stage every start is refined, and starts of different modes end at the same variational fit, so they neither differ inmultistart_distancenor warn). When a converged start has no marginal likelihood the starts are rated by the empirical-Bayes objective, the penalised deviance plus the penalty of the actor effects, the log determinant of their information and the hyperprior of their covariance ("empirical-Bayes objective"). The raw deviance is not compared: it always favours the least-shrunk optimum, the one with the largest scales. The criterion (multistart_criterion), its value for each start (multistart_sse; the objective includes the hyperprior, whichobjectiveleaves out), each start's observed-data deviance at its posterior mode (multistart_deviance;devianceis that of the reported fit), its distance from the kept start (multistart_distance) and its convergence are recorded. The distance is the squared difference of the two fitted linear predictors, weighted by the mean of the two IRLS weights and summed over the observed cells: an approximation of the change in the deviance between the two fits. When a converged start is more than one deviance unit away from the kept one, the best such start is refined as the kept start was and its reported coefficients are compared with the kept fit's: the fit warns of materially different local optima (class"lame_als_multistart"), saying how many standard errors apart they are, only when some coefficient differs by more than 0.1 of its standard error (or the alternative could not be refined). Starts at different modes usually refine to the same reported fit, and then the fit does not warn. Starts that end at the same fitted values can still differ in the penalised objective, which depends on the scales of the factors, and those settle more slowly than the fitted values (the Laplace marginal likelihood differs far less); that difference does not warn. Every multistart fit also keeps the coefficients each start reports (multistart_coefficients) and the distance of each start's multiplicative surface from the kept start's (multistart_product_distance), so that the spread of the estimates across the starts can be read from the fit. Reproducible givenseed; the global RNG stream is left unchanged.- bootstrap
integer: if > 0, additionally run
bootstrapreplicates of the parametric or block bootstrap (viaame_als_bootstrap) after the fit and attach the result asfit$bootstrap. The downstream accessors (vcov.ame_als,confint.ame_als,summary,print) then report the bootstrap standard errors and intervals of the coefficients; a quantity the bootstrap gives none for keeps its analytic error, andfit$bootstrap$se_sourcenames it with the reason. At least 30 replicates are needed: a smaller positive number is an error of class"lame_als_bootstrap_replicates"raised before anything is fitted. A bootstrap that cannot run on the fitted model (too few valid replicates, for example) leaves the fit with its analytic standard errors and a message (class"lame_als_bootstrap_not_run");fit$meta$bootstrap_not_runrecords the reason. Default0(no bootstrap): every fit already carries analytic standard errors.- bootstrap_type
character:
"parametric"(default) or"block"– the bootstrap scheme to use whenbootstrap > 0. The block scheme gives no replicate standard error for the parameters that resampling time slices cannot vary (the node-covariate coefficients and the variance components of the actor effects, among others), which keep their analytic errors; on a panel too short for ten blocks it runs the parametric scheme, with a message. Seeame_als_bootstrap.- bootstrap_block_length
integer: block length for the block bootstrap; only used when
bootstrap_type = "block".- bootstrap_seed
optional integer seed for the bootstrap (the point fit uses
seed).- verbose
logical; print progress (default
TRUE).- seed
random seed (default
6886) for the random starts ofmultistart = "cheap"/"full"; the caller's random number state is restored afterwards. The block coordinate descent itself is deterministic, so withmultistart = "none"the point estimate does not depend on it.- dcor
logical; whether a directed binary probit, Poisson or normal fit models the dyadic correlation of the latent errors of the two cells of a dyad, as
ameandlamedo with theirdcor = TRUE. The default is!symmetric, the default of the samplers. For a binary fit the correlation is part of the model that is fitted: the two cells of a dyad are one bivariate probit observation,fit$VC["rho"]is the correlation of that model, and the factors, the standard errors and the predictions are those of the model (see Dyadic correlation in Details).dcor = FALSEfits independent cells and reports the correlation of the pairs of cells at the fitted predictor. A directed count fit takes the pairs at its fitted state (see Dyadic correlation of counts in Details), and a directed normal fit takes the two cells of a dyad as one bivariate normal observation, in closed form (see Dyadic correlation of normal data in Details; it costs 1.3 to 1.6 times the independent-cell fit). A fit that has no pair likelihood (undirected and bipartite networks) keeps its own estimate ofrho; an explicitdcor = TRUEwith the logit link is an error, because the latent correlation is that of normal errors. The fast route holds the correlation off the boundary with a prior of density proportional to \(1 - \rho^2\); the samplers' prior is flat. The pair likelihood of a binary or count fit costs 1 to 2.5 times the independent-cell fit for one period and 2 to 4.5 times for four, in proportion to the number of dyads and periods;dcor = FALSEis the fast path for very large networks. A directed normal network whose reciprocal pairs are all exactly equal (an undirected network given as a directed one) has an improper posterior for the correlation under the fast route's prior, and is refused asamerefuses it (class"lame_improper_normal_reciprocity"): fit it withsymmetric = TRUE, or withdcor = FALSE.- prior
NULLor a named list of priors. The estimators read one key,s20, the scale of the inverse-gamma prior of the variance of the noise of a Poisson or a normal fit (one degree of freedom ons20; by default a normal response has the variance of the observed responses, the priorameandlamedraw it under, and a count has no scale on the variance (zero degrees of freedom, so no value pulls it). The other keys of the samplers' prior list have no counterpart in the estimators; they are reported and ignored. The prior of the multiplicative effects of a directed network is the samplers' default (ame,Suv0andkappa0).
Value
An object of class "ame_als"; see ame_als,
including the per-start fields (multistart_coefficients,
multistart_product_distance and the others) that a fit with
multistart records. Named actors are returned sorted by name, as
lame returns them; covariates named with the same actors
are matched to them by name.
Sparse and dense binary networks
A binary panel whose observed density \(d\) (the share of
observed cells that are ties, the diagonal of a one-mode network left out, pooled over the periods)
has \(\min(d, 1 - d) < 0.20\) is fitted by the fast route with a warning (class
"lame_fast_binary_density"): there its slopes are pulled toward zero, its intercept is biased and its
intervals cover less often than stated, and the sampler (lame) is the better choice.
Fewer dimensions than requested
A fit that keeps fewer multiplicative dimensions than were requested (fit$R below
fit$R_requested) says so with a warning of class "lame_als_retirement", which
print() and summary() repeat: how many dimensions were requested and kept, and why. For a
binary fit it adds that a multiplicative structure too weak for the fast route to resolve may
remain, which the standard errors do not account for, and that method = "mcmc" resolves
weaker structure: on binary panels of 50 actors and 4 periods the fast route kept a product of
the strength of the package's example data in none of 30 panels, and both dimensions of one of
twice that strength or more in 89 of 90 (the other kept one). Normal and count fits keep weak
products.
References
Minhas, S. and Hoff, P. D. (2025). Decomposing Network Dynamics: Social
Influence Regression. Political Analysis. The iterative block
coordinate descent estimator adapted here originates with that work
(implemented in sir::sir_alsfit()).
See also
ame_als, ame_als_bootstrap,
lame for the full MCMC estimator,
als_dynamic_beta for a regression-only smoother
that estimates only a time-varying \(\beta_t\) (no
\(a, b, U, V\); not a special case of this function).