Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

diag-formula-method

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

Stepwise Elimination and Term Reordering for Mixed-Effects Regression

v1.9
FreeBSD
Authors
Cesko C. Voeten [aut, cre] (<https://orcid.org/0000-0003-4687-9973>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.