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 lmer or glmer, that is, an object of class merMod and subclass either lmerMod or glmerMod.

tol

A numeric value (default is 1e-4), tolerance under which to determine if the random effects make the model to be singular.

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:

Author(s)

Iago Giné-Vázquez, iago.gin-vaz@protonmail.com

See Also

formula, update

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)
}

[Package trouBBlme4SolveR version 0.1.1 Index]