csf: Generate output for a Chi Square Test for Goodness of Fit

View source: R/csf.R

csfR Documentation

Generate output for a Chi Square Test for Goodness of Fit

Description

This function performs a Chi Sqare test for Goodness of Fit on one factor and returns reporting information on the model.

Usage

csf(x, y = NULL, probs = NULL)

Arguments

x

A formula ~Categorical Variable .

y

A data frame, necessary if data frame is not referenced in formula or piped in.

probs

A vector to test goodness of fit, must have same number of categories and add to 1 if percentages

Value

A list of output for reporting $analysis_type, $results, $fit_model, $observed, $expected, $standardized_residuals, $contribution, $table_percentages

Examples

x2_results <- x2_data %>% csf(~class_rank)
x2_results <- x2_data %>% csf(~class_rank,probs = c(500,147,24,39,111))
x2_results <- x2_data %>% csf(~class_rank,probs = c(.61, .18, .03, .05, .13))
x2_results <- csf(x2_data$class_rank)
x2_results <- csf(x2_data$class_rank,probs = c(500,147,24,39,111))

ECO230/eco230r documentation built on Feb. 26, 2025, 2:45 p.m.