Learn R Programming

mixedbiastest (version 1.0.2)

list_fixed_effects: 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)

Value

A data frame with two columns:

Index

The index of each fixed effect coefficient.

Coefficient

The name of each fixed effect coefficient.

Arguments

model

An object that inherits from class merMod, such as an lmerMod or glmerMod object fitted using lmer or glmer from the lme4 package.

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

Run this code
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)
}

Run the code above in your browser using DataLab