Skip to contents

Builds a start_vals list for ame or lame from the estimates of an ALS fit. This is useful when the ALS fit has already found a good latent-space solution and the MCMC chain should start near that solution rather than from diffuse random values.

Usage

als_start_vals(fit, jitter = 0, seed = NULL)

Arguments

fit

a fitted ame_als, lame_als, or dynamic ALS object returned by lame with method = "als".

jitter

non-negative standard deviation for independent Gaussian perturbations added to numeric starting values. Use a small positive value for multiple MCMC chains.

seed

optional integer seed used for the jitter.

Value

A list that can be passed to start_vals. For a dynamic ALS fit it also carries rho_uv, sigma_uv, rho_ab, and sigma_ab, so the MCMC run starts its AR(1) hyperparameters at the values the fast route's search ended with (fit$eb$uv_dynamics, fit$eb$ab_dynamics), whatever their estimated flag: values under the lame() hyperprior, estimates only where the data carry enough signal to determine them, which the sampler then estimates. The dyadic rho start is the single pooled correlation in fit$VC["rho"], matching ALS simulation. Period-specific rho_path / residual_rho_path values are residual diagnostics, including in legacy objects labelled dynamic_rho = TRUE, and are not used as covariance-path starting values. A MCMC model requesting dynamic_rho = TRUE expands this scalar initial value; explicit MCMC path starts remain available through its start_vals argument. For a binary fit the intercept is shifted so that the implied tie rate, mean(pnorm(EZ)), equals the observed one, with everything else held at the ALS values; the shift is stored in attr(, "level_shift"). The ALS intercept sits within a few hundredths of the level the sampler has to reach.

Examples

set.seed(1)
n <- 12
Y <- matrix(rnorm(n * n), n, n); diag(Y) <- NA
fit_als <- ame_als(Y, R = 1, family = "normal", verbose = FALSE)
sv <- als_start_vals(fit_als)
# chains = 1 keeps the example short; the default runs two chains and compares them
fit_mcmc <- ame(Y, R = 1, start_vals = sv,
                nscan = 20, burn = 5, odens = 1, verbose = FALSE, chains = 1)