ifr_chisq_gof_test: Chi Square Goodness of Fit Test

View source: R/ifr-chisq-gof-test.R

ifr_chisq_gof_testR Documentation

Chi Square Goodness of Fit Test

Description

Test whether the observed proportions for a categorical variable differ from hypothesized proportions

Usage

ifr_chisq_gof_test(data, x, y, correct = FALSE)

Arguments

data

a data.frame or tibble

x

factor; column in data

y

expected proportions

correct

logical; if TRUE continuity correction is applied

Value

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

categories

levels of x

chisquare

chi square statistic

deviation

deviation of observed from frequency

degrees_of_freedom

chi square degrees of freedom

expected_frequency

expected frequency/proportion

n_levels

number of levels of x

observed_frequency

observed frequency/proportion

pvalue

p-value

sample_size

number of observations

std_residuals

standardized residuals

varname

name of categorical variable

Deprecated Function

infer_chisq_gof_test() has been deprecated. Instead use ifr_chisq_gof_test()

References

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

See Also

chisq.test

Examples

ifr_chisq_gof_test(hsb, race, c(20, 20, 20, 140))

# apply continuity correction
ifr_chisq_gof_test(hsb, race, c(20, 20, 20, 140), correct = TRUE)


inferr documentation built on April 4, 2025, 2:08 a.m.