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.
pamer.fnc(model, ndigits = 4)
A mer
object (fitted by function lmer
). Note that, at the moment, this function cannot be used with generalized linear mixed-effects models (glmer
s).
Integer indicating the number of decimal places to be used in the ANOVA table.
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.
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.
[R] lmer, p-values and all that
available at https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html.
# NOT RUN {
# see example LMERConvenienceFunctions help page.
# }
Run the code above in your browser using DataLab