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?


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 at 10:58
  • $\begingroup$ Yes, if you cannot find a suitable transformation, I would move to the options I mentioned. $\endgroup$ – Florian Hartig Jan 21 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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