| align_coefs | R Documentation |
Extracts and aligns the fixed-effect estimates from a list of fitted model objects,
returning them in a single tidy data frame with consistent columns for easy comparison.
Works with a mix of model types such as lm, glm, gls, lmer, etc.
For models without p-values (e.g., lmer), the function computes approximate
Wald statistics and two-sided normal p-values.
align_coefs(models)
models |
A named list of fitted model objects. Each element should be a
model that can be passed to |
A tibble with columns:
The name of the model (from the list).
The term name (coefficient).
The estimated coefficient.
The standard error.
The Wald statistic (estimate / std.error).
Two-sided normal p-value.
# Example using the built-in CO2 dataset
data(CO2)
# Fit models
lm_fit <- lm(uptake ~ conc + Type + Treatment, data = CO2)
glm_fit <- glm(uptake ~ conc + Type + Treatment, family = Gamma(identity), data = CO2)
# Combine estimates
models_list <- list(lm = lm_fit, glm = glm_fit)
result <- align_coefs(models_list)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.