Predict and simulate robust longitudinal networks
Source:R/lame_robust_methods.R
predict.lame_robust.RdPosterior means and joint draws from a lame_robust() fit. Prediction uses
the conditional mean; simulation also includes observation noise with the
persistent directed-pair precision from the same posterior iteration.
Arguments
- object
A
lame_robustfit.- h
Nonnegative integer forecast horizon. Zero returns observed periods.
- newdata
For a positive horizon with covariates, a list of one dyadic design array per future period. For one period, a matrix or array is also accepted. Actor and covariate names are aligned to the fit. All future covariates must be supplied and finite off the diagonal. Omit otherwise.
- type
Either
"response"or"link"; both denote the continuous mean.- by_draw
Logical; return joint posterior mean-network draws. Forecast draws include future latent innovations. The default posterior mean integrates those innovations analytically before averaging over draws.
- nsim
Number of posterior draws.
NULLuses every retained iteration. Simulation defaults to one. Smaller requests sample without replacement; larger requests sample with replacement. Selected indices are sorted.- seed
Optional seed preserving the caller's RNG state.
- ...
No additional arguments are supported.
Value
Prediction returns a sender-by-receiver-by-period array, or a
sender-by-receiver-by-period-by-draw array when by_draw = TRUE.
Simulation always returns the four-dimensional form. Diagonals are NA.
Draw arrays carry a draw_index attribute identifying the joint posterior
iteration. Singleton dimensions are preserved.
Details
Future intercepts, actor deviations, and factors follow their sampled AR(1)
laws. Actor innovations respect the sum-to-zero constraints. Finite
actor_df draws a new precision for each actor role and forecast period. Persistent
actor levels and pair precisions remain the same within each simulated
trajectory. Simulation at h = 0 replicates observations conditional on
the saved mean paths and persistent pair scales. Finite observation_df
draws fresh temporary residual precisions for every replicated observation,
including at h = 0; fitted observation precisions are not reused.
Simulation at a positive horizon draws both future
states and observation noise. Future latent uncertainty is included when
by_draw = TRUE; its Monte Carlo average need not equal the analytically
integrated default point forecast exactly.