# Box-Cox transformation in multiway ANOVA

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. Using a log transformation I still did not achieve normality(p-value = 1.193e-12). Althought the Q-Q plots look much better 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)) Am I implementing the Box-Cox transformation incorrectly or is there anything I could be doing better?

• 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.
– Carl
Apr 18, 2019 at 4:46