buildmer {buildmer}R 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

...

Additional options to be passed to lmer, glmer, or gamm4. (They will also be passed to (g)lm in so far as they're applicable, so you can use arguments like subset=... and expect things to work. The single exception is the control argument, which is assumed to be meant only for lme4 and not for (g)lm, and will not be passed on to (g)lm). For backward-compatibility reasons, will also accept buildmer control parameters, although those specified in buildmerControl will take precedence.

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

[Package buildmer version 1.9 Index]