Skip to content
Prev 381282 / 398502 Next

Testing for normality in categorical data

Hi Nancy,
The chickwts dataset contains one sort-of continuous variable (weight)
and a categorical variable (feed). Two things that will help you to
understand what you are trying to do is to "eyeball" the "weight"
data:

# this shows you the rough distribution of chick weights
hist(chickwts$weight)
# this shows you how well the distribution of weights fits a normal distribution
qqnorm(chickwts$weight)

For the Shapiro-Wilks statistic on the distribution of all of the weights:

shapiro.test(chickwts$weight)

and if you really want to test the normality within the feed groups:

by(chickwts$weight,chickwts$feed,shapiro.test)

Now because the p-values returned are all fairly large, you can accept
the null hypothesis of normality.
As Bert has noted, it looks like you are just throwing the data into
the functions without really knowing what you are doing. Hopefully,
the above will get you started.

Jim
On Sat, Oct 5, 2019 at 11:19 PM Nancy Felix <nancyfelix25 at gmail.com> wrote: