chisq_test | R Documentation |
A tidier version of chisq.test() for goodness of fit tests and tests of independence.
chisq_test(x, formula, response = NULL, explanatory = NULL, ...)
x |
A data frame that can be coerced into a tibble. |
formula |
A formula with the response variable on the left and the
explanatory on the right. Alternatively, a |
response |
The variable name in |
explanatory |
The variable name in |
... |
Additional arguments for chisq.test(). |
Other wrapper functions:
chisq_stat()
,
observe()
,
prop_test()
,
t_stat()
,
t_test()
# chi-squared test of independence for college completion
# status depending on one's self-identified income class
chisq_test(gss, college ~ finrela)
# chi-squared goodness of fit test on whether self-identified
# income class follows a uniform distribution
chisq_test(gss,
response = finrela,
p = c("far below average" = 1/6,
"below average" = 1/6,
"average" = 1/6,
"above average" = 1/6,
"far above average" = 1/6,
"DK" = 1/6))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.