diag-formula-method: Diagonalize the random-effect covariance structure, possibly...

diag,formula-methodR Documentation

Diagonalize the random-effect covariance structure, possibly assisting convergence

Description

Diagonalize the random-effect covariance structure, possibly assisting convergence

Usage

## S4 method for signature 'formula'
diag(x)

Arguments

x

A model formula.

Value

The formula with all random-effect correlations forced to zero, per Pinheiro & Bates (2000)

Examples

# 1. Create explicit columns for factor variables
library(buildmer)
vowels <- cbind(vowels,model.matrix(~vowel,vowels))
# 2. Create formula with diagonal covariance structure
form <- diag(f1 ~ (vowel1+vowel2+vowel3+vowel4)*timepoint*following + 
	     ((vowel1+vowel2+vowel3+vowel4)*timepoint*following | participant) +
	     (timepoint | word))
# 3. Convert formula to buildmer terms list, grouping terms starting with 'vowel'
terms <- tabulate.formula(form,group='vowel[^:]')
# 4. Directly pass the terms object to buildmer, using the 'dep' argument to specify the
# dependent variable
model <- buildmer(terms,data=vowels,buildmerControl=list(dep='f1'))

buildmer documentation built on Oct. 25, 2023, 9:08 a.m.