0
$\begingroup$

I am trying to run a ANOVA with the model

LOS = HR + RESP + TEMP + SpO2

All 5 variables are discrete numerical values(all integers).

Initially, I got a Shapiro Wilks of p-value < 2.2e-16 with no transformation. The Q-Q plot shows that there is an obvious need for a transformation. enter image description here

Using a log transformation I still did not achieve normality(p-value = 1.193e-12). Althought the Q-Q plots look much better enter image description here

After this I am trying to a Box-Cox transformation to the initial LOS(response variable) and got a Shapiro - Wilk(p-value = 6.792e-10

m.full <- lm(LOS ~ NEWS, data2)
bc.full <- boxcox(m.full); bc.full.opt <- bc.full$x[which.max(bc.full$y)]
data2$LOS.bc <- bcPower(data2$LOS, bc.full.opt)
print(qplot(data=data2, x=NEWS, y=LOS.bc, geom="boxplot"))


m.bc_full.null <- lm(LOS.bc ~ 1, data=data2)
m.bc_full.full <- lm(LOS.bc ~ NEWS, data=data2)
print(anova(m.bc_full.null, m.bc_full.full))

enter image description here

Am I implementing the Box-Cox transformation incorrectly or is there anything I could be doing better?

$\endgroup$
  • 1
    $\begingroup$ Well, several comments. First, the data are not real numbers but integers, so a normal distribution is not a reasonable assumption. Second, nonparametric methods do not care what the data distribution is, so I would start there. $\endgroup$ – Carl Apr 18 at 4:46
0
$\begingroup$

The comment by Carl is right, you should consider a generalized linear model with a different distribution instead of forcing the data to be normal and sticking with ANOVA. Poisson regression is normally good for integer outcomes.

If you're wondering why the test is still significant despite the QQ plot looking pretty good, then chances are because your sample is large so you have an excess of power. Even tiny deviations from 'perfect' normality and the Wilks-Shapiro test will be significant. The Box Cox transformation will get your data roughly normal but it won't be perfect, as you can see in QQ plot so the Wilks Shapiro test will still pick up the deviation from normality.

But be careful with the Box Cox transform. You're stuck interpreting in terms of exponent units. i.e. instead of one unit increase in x leads to y increase in y, it's x^lambda which can often be a really inconvenient fractional power. It can change your outcome too--again, because it's in totally different units now. Finding the right distribution is a much better idea. Check out the Poisson or Negative Binomial distributions.

$\endgroup$

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.