list_fixed_effects: List Fixed Effects from a merMod Object

View source: R/list_fixed.R

list_fixed_effectsR Documentation

List Fixed Effects from a merMod Object

Description

This function lists the fixed effects coefficients from an 'lmerMod'/'merMod' object, providing the index and name of each coefficient. This can help users construct contrast vectors ('k_list') for use with the 'mixedbiastest' function.

Usage

list_fixed_effects(model)

Arguments

model

An object of class 'merMod' fitted using 'lmer' from the 'lme4' package.

Value

A data frame with two columns:

Index

The index of each fixed effect coefficient.

Coefficient

The name of each fixed effect coefficient.

Acknowledgments

Development of this package was assisted by GPT o1-preview, which helped in constructing the structure of much of the code and the roxygen documentation. The code is based on the R code provided by Karl and Zimmerman (2020).

Examples

if (requireNamespace("plm", quietly = TRUE) && requireNamespace("lme4", quietly = TRUE)) {
  library(lme4)
  data("Gasoline", package = "plm")
  # Fit a random effects model using lme4
  mixed_model <- lmer(lgaspcar ~ lincomep + lrpmg + lcarpcap + (1 | country),
                      data = Gasoline, REML = FALSE)

  # List fixed effects
  fixed_effects <- list_fixed_effects(mixed_model)
  print(fixed_effects)
}


mixedbiastest documentation built on Aug. 19, 2025, 1:15 a.m.