# NOT RUN {
library(parameters)
if (require("glmmTMB", quietly = TRUE)) {
model <- glmmTMB(
count ~ spp + mined + (1 | site),
ziformula = ~mined,
family = poisson(),
data = Salamanders
)
mp <- model_parameters(model)
print(mp, pretty_names = FALSE)
print(mp, split_components = FALSE)
print(mp, select = c("Parameter", "Coefficient", "SE"))
print(mp, select = "minimal")
}
# group parameters ------
data(iris)
model <- lm(
Sepal.Width ~ Sepal.Length + Species + Petal.Length,
data = iris
)
# don't select "Intercept" parameter
mp <- model_parameters(model, parameters = "^(?!\\(Intercept)")
groups <- list(
"Focal Predictors" = c("Speciesversicolor", "Speciesvirginica"),
"Controls" = c("Sepal.Length", "Petal.Length")
)
print(mp, groups = groups)
# or use row indices
print(mp, groups = list(
"Focal Predictors" = c(1, 4),
"Controls" = c(2, 3)
))
# only show coefficients, CI and p,
# put non-matched parameters to the end
data(mtcars)
mtcars$cyl <- as.factor(mtcars$cyl)
mtcars$gear <- as.factor(mtcars$gear)
model <- lm(mpg ~ hp + gear * vs + cyl + drat, data = mtcars)
# don't select "Intercept" parameter
mp <- model_parameters(model, parameters = "^(?!\\(Intercept)")
print(mp, groups = list(
"Engine" = c("cyl6", "cyl8", "vs", "hp"),
"Interactions" = c("gear4:vs", "gear5:vs")
))
# }
Run the code above in your browser using DataLab