small_test: Check Sample Size Adequacy for Chi-Squared Test
Description
This function determines if a contingency table meets the expected frequency assumptions for a valid chi-squared test. It categorizes the data into "not_small", "small", or "very_small" based on sample size and expected frequencies.
Usage
small_test(data, var, group)
Value
A character string with one of three values:
"not_small": Sample size more than or euqal to 40 and all expected frequencies more than or euqal to 5
"small": Sample size more than or euqal to 40, all expected frequencies more than or euqal to 1 and at least one <5, only for 2*2 contingency tables
"very_small": Other conditions, including sample size <40 or any expected frequency <1
Arguments
data
A data frame containing the variables to be tested.
var
A character string specifying the factor variable in data to test.
group
A character string specifying the grouping variable in data.