build.formula {buildmer}R Documentation

Convert a buildmer term list into a proper model formula

Description

Convert a buildmer term list into a proper model formula

Usage

build.formula(dep, terms, env = parent.frame())

Arguments

dep

The dependent variable.

terms

The term list.

env

The environment of the formula to return.

Value

A formula.

Examples

library(buildmer)
form1 <- Reaction ~ Days + (Days|Subject)
terms <- tabulate.formula(form1)
form2 <- build.formula(dep='Reaction',terms)

# check that the two formulas give the same results
library(lme4)
check <- function (f) resid(lmer(f,sleepstudy))
all.equal(check(form1),check(form2))

# can also do double bars now
form1 <- Reaction ~ Days + (Days||Subject)
terms <- tabulate.formula(form1)
form2 <- build.formula(dep='Reaction',terms)
all.equal(check(form1),check(form2))

[Package buildmer version 2.11 Index]