pamer.fnc {LMERConvenienceFunctions} | R Documentation |
ANOVA with upper- and lower-bound p-values and R-sqaured values for LMER.
Description
Compute upper- and lower-bound p-values for the analysis of variance (or deviance) as well as the amount of deviance explained (%) for each fixed-effect of an LMER model. Note that for glmer
models, there is no deviance explained column.
Usage
pamer.fnc(model, ndigits = 4)
Arguments
model |
A |
ndigits |
Integer indicating the number of decimal places to be used in the ANOVA table. |
Details
Upper-bound p-values are computed by using as denominator df nrow(model@frame) - qr(model@X)4rank
(i.e., number of data points minus number of fixed effects including the intercept), which are anti-conservative. Lower-bound p-values are computed by using as denominator df nrow(model@frame) - qr(model@X)4rank - number of random effects
(e.g., if by-subject intercepts and slopes, and there are 10 subjects, 10 * 2 = 20
). The amount of deviance explained by each model term (i.e., eta squared) is calculated as [Sum of Squares for the effect] / [Sum of Squares total]
. More specifically: as.data.frame(anova(model))[,2] / sum((model@frame[, dv]-mean(model@frame[, dv]))^2)
where dv
is a vector of the names of the independent variables in the model.
Value
This function returns an object of class data frame
with upper- and lower-bound (anti-conservative and conservative, respectively) dfs, p-values, and deviance explained (%) for each model term. Note that for glmer
models, there is no deviance explained column.
Author(s)
Antoine Tremblay, Statistics Canada, trea26@gmail.com
References
[R] lmer, p-values and all that
available at https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html.
Examples
# see example LMERConvenienceFunctions help page.