Skip to contents

For each selected dynamic coefficient, compares the largest absolute first difference divided by its fitted innovation standard deviation \(\sigma_\beta \sqrt{\Lambda_{jj}}\) with a simulated reference. Each reference path has the same number of periods as the fitted path, starts from the first state of the matched posterior draw, and follows that draw's persistence and innovation scale: it is the largest jump a path that begins where the fitted path begins makes by chance. The design-based innovation scale and the averaging of symmetric node coefficients are retained. This is a posterior-conditioned transition reference, not an unconditional prior predictive check or a marginal-likelihood Bayes factor.

Usage

detect_change_point(
  fit,
  coefs = NULL,
  n_prior_sims = 2000L,
  threshold_bf = 10,
  seed = NULL
)

Arguments

fit

A fitted lame object with dynamic_beta.

coefs

Optional character vector of coefficient names to check. Defaults to every dynamic coefficient on the fit.

n_prior_sims

Number of simulations for the transition reference. Default 2000.

threshold_bf

Cutoff for the "warn" column. Default 10, the the threshold at which the measured false-positive rate is below 5 percent for smooth and for in-model paths (see Measured properties).

seed

Optional seed for reproducibility.

Value

A data frame with one row per dynamic coefficient: coef, bf (the heuristic tail-ratio score), m_post_mean (posterior mean of \(M\)), m_prior_q95 (95\ \(M\)), t_hat (period of the largest scaled jump), warn (logical, bf > threshold_bf).

Details

The bf column is the tail ratio \(\Pr(M^{post} > m^*) / 0.05\), where \(m^*\) is the reference's 95th percentile. Its range is zero to twenty, in steps of 20 over the number of stored draws. Values above threshold_bf flag unusually abrupt posterior paths for inspection; they do not establish a change point. The reference supports "ar1" and "rw1" on equally spaced periods. RW2, Matern, irregular periods and actor-specific coefficient laws are refused rather than assigned an AR(1) reference. Saved named training designs, the dynamic mask, and aligned transition draws are required.

Measured properties

The table gives the percentage of simulated panels with bf > threshold_bf at the default threshold, from 200 fits of each path type and panel shape. Every panel has one standard-normal dyadic covariate whose coefficient follows the named path, is fitted with dynamic_beta = "dyad" (dynamic_beta_kind = "rw1" for random-walk paths, "ar1" otherwise) and keeps 40 stored draws (12 for the binary panels, which have 50 actors; the others have 15). The outcome is normal, binary or Poisson. Smooth paths are a constant, a linear ramp and two stationary AR(1) paths (persistence 0.7, innovation standard deviation 0.15 and 0.4); in-model paths are random walks and AR(1) paths drawn from the prior of the fit; a step is a jump of 0.6 or 1.2 (from 0.2 to 0.8 or to 1.4) at the middle of the panel. Normal outcomes have residual standard deviation 0.4; binary outcomes are probit with intercept -0.3; Poisson outcomes have log-rate offset -0.5 and no AR(1) paths drawn from the prior. Worst path type is the highest rate among the smooth and in-model path types of the row.

Toutcomesmoothin-modelworst path typestep 0.6step 1.2
4binary1.22.55.02.520.5
5normal1.23.24.04.020.0
5Poisson0.80.03.02.520.5
8normal1.11.83.056.085.0
12normal1.93.05.5100.0100.0

Pooled over panel shapes, smooth paths were flagged in 1.2 percent of the fits and in-model paths in 2.3 percent. At a threshold of 9 the pooled in-model rate is 5.0 percent, with no margin, and at 10 it is 2.3 percent, so 10 is the default. The tail ratio judges a jump against the innovation scale the fit estimates from the same path, so a panel of four or five periods rarely shows a single jump as unusual (about a fifth of the panels with a step of 1.2 are flagged), while panels of eight or more periods flag it in most cases.

Examples

# \donttest{
data(YX_bin_list)
# chains = 1 keeps the example short; the default runs two chains and compares them
fit <- lame(lapply(YX_bin_list$Y, function(y) 1 * (y > 0)), YX_bin_list$X, family = "binary", R = 0,
            dynamic_beta = "dyad",
            nscan = 60, burn = 15, odens = 5, verbose = FALSE, chains = 1)
detect_change_point(fit)
#>      coef bf m_post_mean m_prior_q95 t_hat  warn
#> 1 X1_dyad  0   0.7023245    2.471425     2 FALSE
#> 2 X2_dyad  0   0.7410171    2.372276     4 FALSE
#> 3 X3_dyad  0   1.2213628    2.541697     2 FALSE
# }