fstruction | R Documentation |
Removes those random effects from a model formula making the model to be singular.
fstruction(model, tol = 1e-4)
model |
The model of interest, output of either
|
tol |
A numeric value (default is |
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 as
betchar
with the corresponding groups (aggregate levels) for
which the random effects are removed.
Iago Giné-Vázquez, iago.gin-vaz@protonmail.com
formula
, update
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.