chisq {twoxtwo} | R Documentation |
Pearson's chi-squared test
Description
This function conducts a Pearson's chi-squared test for a twoxtwo
constructed using the specified exposure and outcome. Internally the function uses chisq.test. The output of the function includes the chi-squared test statistic, degrees of freedom, and the p-value from the test.
Usage
chisq(.data, exposure, outcome, correct = TRUE, ...)
Arguments
.data |
Either a data frame with observation-level exposure and outcome data or a twoxtwo object |
exposure |
Name of exposure variable; ignored if input to |
outcome |
Name of outcome variable; ignored if input to |
correct |
Logical as to whether or not to apply continuity correction; default is |
... |
Additional arguments passed to twoxtwo function; ignored if input to |
Value
A tibble
with the following columns:
-
test: Name of the test conducted
-
estimate: Point estimate from the test (
NA
forchisq()
) -
ci_lower: The lower bound of the confidence interval for the estimate (
NA
forchisq()
) -
ci_upper: The upper bound of the confidence interval for the estimate (
NA
forchisq()
) -
statistic: Test statistic from the test
-
df: Degrees of freedom parameter for the test statistic
-
pvalue: P-value from the test
-
exposure: Name of the exposure variable followed by +/- levels (e.g. smoking::yes/no)
-
outcome: Name of the outcome variable followed by +/- levels (e.g. heart_disease::yes/no)