# Statistical analysis - Shapiro-Wilk test?

I apologize if this question will seem odd, but I am quite new to statistical analysis. I performed coinfection experiments with a total of 12 conditions, and I have 3 measurements per condition. I did a Shapiro-Wilk test to check for normality: the values of some conditions are normally distributed, while others are not. I know that in case of normal distribution I can perform a one-way ANOVA test, while if my data is not normally distributed I have to do a Kruskal-Wallis test. However, I am not sure how to proceed since my data are "both" normally and non-normally distributed. How do I proceed from this point? (I attached the results from the normality test) Thank you to anyone who will answer, I appreciate the help very much.

Kind regards, Elena

• It is the residuals from the ANOVA model that need to be normally distributed, not the original data for each level of the factor. // Doing Shapiro-Wilk tests on a dozen samples of size three, it would not be surprising to get one P-value below 0.05. May 10, 2022 at 15:50

Using today's date as seed for a simulation, I happened to get one sample (of size three) out of 12 that "failed" the Shapiro-Wilk normality test at the 5% level (specifically, the 7th).

set.seed(510)
pv = replicate(12, shapiro.test(rnorm(3))\$p.val)
pv
 0.11687631 0.61252325 0.88430727 0.85727925 0.18020280 0.70942521
 0.04484017 0.50968817 0.51974599 0.35479127 0.91914364 0.53469289


Using these same 36 observations to make a fictitious dataset for a one-way ANOVA (in this case with no effects), we have the following:

set.seed(510)
x = rnorm(3 * 12)
g = as.factor(rep(1:12, each=3))
anova(lm(x~g))

Analysis of Variance Table

Response: x
Df Sum Sq Mean Sq F value Pr(>F)
g         11  9.878 0.89798  0.6026 0.8082
Residuals 24 35.766 1.49025


The 36 residuals can be obtained, displayed, and tested for normality as follows:

r = resid(lm(x~g))
stripchart(r, pch="|") shapiro.test(r)

Shapiro-Wilk normality test

data:  r
W = 0.97451, p-value = 0.5606


Moreover, a normal quantile-quantile plot of the residuals is nearly linear, consistent with normality.

qqnorm(r);  qqline(r, col="blue", lwd=2) For this particular example, we have one level of the factor that fails the Shapiro-Wilk normality test, while the test on all $$36$$ residuals shows no departure from normality.

I'm not saying that an ANOVA is OK for your data; only saying that you have not yet correctly assessed normality of your data for doing a one-factor ANOVA.