pb2_modcomp.RdCompare two nested models using parametric bootstrap simulation of the likelihood ratio statistic. Supports models fitted via lm, lme4 (lmer/glmer), nlme (lme/gls), etc.
pb2_modcomp(
fit1,
fit0,
nsim = 1000,
sequential = FALSE,
h = 20,
engine = "serial",
nworkers = 2,
verbose = FALSE
)The larger (alternative) model.
The smaller (null) model.
Number of simulations. In fixed bootstrap: total number of simulations. In sequential bootstrap: maximum number of simulations allowed.
Logical; if TRUE, use sequential bootstrap sampling to reach target number of extreme hits.
Number of extreme hits to target in sequential sampling.
Parallelisation engine: "serial", "parallel", or "future".
Number of workers for parallel/future engine.
Logical; if TRUE, print progress messages.
An object of class PBmodcomp, with print(),
summary(), and plot() methods.
The models should both be fitted by maximum likelihood (not REML). If REML was used, the function will automatically refit with REML = FALSE where possible.
Best Practice: Always fit your models with the data=
argument. This ensures all covariates used in the model
formula are stored with the model object, enabling reliable
simulation and refitting for bootstrap analysis, including on
parallel workers. Without data=, refitting may fail in
parallel contexts and reproducibility is compromised.