stats newbie here so please make replies easy to understand! With the type of data I generate, my colleagues use Mann-Whitneys to generate p values.


I did a stats course recently and we were told there was no longer any excuse to do: • ANOVA, routinely transforming data to make residuals normal • non-parametric stats (M-W, K-W, runs, etc) to cope with complex parametric structures

and instead we had to use GLMs.

I have data where my independent variable is a categorical/discrete variable and my dependent variable is continuous variable (non-integer)

I have tried to do a linear model but my data is non normal, and my residuals vs fitted in R looks like this: enter image description here

I have tried transforming the data using lny 1/y sqrt(y) and it doesn't help at all.

From my stats course the next step would be to try a generalised linear model, The only GLMS I know are poisson and negative-binomial but my data aren't integers. Any suggestions on what I can do?

  • $\begingroup$ 1. Your plot is not residuals vs fitted. That's a scale-location plot. 2. Please describe your response variable in more detail. Its not even clear whether your response is ordered. 3. The use of the phrase 'no longer' in your course seems odd in relation to the use/availability of glms. Software for fitting GLMs has been around for more than 45 years, whereas that phrase seems to suggest they're fairly recent. $\endgroup$
    – Glen_b
    Aug 14, 2021 at 2:22

1 Answer 1


First of all, while the advice you received in your course reflects the general sentiment of the stats community, there is nothing wrong with a transformation, and due to simplicity, I would prefer this solution to a GLM in your case. So, before you move to complicated GLM / GLS solutions, try e.g. if https://www.rdocumentation.org/packages/forecast/versions/8.13/topics/BoxCox produces a model with acceptable residuals.

If this is not the case, you can move to either GLM (changing distributions) or GLS (modelling variance), or both.

From eye-balling your data, it seems as if you have a strictly positive response. In this case, you could try a Gamma GLM, and possibly add a variance term (e.g. in glmmTMB) if you still have variance problems (for checking the latter, you can use e.g. https://cran.r-project.org/web/packages/DHARMa/index.html).

Alternatively, to avoid the entire distributional problem, you could just run a quantile regression, e.g. https://cran.r-project.org/web/packages/qgam/index.html

  • $\begingroup$ Hi thank you so much this is so helpful. I did a Box Cox transformation, using boxcox() in r and plotting it to see my optimal value for lambda. I then did the lm based on the boxcox transformation but my residuals vs fitted looks pretty much exactly the same as the one in the original post. So should I move onto lm now? $\endgroup$
    – anro3
    Jan 21, 2021 at 10:58
  • $\begingroup$ Yes, if you cannot find a suitable transformation, I would move to the options I mentioned. $\endgroup$ Jan 21, 2021 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.