rlmer_ransac: rlmer with RANSAC initial estimator

View source: R/ransac.R

rlmer_ransacR Documentation

rlmer with RANSAC initial estimator

Description

Fit rlmer with a RANSAC-derived initial estimator.

Usage

rlmer_ransac(
  formula,
  data,
  K = 200L,
  sub_frac = 0.5,
  n_starts = 1L,
  phony_threshold = 0.99,
  seed = NULL,
  max_tries = 5L,
  ...
)

Arguments

formula, data

passed to rlmer.

K, sub_frac, seed

passed to ransac_lme4.

n_starts

number of distinct RANSAC starts for the multi-start consensus (default 1 = single best start, the previous behaviour).

phony_threshold

a fit is treated as phony (non-interior) when its maximum |\hat\rho| exceeds this (default 0.99).

max_tries

maximum number of RANSAC re-seeds when a redescending rho.e zero-weights the refinement into a rank-deficient positive-weight design (Koller and Stahel 2017, Remark 2). The fit is re-drawn and re-fitted from a fresh nonsingular start until its positive-weight fixed-effects design is full rank, up to max_tries (default 5); if all attempts still collapse the last fit is returned with a warning. With a fixed seed, attempt t uses seed + t - 1, so the first attempt is reproducible and the retries are deterministic.

...

other arguments to rlmer (e.g. rho.e, rho.b, method).

Details

Convenience wrapper that calls ransac_lme4 to obtain a starting value and then passes it to rlmer's init argument.

With n_starts > 1 it runs a multi-start consensus: rlmer is fitted from each of the n_starts best distinct RANSAC candidate starts, and the returned fit is the lowest-residual-scale one whose random-effects covariance is interior (|\hat\rho| \le phony_threshold). This samples several basins of a redescending \psi and so recovers the interior solution when the single best start happens to fall into the phony |\hat\rho| \to 1 attractor. If every start lands phony, the best-scoring fit is returned with a warning. The per-start summary is attached as attr(fit, "consensus").

The nonsingular subsample guarantees a full-rank fixed-effects design at the start only; a redescending \psi can zero-weight observations during the refinement and collapse the positive-weight design to rank-deficiency (Koller and Stahel 2017, Remark 2). After the fit converges its e-side robustness weights are inspected and a warning is issued if the design restricted to the positively-weighted observations is rank-deficient, suggesting a positive-weight \psi (e.g. rho.e = smoothPsi) or a different start.

Value

rlmerMod object.

Examples

  
  fit <- rlmer_ransac(Reaction ~ Days + (Days | Subject),
                       data = sleepstudy, K = 30)
  

robustlmm documentation built on July 30, 2026, 5:11 p.m.