Computes bootstrap standard errors and percentile confidence intervals for
a fast AME fit produced by ame_als or
lame_als. Two strategies are available:
parametric(default) Simulates fresh outcomes from the fitted model on the response scale and refits. Available for both cross-sectional and longitudinal fits.
blockResamples time slices with replacement. With
block_length = 1slices are resampled independently;block_length > 1draws contiguous blocks (a moving-block bootstrap), which preserves short-run temporal dependence. Longitudinal fits only, and only when the panel supplies at leastceiling(T / block_length) >= 10resampling blocks: below that the ends of the interval are the extreme replicates (a plain percentile interval covered the dyadic coefficient in 0.83 of the panels at five blocks), so the call says so and usesparametricinstead. The returned object records the scheme actually used intypeand the one asked for inrequested_type. The interval end points are read at expanded percentile levels, and the parameters that vary over actors and not over time keep the analytic standard errors of the fit; see Block bootstrap below.
Every replicate is refit by ame_als_refit, warm-started
from the original point estimate so that replicates do not drift to
different local optima. Every replicate is refit with the empirical-Bayes
estimator of the fit (see ame_als), re-estimating the
covariance of the actor effects from the fitted one; the replicate effects
are drawn in the fitted coordinates (uncentred for ame_als(),
centred for lame_als()) and every refit is summarised as the fit
reports it. The intervals then describe the empirical-Bayes estimator, and
agree with the Laplace standard errors of vcov.ame_als where
those are calibrated. A dynamic fit (lame(..., method = "als") with
dynamic_ab, dynamic_beta or dynamic_uv) carries its own
standard errors in vcov(), confint() and summary()
(Laplace ones for a binary or Poisson fit, the exact Gaussian marginal ones
for a normal fit) and has no bootstrap: bootstrap = N on such a fit
leaves it with them and a message, and ame_als_bootstrap() refuses it
with an error of class "lame_dynamic_eb_unsupported" before the
replicate count is checked. A fit saved by an earlier release with a
fast-route estimator setting that this release no longer has stops with an
error of class "lame_als_removed_setting"; refit the model first.
Standard errors are replicate column standard deviations; confidence
intervals use the percentile method.
Replicates. At least 10 valid replicates are needed
(R below 10 is an error of class
"lame_als_bootstrap_replicates"; bootstrap = N in
ame_als and lame_als needs 30, and a 95 percent
percentile interval is best read from 200 or more). A replicate whose refit has
not converged is retried on the same data with four times the budget and,
failing that, dropped: it never enters an interval. A replicate that errors
or returns non-finite values is dropped too, and every dropped replicate is counted
(n_failed, with the reason in fail_reason). A dropped replicate
is usually an extreme one, so the nominal level of a percentile interval can
move by at most the share dropped; more than 5 percent of the R
replicates dropped is an error of class
"lame_als_bootstrap_convergence", raised at the replicate that crosses
the cap, with no interval from the rest. Through bootstrap = N in
ame_als, lame_als, ame and
lame a bootstrap that stops with an error leaves the fit with its
analytic standard errors and a message of class
"lame_als_bootstrap_not_run".
One optimum per replicate. Every replicate is refit from the
variational state of the fit. A normal-family replicate whose warm refit
does not converge is also refit from a cold spectral start and, with a
multiplicative term, from seven random starts, and the converged refit with
the lowest objective is kept. The start each replicate kept is in
boot_refit_start, and optimum_check says what was compared.
The point estimate of every
coefficient should lie inside the central 95 percent of its own replicates:
if it does not, the replicates are distributed around another optimum, or
the estimator is biased by more than two standard errors, and the
coefficient takes the analytic standard error and Wald interval of the fit
instead, named in coef_uncentred with the estimate and the replicate
range. A variance component whose estimate lies outside its replicate
interval is the bias of its estimator in a regime a percentile interval
cannot describe (the variance of the lognormal layer of a count network
without extra-Poisson noise is the usual case): it takes the analytic
standard error and interval of the fit, it is named in vc_uncentred,
and the rest of the bootstrap stands.
Block bootstrap. A statistic that varies over \(B\) resampling
blocks has a percentile interval that falls short of its level. The end
points of a block interval are therefore read at the expanded percentile levels
\(\Phi(\sqrt{B / (B - 1)}\, t_{B - 1, \alpha / 2})\)
(Hesterberg, 2015): 0.9 and 99.1 percent for a 95 percent interval at ten
blocks, 1.6 and 98.4 percent at twenty. n_blocks records \(B\), and
confint(), tidy() and the interval columns of print()
and summary() use these levels. The number of replicates matters
more here than for a parametric bootstrap, since the end points sit in the
tails of the replicates: use 200 or more.
A block resample redraws the time slices and holds the actors fixed, so it
carries the variability of the data over time and none of the variability
over actors. The parameters whose sampling variability is that over actors
have no replicate standard error under type = "block": they take the
analytic standard errors and intervals of the fit, are named in
withheld and se_source with the reason, and print() and
summary() say so. type = "parametric" gives replicate ones. They are
the node-covariate coefficients, va, vb and cab,
the intercept when the model has node covariates
(it refers to the uncentred covariates, so it carries their coefficients)
and the additive effects and factors, which are shrunk toward their prior
mean: the
replicates vary around the shrunk estimates, not around the effects. The
residual variance ve has none either: a refit to a resample, which
repeats some slices and omits others, absorbs more of the noise than the
original fit, so its replicates sit below the estimate. The intercept is
the mean of the linear predictor over the observed actors (the additive
effects sum to zero), and its interval is for that quantity and not for a
population intercept.
On simulated directed normal panels (20 actors, 12 to 20 periods, 160
panels, 200 replicates; a time-varying dyadic covariate, static node
covariates, random actor effects and reciprocal errors) the block intervals
covered the dyadic coefficient in 0.96 to 1.00 of the panels and rho
in 0.93 to 0.98, and the intercept in 0.03 to 0.13, the node-covariate
coefficients in 0.05 to 0.10, va, vb and cab in 0.02
to 0.18 and the additive effects in 0.27 to 0.39, which is why those take the
analytic errors of the fit; ve covered 0.91 to 0.95 and has no
interval. The variances va and vb are biased upward by an
amount that does not scale with them, and their replicates reproduce the
bias (a percentile interval covered 0.65 to 0.75 of the panels), so their
parametric intervals are the basic (bias-corrected) interval (0.91 to 0.97
at 20 and 30 actors).
Usage
ame_als_bootstrap(
object,
R = 200,
type = c("parametric", "block"),
block_length = 1,
seed = NULL,
verbose = TRUE,
max_iter = 200L,
tol = 1e-06
)Arguments
- object
- R
integer number of bootstrap replicates (default 200); at least 10. A block bootstrap reads the ends of its interval from the tails of the replicates, so use 200 or more.
- type
"parametric"(default) or"block"; see Description.- block_length
block length for the block bootstrap:
1(default) resamples time slices independently; an integer> 1draws contiguous blocks of that many slices (a moving-block bootstrap), appropriate when the series has short-run temporal dependence. Capped atT; ignored for the parametric bootstrap.- seed
optional integer random seed.
- verbose
logical; print progress (default
TRUE).- max_iter
positive integer iteration budget for each refit (default 200). A replicate that does not converge is retried on the same data with four times this budget. A normal-family refit that still fails also tries a fresh spectral start and, with a multiplicative term, seven starts from the fixed internal seed 6886, keeping the converged refit with the lowest objective. A replicate that still has not converged is dropped, and more than 5 percent dropped is an error.
- tol
positive convergence tolerance for each refit (default
1e-6).
Value
An object of class "boot_ame" with components including
coefs (replicate intercept + regression coefficients), se,
ci_lo, ci_hi, point_est, param_names;
vc_* for the variance components; a_coefs, b_coefs,
se_a, se_b; U_aligned, V_aligned,
U_raw, V_raw, se_U, se_V (when R > 0
and the factors are static; the analytic ones of the fit for the columns
whose singular values are not separated), sv_separation (the singular values of the point
estimate, the gaps and their z-scores in bootstrap standard deviations, the
threshold, and which columns are resolved) and subspace (the
principal angles, in degrees, of the replicate factor spaces to the point
estimate's, and their largest angle by side);
n_valid, n_total, n_failed, fail_reason
(per replicate: "", "nonconverged",
"error" or "nonfinite"), max_fail_share,
boot_refit_start (the start each replicate kept),
optimum_check, n_other_start (replicates that kept a start
other than the warm one), coef_uncentred and vc_uncentred
(the coefficients and variance components whose replicates are not
centred on the estimate, when there are any), withheld (a data
frame of the parameters the scheme gives no replicate standard error, their
kind — "coefficient" or "vc" or "effects" —
and the reason; NULL when the replicates cover every
parameter), se_source (the parameters whose standard error and
interval are the analytic ones of the fit, with the reason; NULL
when there are none), analytic (those analytic errors), n_blocks (the number of resampling blocks of a block
bootstrap, NA otherwise), type, family.
Details
Choice of inference. Every fit already carries Laplace standard
errors (vcov.ame_als). The bootstrap, which mirrors
sir::boot_sir(), gives the replicate distribution of the estimator
instead; its intervals agree with the Laplace ones where those are
calibrated.
Alignment-sensitive quantities. The regression coefficients
beta, the additive effects a, b and the variance
components are rotation-invariant and are aggregated directly. The
multiplicative factors U, V are not: each replicate is
Procrustes-aligned to the original fit before its standard errors are
computed. The object stores both the raw and aligned replicate factors so
the effect of alignment can be inspected. The alignment identifies a column
only when its singular value is separated from its neighbours': two adjacent
singular values (eigenvalues, for a symmetric model) count as separated when
their gap in the point estimate is at least 5 bootstrap standard deviations of
that gap (sv_separation$threshold; the rotation the alignment applies to
the pair is then under 4 degrees at the median and under 10 at the 90th
percentile, against 9 and 25 when the two are equal). The U and V
columns that are not separated from a neighbour take the analytic posterior
standard deviations of the fit (fit$U_sd, fit$V_sd) for the
column-wise standard errors (se_U, se_V, and their unaligned
_raw versions) and Wald intervals in confint(). What is
reported for every fit with a multiplicative term, separated or not, is the
uncertainty of the subspaces the factors span, which a rotation of the columns
does not change: the principal angles, in degrees, between each replicate's
row-factor (and column-factor) space and the point estimate's
(subspace). For a symmetric model the eigenvalues L of the
multiplicative term are aggregated and reported as well.
The parametric bootstrap is a full parametric bootstrap of the AME
model: each replicate draws fresh additive random effects a, b
from their fitted dispersion (va, vb, cab) and fresh
residuals, holding mu, beta and the multiplicative term fixed.
Regenerating the additive effects (rather than holding the fitted a,
b fixed) is what gives the intercept and node-covariate standard
errors their actor-level sampling-variability component.
Assumptions. The block bootstrap treats the time slices as
exchangeable replicates of the static-effects model — appropriate for that
model, but not for strongly trended or serially dependent series (use the
dynamic lame there). The block bootstrap needs at least ten
resampling blocks, so parametric (the default) is
substituted, with a warning, on a panel that supplies fewer than ten
blocks. The MCMC
ame / lame path gives posterior summaries when
that is the target.
References
Minhas, S. and Hoff, P. D. (2025). Decomposing Network Dynamics: Social
Influence Regression. Political Analysis. The block and parametric
bootstrap follow the inference scheme of sir::boot_sir() developed
for the SIR estimator.
Hesterberg, T. C. (2015). What teachers should know about the bootstrap: resampling in the undergraduate statistics curriculum. The American Statistician 69(4), 371–386.
See also
ame_als and lame_als, both of
which accept bootstrap = N, bootstrap_type,
bootstrap_block_length, bootstrap_seed to do this
work in a single call when you are about to fit the model
anyway. ame_als_bootstrap() is the post-hoc path
(bootstrap an already-fit object without refitting from
scratch). ame_als_refit for warm-start refits;
confint.boot_ame for the bootstrap CI extractor.
Examples
# \donttest{
# twelve periods supply the ten resampling blocks the block scheme needs
Y <- replicate(12, { m <- matrix(rnorm(225), 15, 15); diag(m) <- NA; m },
simplify = FALSE)
fit <- lame_als(Y, R = 1, family = "normal", verbose = FALSE)
# post-hoc bootstrap of an existing fit:
bt <- ame_als_bootstrap(fit, R = 50, type = "block",
seed = 1, verbose = FALSE)
# equivalent one-shot call:
# fit_b <- lame_als(Y, R = 1, family = "normal", verbose = FALSE,
# bootstrap = 50, bootstrap_type = "block",
# bootstrap_seed = 1)
print(bt)
#>
#> Bootstrap results: fast AME estimator
#> Type: block | Family: normal | Replicates: 50/50 valid
#>
#> Estimate Boot SE 2.5% 97.5%
#> intercept -0.0021 0.0216 -0.0425 0.0458
#>
#> beta, a, b and variance components aggregate directly; U/V are
#> Procrustes-aligned.
#> Block resample of 12 blocks: the interval ends are the 1.1% and 98.9% quantiles
#> of the replicates.
#> Analytic standard errors and intervals for va, cab, vb, where the bootstrap
#> gives none: slice resampling holds the actors fixed, and the sampling
#> variability of the variances of the actor effects is that over actors.
#> Analytic standard errors and intervals for a, b, U, V, where the bootstrap
#> gives none: the effects of this estimator are shrunk toward their prior mean,
#> and the replicates of a resample vary around the shrunk estimates, not around
#> the effects.
#> Analytic standard errors and intervals for ve, where the bootstrap gives none:
#> the refit to resampled slices, which repeat some and omit others, absorbs more
#> of the noise than the original fit, so the replicate residual variances sit
#> below the estimate.
#> `type = "parametric"` gives intervals for them.
# }