Skip to contents

calculate_pvc() is the former name of calculate_pcv: the statistic is the PCV (proportional change in variance), but the historical function name transposed the acronym. calculate_pvc() now forwards to calculate_pcv() with a deprecation warning and will be removed in a future release.

Usage

calculate_pvc(
  model1,
  model2,
  bootstrap = FALSE,
  n_boot = 1000,
  conf_level = 0.95,
  estimation = c("fitted", "ML")
)

Arguments

model1

A maihda_model object from fit_maihda(). This is the reference model (typically a simpler or baseline model).

model2

A maihda_model object from fit_maihda(). This is the comparison model (typically a more complex model with additional predictors).

bootstrap

Logical indicating whether to compute bootstrap confidence intervals for the PCV. Default is FALSE. lme4 engine only: the parametric bootstrap relies on lme4's simulate()/refit(), so for the brms, wemix, and ordinal engines the PCV is reported as a point estimate and bootstrap = TRUE is an error (see Details).

n_boot

Number of bootstrap samples if bootstrap = TRUE. Default is 1000. A value below about 200 warns that the interval's tail endpoints are unstable (the hard minimum is 10).

conf_level

Confidence level for bootstrap intervals. Default is 0.95.

estimation

Variance-estimation basis for the cross-model comparison, one of "fitted" (default) or "ML". "fitted" differences each model's own between-stratum variance (the REML estimate for a Gaussian lmer fit); "ML" refits any REML lmer fit with maximum likelihood first, for a correction-free comparison. The choice affects Gaussian lmer fits only – glmer and the wemix/ordinal engines are already maximum-likelihood, and a brms fit is a Bayesian posterior (not ML), so "ML" is a no-op for all of them; a brms comparison is reported on the as-fitted posterior basis rather than as an ML-refit. See Details for the finite-sample tradeoff. Whenever model2 (the adjusted model) sits on the singularity boundary – under any estimation basis – the PCV is pinned near 1; this is recorded as adjusted_at_boundary = TRUE and noted by print(). It is not treated as an error or warned about: a singular fit is indistinguishable from genuinely additive strata (a common, legitimate result).

Value

See calculate_pcv.