# Residuals vs Fitted does not meet linear regression assumptions

I am having trouble moving forward with my Data analysis. I found a similar question (Residual vs Fitted) but (unless I am overthinking it) it does not apply to my issue since my data is not discrete data.

In short: I have 5 tags (each with 36 replicates), each of which were placed out in the field in 3 separate plots for a month and assessed at one week, two week and 4 week timepoints:

Ex Data:

        Tag# Plot#  Mortality Timepoint

1    1       5         1

2    1       0         1

3    1       98        1

1    2      100        2

2    2       20        2

1    1       80        3

2    1        0        3


The Model I ran was :

model5 = lmer(Mortality ~ Tag + (1|Plot) + (1|Timepoint), data=Dataset)

This was the best model after comparing a couple others, with less random effects and no random effects, AIC values. My dependent variable is Mortality with Tag as my main independent variable.

This is the residual vs fit graph I get:

And the QQ Plot:

From my understanding the Resid vs Fitted violates the assumptions of linear regression. From there I do now know what to do. I tried a couple transformations but they did not help. Does anyone have any suggestions for what model would be best to run?

• What is the reason you do the linear regression? Commented Jun 11, 2020 at 1:44
• Its the model I was recommended to run by a colleague but from my observations here it does not fit. I would not know which other model to run. I want to find if there is or isnt a correlation between tag and Mortality. From my understanding regression analysis is what I should do and the way the experiment is set up it makes sense to include plot and timepoint as a random effect. But Linear regression does not seem to be the right choice. Open to any help/suggestions
– Nico
Commented Jun 11, 2020 at 1:48
• What assumptions do you feel are violated?
– Dave
Commented Jun 11, 2020 at 2:34
• From my understanding the points in the residual vs fit plot should be randomly distributed around the 0 line showing constant variance. Not a pattern such as the diagonal trends pictured.
– Nico
Commented Jun 11, 2020 at 2:39

You are correct that your residuals plot suggests you are violating the heteroskedasticity and normality assumptions. The first one is really the worst here. The residuals are more than correlated. They are basically linear.

I would like to point out that while you have coded tag and plot as numerical values, they are actually categorical variables or factors. The timepoints variable is sequential, but discrete and only has 4 values. You could model this as a continuous variable, but an ordered factor would probably be better.

Set up this way, you have a classic ANOVA or linear regression. I don't think you need a mixed model.

I would try the following and then re-running your model.

new_data =
my_data %>%
mutate(
Tag = factor(Tag, levels=1:5),
Plot = factor(Plot, levels=1:3),
Weeks = factor(Timepoint, levels=1:4, ordered=T)
)

• To make sure I am following you correctly. Do you mean to re-run my model with your suggestion using the model with random effects or a standard linear regression? I did both and when comparing AIC values it is still lower when using Plot and Timepoint as a random effect but plotting results in the same Residual vs fit graph shown above
– Nico
Commented Jun 11, 2020 at 3:59
• Since plot was something I chose, and the conditions that can relate to mortality may vary between plots I thought it should be included as a random effect. UNless I am thinking about that the wrong way.
– Nico
Commented Jun 11, 2020 at 4:14
• @Nico -- I'll be honest with you--I've haven't studied mixed models yet. And it might be a more sophisticated method. However, if the trend is the same within each plot (in terms of response), then by including plot as a covariate, you take this into account. That is the whole point of including covariates--to control for their independent effects. As far as using Timepoint as a random effect, I would think you were looking for a trend there, as in mortality vs time. So a random effect seems odd. Have you done any other EDA? Pair plot? Facetted boxplots? Etc. Commented Jun 11, 2020 at 15:06
• Another thing I thought of is that perhaps mortality is if Mortality should be treated as a count variable in Poisson regression? Commented Jun 11, 2020 at 15:46