Skip to contents

Generalized linear model with random effects. Calls lme4::glmer() from lme4.

Initial parameter values

  • family - Is set to stats::binomial(link = "logit").

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("classif.glmer")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

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

  • Required Packages: mlr3, lme4

Parameters

IdTypeDefaultLevelsRange
formulauntyped--
startuntypedNULL-
verboseinteger0\([0, \infty)\)
offsetuntypedNULL-
contrastsuntypedNULL-
optimizercharacter-Nelder_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-
familyuntyped"stats::binomial(link = \"logit\")"-
nAGQinteger1\([0, \infty)\)
mustartuntyped--
etastartuntyped--
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()-
tolPwrssuntyped--
compDevlogicalTRUETRUE, FALSE-
nAGQ0initSteplogicalTRUETRUE, FALSE-
check.response.not.constuntyped"stop"-
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

sebffischer

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifGlmer

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

LearnerClassifGlmer$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


# Define the Learner and set parameter values
learner = lrn("classif.glmer",
  formula = credit_risk ~ (1 | credit_history) + job + property + telephone + savings)

# Define a Task
task = tsk("german_credit")
task$select(c("credit_history", "job", "property", "telephone", "savings"))

# Train the learner
learner$train(task)

print(learner$model)
#> $model
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: credit_risk ~ (1 | credit_history) + job + property + telephone +  
#>     savings
#>    Data: data
#>       AIC       BIC    logLik  deviance  df.resid 
#> 1143.8155 1207.6163 -558.9077 1117.8155       987 
#> Random effects:
#>  Groups         Name        Std.Dev.
#>  credit_history (Intercept) 0.687   
#> Number of obs: 1000, groups:  credit_history, 5
#> Fixed Effects:
#>                                         (Intercept)  
#>                                            -0.49718  
#>                             jobunskilled - resident  
#>                                            -0.19139  
#>                        jobskilled employee/official  
#>                                            -0.13544  
#>        jobmanager/self-empl/highly qualif. employee  
#>                                            -0.02365  
#>                                propertycar or other  
#>                                             0.56577  
#> propertybuilding soc. savings agr. / life insurance  
#>                                             0.50720  
#>                                 propertyreal estate  
#>                                             1.11104  
#>                  telephoneyes (under customer name)  
#>                                            -0.26805  
#>                                 savings... < 100 DM  
#>                                            -0.33521  
#>                          savings100 <= ... < 500 DM  
#>                                            -1.08991  
#>                         savings500 <= ... < 1000 DM  
#>                                            -1.24679  
#>                               savings... >= 1000 DM  
#>                                            -1.04639  
#> 
#> $target_levels
#> [1] "good" "bad" 
#>