Fit a longitudinal additive and multiplicative effects model with a residual precision shared across all periods of each directed pair. This permits persistent differences in volatility between pairs. All mean components and variance parameters are estimated jointly by MCMC.
Usage
lame_robust(
Y,
Xdyad = NULL,
R = 2L,
df = 4,
burn = 5000L,
nscan = 20000L,
odens = 20L,
seed = NULL,
prior = list(),
verbose = interactive(),
actor_df = Inf,
observation_df = Inf
)Arguments
- Y
List of at least two equally sized square numeric matrices. Rows are senders, columns are receivers, and list order is temporal order with equally spaced periods. Missing outcomes are allowed; diagonals are ignored. The actor set must be constant. When supplied, unique actor and period names are used to align inputs.
- Xdyad
Optional list of sender-by-receiver-by-covariate numeric arrays, one per period. A matrix denotes a single covariate. Covariates must be finite off the diagonal, including for missing outcomes. No intercept is inserted into this design; the model contains a separate time intercept.
- R
Nonnegative integer factor rank, smaller than the number of actors.
- df
Degrees of freedom greater than two for the persistent pair precision prior. The default is four. Use
Infto remove persistent pair heterogeneity. Withobservation_df = Inf, this gives a homogeneous Gaussian residual model with the same mean specification and other priors.- burn
Number of initial iterations discarded.
- nscan
Number of iterations after burn-in; must be a multiple of
odens.- odens
Retain every
odens-th iteration. Every retained iteration includes the complete joint state needed for prediction and simulation.- seed
Optional nonnegative integer sampler seed. An explicit seed preserves the caller's RNG state. With
NULL, a seed is drawn from the caller's stream and recorded in the result.- prior
Named list overriding the proper priors described below.
- verbose
Logical; print progress every 5,000 iterations.
- actor_df
Degrees of freedom greater than two for independent sender-period and receiver-period innovation precisions.
Inf(default) retains Gaussian actor innovations. A finite value permits periods with unusually large changes in sender or receiver activity.- observation_df
Degrees of freedom greater than two for independent observation precisions.
Inf(default) adds no temporary scale; finite values permit isolated residual shocks within otherwise stable pairs.
Value
An object of class lame_robust, with draws, aligned Y and
Xdyad, resolved prior, seed, and sampling settings. In draws,
beta, mu, and hyper have iterations in rows; A and B are
actor-by-period-by-iteration arrays; a0 and b0 are actor-by-iteration
matrices; U and V are actor-by-rank-by-period-by-iteration arrays;
lambda is sender-by-receiver-by-iteration. With finite actor_df,
tau_ab is role-by-period-by-iteration (sender, receiver). With finite
observation_df, omega is sender-by-receiver-by-period-by-iteration.
All components share the
same iteration order. Methods include prediction, simulation, coefficient
summaries, posterior covariance, credible intervals, and observation count.
Details
For off-diagonal observations, the conditional model is
$$y_{ijt} = x_{ijt}^{T}\beta + \mu_t + a_{it} + b_{jt} +
u_{it}^{T}v_{jt} + e_{ijt}, \qquad
e_{ijt} \mid v_e,\lambda_{ij},\omega_{ijt} \sim N(0,v_e/(\lambda_{ij}\omega_{ijt})).$$
For finite df, independent directed-pair precisions have
\(\lambda_{ij}\sim\mathrm{Gamma}(df/2,df/2)\) in shape-rate
parameterization and persist through observed and forecast periods.
With observation_df = Inf, each residual has a Student distribution
after integrating out the pair precision; residuals for the same pair
share that random scale across time. Opposite directions have independent
precisions. For df = Inf, all pair precisions equal one.
For finite observation_df, independent precisions
\(\omega_{ijt}\sim\mathrm{Gamma}(observation\_df/2,observation\_df/2)\)
add a temporary residual scale to each observation. Otherwise these
precisions equal one. Conditional on the pair precision, integrating out
the temporary precision gives a Student residual. When both degrees of
freedom are finite, the fully marginal residual is a mixture over both
scales and is not a single Student distribution. Replication and forecasting
draw fresh temporary precisions; the persistent pair precision is retained.
The time intercept follows a zero-mean stationary AR(1). Sender and receiver
effects each equal a persistent actor level plus an AR(1)
deviation (stationary Gaussian when actor_df = Inf). Levels and deviations sum to zero across actors in every period.
Sender and receiver levels have an estimated bivariate covariance; their
deviations have independent innovations with a shared variance and AR
coefficient. Factor coordinates follow independent zero-mean stationary
AR(1) processes, sharing an innovation variance and AR coefficient.
With finite actor_df, each actor role and period has an independent
precision \(\tau_{rt}\sim\mathrm{Gamma}(actor\_df/2,actor\_df/2)\).
Conditional on this precision, centered actor innovations have covariance
\((v_{ab}/\tau_{rt})(I-11^T/n)\). The initial deviation uses covariance
\(v_{ab}(I-11^T/n)/[\tau_{r1}(1-\rho_{ab}^2)]\). This specifies the
initial distribution for the finite panel; it is not asserted to be the
stationary distribution of the Student-innovation process. Future periods
draw new role precisions, while actor levels persist.
There are three AR coefficients: for the intercept, actor deviations, and factors. Each has a normal prior with mean 0.8 and standard deviation 0.3, truncated to (-0.995, 0.995).
Let v be the variance of observed off-diagonal responses, resolved once
before sampling (one if that variance is undefined or nonpositive).
The prior overrides are:
ve_shape,ve_rateResidual variance inverse-gamma shape and rate, defaulting to 2 and
v. The density is proportional to \(x^{-a-1}\exp(-b/x)\). The shape must exceed one.ar_shape,mu_rate,ab_rate,uv_rateInverse-gamma priors for intercept, actor-deviation, and factor innovation variances. The common shape defaults to 2 and must exceed one. Rates default to
0.1 * v,0.1 * v, and0.1 * sqrt(v), respectively.level_df,level_scaleInverse-Wishart prior for the bivariate actor-level covariance. Defaults are 4 degrees of freedom and
v * I. Degrees of freedom must exceed three; scale must be positive definite. The density is proportional to \(|S|^{-(\nu+3)/2}\exp\{-\mathrm{tr}(\Psi S^{-1})/2\}\).beta_precisionPositive scalar or one value per covariate for independent zero-mean Gaussian coefficient priors. Default
0.01 / vgives variance100 * v, in the unit of the response and independently of the residual variance.
All rates must be positive. The defaults are written in the unit of the
response (a fit of c * Y is the fit of Y in other units), so only the
units of the covariates matter for the priors; inspect fit$prior when
comparing specifications.
This estimator supports directed continuous networks with stable actors.
It does not estimate residual reciprocity, changing membership, bipartite
structure, binary responses, dynamic covariate coefficients, offsets, or
alternative latent laws of motion. It has its own lame_robust class and
does not use lame()'s priors or inherit its fit class.
Run at least two independently seeded fits and pass them to
compute_mcmc_diagnostics(). Diagnostics cover
all retained identified parameters, including every off-diagonal latent
product. Raw factor coordinates are rotation dependent.
simulate.lame_robust() compares replicated networks with the
observed statistics relevant to the analysis.
Examples
set.seed(21)
Y <- lapply(1:3, function(t) {
y <- matrix(rnorm(25), 5, 5)
diag(y) <- NA
y
})
# a three-period panel, its one-step forecast and two simulated panels
fit <- lame_robust(Y, R = 0, burn = 10, nscan = 20, odens = 2,
seed = 1, verbose = FALSE)
dim(predict(fit, h = 1))
#> [1] 5 5 1
dim(simulate(fit, nsim = 2, seed = 2))
#> [1] 5 5 3 2