getFixLevel: Identify the fixed effect model structure level

getFixLevelR Documentation

Identify the fixed effect model structure level

Description

getFixLevel() uses the degrees of freedom information from lme() to identify the correct placement of each fixed effect and interaction term in a model structure diagram for hierarchical mixed effects models.

Usage

getFixLevel(lme_model, fixedCall, randomCall, obsLevelLabel)

Arguments

lme_model

A nlme lme model object inherited from model_diagram()

fixedCall

The fixedCall object from an lme model or parsed text containing fixed variable names from a merMod object

randomCall

The randomCall object from an lme model or parsed text containing the random effect structure from a merMod object

obsLevelLabel

The label that should be used for the observational level

Value

The random effect at which the fixed effect is placed at for degrees of freedom calculations.

Examples

library(nlme)
library(lme4) # For sleepstudy data
sleepstudy_lme <- lme(Reaction ~ Days, random=~Days|Subject, data=sleepstudy)
getFixLevel(sleepstudy_lme, fixedCall = sleepstudy_lme$call$fixed,
            randomCall = sleepstudy_lme$call$random,
            obsLevelLabel = "Observation Error")

modeldiagramR documentation built on April 15, 2026, 5:07 p.m.