Test whether a single categorical variable follows a hypothesized population distribution.

os_chisqgof(x, y, correct = FALSE, conf.int = 0.95)

Arguments

x
categorical variable
y
expected proportion/frequencies
correct
logical; if TRUE continuity correction is applied
conf.int
confidence level

Value

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

Examples

os_chisqgof(hsb$female, c(100, 100))
#> Test Statistics #> ----------------------- #> Chi-Square 1.62 #> DF 1 #> Pr > Chi Sq 0.2031 #> Sample Size 200 #> #> Variable: female #> -----------------------------------------------------------------
#> Error in fg("Category", lw): could not find function "%>%"
os_chisqgof(hsb$race, c(50, 50, 50, 50))
#> Test Statistics #> ----------------------- #> Chi-Square 242.44 #> DF 3 #> Pr > Chi Sq 0 #> Sample Size 200 #> #> Variable: race #> -----------------------------------------------------------------
#> Error in fg("Category", lw): could not find function "%>%"
# continuity correction os_chisqgof(hsb$female, c(100, 100), correct = TRUE)
#> Test Statistics #> ----------------------- #> Chi-Square 1.445 #> DF 1 #> Pr > Chi Sq 0.2293 #> Sample Size 200 #> #> Variable: female #> -----------------------------------------------------------------
#> Error in fg("Category", lw): could not find function "%>%"