buildmer: Use 'buildmer' to fit mixed-effects models using...

buildmerR Documentation

Use buildmer to fit mixed-effects models using lmer/glmer from lme4

Description

Use buildmer to fit mixed-effects models using lmer/glmer from lme4

Usage

buildmer(
  formula,
  data = NULL,
  family = gaussian(),
  buildmerControl = buildmerControl()
)

Arguments

formula

See the general documentation under buildmer-package

data

See the general documentation under buildmer-package

family

See the general documentation under buildmer-package

buildmerControl

Control arguments for buildmer — see the general documentation under buildmerControl

Examples

library(buildmer)
model <- buildmer(Reaction ~ Days + (Days|Subject),lme4::sleepstudy)

# Tests from github issue #2, that also show the use of the 'direction' and 'crit' parameters:
bm.test <- buildmer(cbind(incidence,size - incidence) ~ period + (1 | herd),
	family=binomial,data=lme4::cbpp)
bm.test <- buildmer(cbind(incidence,size - incidence) ~ period + (1 | herd),
	family=binomial,data=lme4::cbpp,buildmerControl=buildmerControl(direction='forward'))
bm.test <- buildmer(cbind(incidence,size - incidence) ~ period + (1 | herd),
	family=binomial,data=lme4::cbpp,buildmerControl=buildmerControl(crit='AIC'))
bm.test <- buildmer(cbind(incidence,size - incidence) ~ period + (1 | herd),
	family=binomial,data=lme4::cbpp,
	buildmerControl=buildmerControl(direction='forward',crit='AIC'))

# Example showing use of the 'include' parameter to force a particular term into the model
m1 <- buildmer(Reaction ~ Days,data=lme4::sleepstudy,buildmerControl=list(include=~(1|Subject)))
# the below are equivalent
m2 <- buildmer(Reaction ~ Days,data=lme4::sleepstudy,buildmerControl=list(include='(1|Subject)'))
m3 <- buildmer(Reaction ~ Days + (1|Subject),data=lme4::sleepstudy,buildmerControl=list(
	include=~(1|Subject)))
m4 <- buildmer(Reaction ~ Days + (1|Subject),data=lme4::sleepstudy,buildmerControl=list(
	include='(1|Subject)'))

cvoeten/buildmer documentation built on March 3, 2023, 3:25 p.m.