Pages

Friday, June 24, 2011

Test for normality: Shapiro Wilk test

In order to test the normality of the distribution pattern of a variable, we can use the Shapiro Wilk test. The null hypothesis is that: There is no difference in the distribution of the given data and a normal distribution curve (or in other words the data is normally distributed).
So if the P value is less than 0.05, means that the null hypothesis is rejected or in other words, there is a difference in the distribution of the given data and a normal distribution curve or the given data is not normally distributed.

For this type of data which is not normally distributed, it is time to go for a non parametric test.

Note: Shapiro Wilk can be used to test the normality of residuals in a linear regression model. In R using the epicalc package, it can be done as: shapiro.test(lm(age ~ case.factor)$residuals). In this example, age is the numerical variable and case.factor is the categorical variable as cases and controls and lm stands for linear model.


0 comments:

Post a Comment