# pamer.fnc: ANOVA with upper- and lower-bound _p_-values and R-sqaured... In LMERConvenienceFunctions: Model Selection and Post-Hoc Analysis for (G)LMER Models

## 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

 `1` ```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 (`glmer`s). `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.

## References

`[R] lmer, p-values and all that` available at https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html.

## Examples

 `1` ```# see example LMERConvenienceFunctions help page. ```

### Example output

```Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE