| fstruction {trouBBlme4SolveR} | R Documentation |
Formula removal of singular random effects
Description
Removes those random effects from a model formula making the model to be singular.
Usage
fstruction(model, tol = 1e-4)
Arguments
model |
The model of interest, output of either
|
tol |
A numeric value (default is |
Value
A list with a string component dstring which is the formula as
character updated (to be used by update) after removing the
singular random effects and, when no all the random effects are
removed two other string components:
betchar: a character vector with the random effect terms removed from the formula.inchar: a character vector having the same length asbetcharwith the corresponding groups (aggregate levels) for which the random effects are removed.
Author(s)
Iago Giné-Vázquez, iago.gin-vaz@protonmail.com
See Also
Examples
if(requireNamespace("nlme")){
library(lme4)
data(Orthodont, package = "nlme")
Orthodont$nsex <- as.numeric(Orthodont$Sex == "Male")
Orthodont$nsexage <- with(Orthodont, nsex*age)
## The next model is singular
fmo <- lmer(distance ~ age + (age|Subject) + (0+nsex|Subject) +
(0 + nsexage|Subject), data = Orthodont)
summary(fmo)
## Let's see the formula updated (as a string)
fstruction(fmo)
}