# Mixed Effects Models Part 2

## Assumptions and p-values

Last week, I tackled reviwer comments and used mixed effect models for my analyses. I was right to be concerned about using a glmer with tank as a random effect without any way to assign tanks to some tissues. I reverted back to my binomial GLM. Although I obtained a p-value for my lmer analysis, I wasn’t sure if I was going about it correctly. After some Googling, I found a tutorial from Bodo Winter at UC Merced for linear mixed effect models! It has very clear instructions for constructing mixed effects models with `lme4`

and for using likelihood ratio tests for p-values.

### Likelihood Ratio Tests

In this R script, I modified my code to use likelihood ratio tests instead of an ANOVA workaround. To do this, I needed to build a null model without the fixed effect of interest (either Parental.Treatment or Female.Treatment), and a full model with the effect of interest. I then used an ANOVA to compare both models and get a p-value. A significant p-value means that the effect is part of the most parsimonious model.

When I examined all treatments, I found that parental treatment affected D-hinge counts (Chi-squared = 9.1878, df = 3, p = 0.0269). D-hinge counts were -0.15795 ± 0.10468 lower for low pH female-ambient male and -0.15795 ± 0.10509 lower for low pH female-low pH male. While I have a significant p-value for this model, there is still evidence of a maternal effect. I investigated this further with my second lme using Female.Treatment instead of Parental.Treatment. Female treatment affected D-hinge counts (Chi-squared = 8.1781, df = 1, p = 0.00424). D-hinge counts were -0.21090 ± 0.07033 lower for families with low pH females.

### Assumptions

I needed to check the following assumptions for these models:

- Normality of residuals
- Linearity (because
*linear*mixed effect models) - Homoskedasticity

To check residual normality, I used `qqnorm`

and `qqline`

. Visual inspection did not reveal any obvious violations of the normality assumption, since the data fell on a straight line. I plotted residuals vs. fitted values to check for linearity and homoskedasticity. There was no heteroskedasticity in my residual plots, but I did see striped patterns.

**Figure 1**. Residual plot for Female.Treatment model.

I’m not sure what this means, and neither Google nor my QSCI 483 notes were of any help. This guide suggests that such a pattern in my residual plot is acceptable, but this Bodo Winter tutorial does not. I might bring it up at lab meeting or ask Tim or Julian for some help. My gut feeling is that there’s some caveat to residual analysis with mixed effects models that I’m missing.

=