Chi-Square Goodness-of-Fit using R


Test whether the observed proportions (the composition of drv variable) from our sample significantly differ from these hypothesized proportions (50% front-wheel drive car, 10% rear-wheel drive car and 40% four-wheel drive car).

> chisq.test(table(mpg$drv), p = c(.4, .5, .1))
Chi-squared test for given probabilities

data: table(mpg$drv)
X-squared = 2.0876, df = 2, p-value = 0.3521



See Also:

Do the same test in SAS

Leave a Reply

Your email address will not be published. Required fields are marked *