| ransac_lme4 | R Documentation |
RANSAC-style random subsample initial estimator for linear mixed-effects models.
ransac_lme4(
formula,
data,
K = 200L,
sub_frac = 0.5,
scale_fn = robustbase::Qn,
seed = NULL,
verbose = FALSE
)
formula |
model formula in |
data |
full data frame. |
K |
number of random subsamples (default 200). |
sub_frac |
fraction of the data per subsample (default 0.5). |
scale_fn |
function from a numeric residual vector to a
scalar scale. Default |
seed |
optional RNG seed for reproducibility. |
verbose |
logical; print progress every 50 subsamples. |
For K random subsamples of the data, fit a classical
lmer on each subsample, score by a robust
scale of residuals computed on the full data, and return
the lmer fit minimising that score.
The motivation is that for redescending psi-functions
(e.g. bisquarePsi) the rlmer
optimiser benefits from a starting value close to the true
parameters. A bad initial estimate can produce phony local
minima (e.g. random-effects correlation pinned at +/- 1; see
Koller and Stahel 2022, Section 4.4). RANSAC is a classical
way of generating a high-breakdown-point initial estimate by
subsampling.
list with fit (best lmerMod), scale
(its score), subset (its row indices), scales
(vector of all K scores), K, n_sub.
set.seed(1)
res <- ransac_lme4(Reaction ~ Days + (Days | Subject),
data = sleepstudy, K = 30)
res$scale
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.