chisq.comb | R Documentation |
This function combines categories for a chi-square goodness of fit test.
chisq.comb(chisq.test, combine)
chisq.test |
The output of a chi-square goodness of fit test by functions |
combine |
A vector with the numbers of the categories to combine. |
This function only cobines categories on the extremes. It is recommended to combine categories when the expected counts are too low. As a rule of thumb, the chi-square approximation for the test statistic can be unreliable if some categories have expected counts smaller than 5 or if there is any with an expected count smaller than 1.
It returns a table with the contribution to the chi-square statistic for each category, the chi-square statistic, the degrees of freedom, and the p-value.
Raúl Eyzaguirre.
x <- 0:6
f <- c(334, 369, 191, 63, 22, 12, 9)
output <- chisq.bin(x, f, n = 10)
# Combine categories 5, 6, and 7
chisq.comb(output, combine = c(5, 6, 7))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.