Learn R Programming

robustlmm (version 1.4-2)

rlmer: Robust linear mixed models

Description

Robust estimation of linear mixed effects models, for hierarchical nested and non-nested, e.g., crossed, datasets.

The lmerNoFit function can be used to get trivial starting values. This is mainly used to verify the algorithms to reproduce the fit by lmer when starting from trivial initial values.

Usage

rlmer(formula, data, ..., method = "DAStau",
    rho.e = smoothPsi, rho.b = smoothPsi, rho.sigma.e,
    rho.sigma.b, rel.tol = 1e-08,
    max.iter = 40 * (r + 1)^2, verbose = 0, doFit = TRUE,
    init)

lmerNoFit(..., initTheta)

Arguments

formula
a two-sided linear formula object describing the fixed-effects part of the model, with the response on the left of a ~ operator and the terms, separated by + operators, on the right. The vertical bar character "|"
data
an optional data frame containing the variables named in formula. By default the variables are taken from the environment from which lmer is called.
...
Additional parameters passed to lmer to find the initial estimates. See lmer.
method
method to be used for estimation of theta and sigma, see Details.
rho.e
object of class psi_func, specifying the functions to use for the huberization of the residuals.
rho.b
object of class psi_func or list of such objects (see Details), specifying the functions to use for the huberization of the random effects.
rho.sigma.e
object of class psi_func, specifying the weight functions to use for the huberization of the residuals when estimating the variance components, use the psi2propII function to specify squared weig
rho.sigma.b
(optional) object of class psi_func or list of such objects, specifying the weight functions to use for the huberization of the random effects when estimating the variance components (see Details). Use psi2
rel.tol
relative tolerance used as criteria in the fitting process.
max.iter
maximum number of iterations allowed.
verbose
verbosity of output. Ranges from 0 (none) to 3 (a lot of output)
doFit
logical scalar. When doFit = FALSE the model is not fit but instead a structure with the model matrices for the random-effects terms is returned (used to speed up tests). When doFit = TRUE, the default, the model is fit i
init
optional lmerMod- or rlmerMod-object to use for starting values, a list with elements fixef, u, sigma, theta, or a function producing an lmerMod object.
initTheta
parameter to initialize theta with (optional)

Value

  • object of class rlmerMod.

Details

[object Object],[object Object],[object Object],[object Object]

See Also

lmer, vignette("rlmer")

Examples

Run this code
## dropping of VC
system.time(rlmer(Yield ~ (1|Batch), Dyestuff2, method="DASvar"))

## Default method "DAStau"
  system.time(rfm.DAStau <- rlmer(Yield ~ (1|Batch), Dyestuff))
  summary(rfm.DAStau)
  ## DASvar method (faster, less accurate)
  system.time(rfm.DASvar <- rlmer(Yield ~ (1|Batch), Dyestuff,
                                  method="DASvar"))
  ## compare the two
  compare(rfm.DAStau, rfm.DAStau)

  ## Fit variance components with higher efficiency
  ## psi2propII yields squared weights to get robust estimates
  rlmer(diameter ~ 1 + (1|plate) + (1|sample), Penicillin,
        rho.sigma.e = psi2propII(smoothPsi, k = 2.28),
        rho.sigma.b = psi2propII(smoothPsi, k = 2.28))

  ## use chgDefaults for variance components including
  ## correlation terms (regular, non squared weights suffice)
  rlmer(Reaction ~ Days + (Days|Subject), sleepstudy,
        rho.sigma.e = psi2propII(smoothPsi, k = 2.28),
        rho.sigma.b = chgDefaults(smoothPsi, k = 5.11, s=10))
rlmer(Yield ~ (1|Batch), Dyestuff, init = lmerNoFit)

Run the code above in your browser using DataLab