Skip to contents

Linear model with random effects. Calls lme4::lmer() from lme4.

Formula

Although most mlr3 learners don't allow to specify the formula manually, and automatically set it by valling task$formula(), this learner allows to set the formula because it's core functionality depends it. This means that it might not always use all features that are available in the task. Be aware, that this can sometimes lead to unexpected error messages, because mlr3 checks the compatibility between the learner and the task on all available features.

Dictionary

This Learner can be instantiated via lrn():

lrn("regr.lmer")

Meta Information

  • Task type: “regr”

  • Predict Types: “response”

  • Feature Types: “logical”, “integer”, “numeric”, “factor”

  • Required Packages: mlr3, lme4

Parameters

IdTypeDefaultLevelsRange
formulauntyped--
REMLlogicalTRUETRUE, FALSE-
startuntypedNULL-
verboseinteger0\([0, \infty)\)
offsetuntypedNULL-
contrastsuntypedNULL-
optimizercharacternloptwrapNelder_Mead, bobyqa, nlminbwrap, nloptwrap-
restart_edgelogicalFALSETRUE, FALSE-
boundary.tolnumeric1e-05\([0, \infty)\)
calc.derivslogicalTRUETRUE, FALSE-
check.nobs.vs.rankZcharacterignoreignore, warning, message, stop-
check.nobs.vs.nlevcharacterstopignore, warning, message, stop-
check.nlev.gtreq.5characterignoreignore, warning, message, stop-
check.nlev.gtr.1characterstopignore, warning, message, stop-
check.nobs.vs.nREcharacterstopignore, warning, message, stop-
check.rankXcharactermessage+drop.colsmessage+drop.cols, silent.drop.cols, warn+drop.cols, stop.deficient, ignore-
check.scaleXcharacterwarningwarning, stop, silent.rescale, message+rescale, warn+rescale, ignore-
check.formula.LHScharacterstopignore, warning, message, stop-
check.conv.graduntyped"lme4::.makeCC(\"warning\", tol = 2e-3, relTol = NULL)"-
check.conv.singularuntyped"lme4::.makeCC(action = \"message\", tol = formals(lme4::isSingular)$tol)"-
check.conv.hessuntyped"lme4::.makeCC(action = \"warning\", tol = 1e-6)"-
optCtrluntypedlist()-
newparamsuntypedNULL-
re.formuntypedNULL-
random.onlylogicalFALSETRUE, FALSE-
allow.new.levelslogicalFALSETRUE, FALSE-
na.actionuntyped"stats::na.pass"-

References

Bates, M D (2010). “lme4: Mixed-effects modeling with R.”

See also

Author

s-kganz

Super classes

mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrLmer

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerRegrLmer$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner and set parameter values
learner = lrn("regr.lmer", formula = cmedv ~ (1 | town))

# Define a Task
task = tsk("boston_housing")

learner$train(task)
print(learner$model)
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: cmedv ~ (1 | town)
#>    Data: data
#> REML criterion at convergence: 3341.364
#> Random effects:
#>  Groups   Name        Std.Dev.
#>  town     (Intercept) 7.657   
#>  Residual             5.403   
#> Number of obs: 506, groups:  town, 92
#> Fixed Effects:
#> (Intercept)  
#>       24.92