Chi Square test of association to examine if there is a relationship between two categorical variables.

infer_chisq_assoc_test(data, x, y)

Arguments

data

a data.frame or tibble

x

factor; column in data

y

factor; column in data

Value

infer_chisq_assoc_test returns an object of class "infer_chisq_assoc_test". An object of class "infer_chisq_assoc_test" is a list containing the following components:

chi

chi square

chilr

likelihood ratio chi square

chimh

mantel haenszel chi square

chiy

continuity adjusted chi square

sig

p-value of chi square

siglr

p-value of likelihood ratio chi square

sigmh

p-value of mantel haenszel chi square

sigy

p-value of continuity adjusted chi square

phi

phi coefficient

cc

contingency coefficient

cv

cramer's v

ds

product of dimensions of the table of x and y

df

degrees of freedom

Deprecated Function

chisq_test() has been deprecated. Instead use infer_chisq_assoc_test().

References

Sheskin, D. J. 2007. Handbook of Parametric and Nonparametric Statistical Procedures, 4th edition. : Chapman & Hall/CRC.

See also

Examples

infer_chisq_assoc_test(hsb, female, schtyp)
#> Chi Square Statistics #> #> Statistics DF Value Prob #> ---------------------------------------------------- #> Chi-Square 1 0.0470 0.8284 #> Likelihood Ratio Chi-Square 1 0.0471 0.8282 #> Continuity Adj. Chi-Square 1 0.0005 0.9822 #> Mantel-Haenszel Chi-Square 1 0.0468 0.8287 #> Phi Coefficient 0.0153 #> Contingency Coefficient 0.0153 #> Cramer's V 0.0153 #> ----------------------------------------------------
infer_chisq_assoc_test(hsb, female, ses)
#> Chi Square Statistics #> #> Statistics DF Value Prob #> ---------------------------------------------------- #> Chi-Square 2 4.5765 0.1014 #> Likelihood Ratio Chi-Square 2 4.6789 0.0964 #> Phi Coefficient 0.1513 #> Contingency Coefficient 0.1496 #> Cramer's V 0.1513 #> ----------------------------------------------------