R: ANOVA with upper- and lower-bound _p_-values and R-sqaured...
pamer.fnc
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, at the moment, this function cannot be used with generalized linear mixed-effects models (glmers).
Usage
pamer.fnc(model, ndigits = 4)
Arguments
model
A mer object (fitted by function lmer). Note that, at the moment, this function cannot be used with generalized linear mixed-effects models (glmers).
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 dfnrow(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 dfnrow(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.