# GLM - Interpret residuals vs fitted plot

I realised a within-subject experiment and each participants went through three conditions and in each condition they performed a series of tasks of their choice (number of tasks is different for each participant, they have 8 minutes to do the tasks they want). Every time, I measure the time it takes them to perform each task within those 8 minutes.

I would like to build generalized mixed effect model to study the effect of random effects such as the tasks chosen. I only have one fixed effect which is the condition.

So I have the independent variable as condition and the dependent variable time.

After performing a Shapiro-Wilk test and looking at the histogram of my data, I see that it's not normally distributed and looks like a Poisson distribution.

Before I build a glmm to look at the random effects (tasks chosen, gender...etc), I decided to make a glm to see how it would look like just with condition as the fixed effect.

glm(Time ~ Condition, data = my_data, family = poisson(link = "log"))

I get this strange plot when I plot my glm model in R, I would be super grateful if anyone could give me a potential explanation of what it means. I was hoping to get scattered points all over the graph...

I haven't used lm or glm before, so I am trying to figure things out as I progress in the analysis. If you have any suggestion to improve my approach, please let me know !

What this plot is saying is that you only have two predicted values from your model.

One way that this could happen is that you only have one independent variable and it has only two levels. So, for instance, if you are trying to model weight based on sex, this sort of thing could happen.

It is also showing that the residuals are much bigger than the predicted values (your predicted values are all around 10 or 11, while the absolute value of your residuals is much bigger).

Looks like you don't have a very good model of whatever it is you are trying to model.

If you want more details, you would need to tell us a lot more. My blog post how to ask a statistics question may help you write such a question.

• Hi, Peter ! Thank you very much for your answer, I understand things a bit better. I have looked at your blog post and improved my question. Could you please have a look ? I would be really grateful !
– t32
Feb 11, 2020 at 14:12
• There is nothing strange about the plot. It is what you would expect when you have a single IV (condition, in your case) that has two levels. Feb 11, 2020 at 15:06
• Thank you, just to clarify: A good model in my case, it would have the residuals closer to the dashed line ?
– t32
Feb 11, 2020 at 17:06
• That would mean there was less variation within condition, which is a good thing. Feb 11, 2020 at 18:09