View source: R/multilevel_helpers.R
lmer_table | R Documentation |
Stacks coefficients and SEs, extracts various lmer-specific model fit statistics and confidence intervals for random effects (refits models if necessary), outputs a nicely formatted table using stargazer and shows it directly in Rstudio Viewer.
lmer_table(
models,
fit.stats = c("fit", "random"),
mod.names = "",
show.viewer = TRUE,
silent = TRUE,
digits = 2,
...
)
models |
List of the fitted lmer objects |
fit.stats |
What fit statistics to compute/extract and show? Possible options are "ICC", "random", "R2s", "fit", "LRT", "REML", "VIF". See "Details". |
mod.names |
Vector of the same length as models list, giving names to each model. |
show.viewer |
Logical. Whether the resulting table should be shown in the RStudio viewer. If FALSE then the file "good_table_output.html" is saved to working directory. |
... |
Arguments passed to stargazer. |
The list of possible fit.stats options:
Shows deviance (-2*logLikelihood), AIC, BIC, number of parameters, number of groups, number of observations, if the model converged
Computes intra-class correlation by fitting an empty model and computing a ratio of first-level and intercept variances.
Computes R-square by fitting an empoty model and computing a ratio of residuals in an empty model and in the current model.
Computes Likelihood ratio test; all the models should be fitted to the same sample and be in order of nestedness, otherwise the test fails.
Adds variances of all the random effects.
Adds variances of all the random effects and implements bootstrapping (lme4::confint.merMod
) in order to get confidence intervals and this p.values for variances of random effects.
Shows if REML was used to fit the model.
Issues to implement:
Might be veeery slow (something to work on)
data("sleepstudy", package="lme4")
m1=lmer(Reaction ~ Days + (1|Subject), sleepstudy)
m2=lmer(Reaction ~ Days + (1+Days|Subject), sleepstudy)
good_table(list(m1, m2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.