Chi_squared: Chi-squared Statistic for Association Between Two Variables
Description
Calculates the Chi-squared statistic from a contingency table constructed using two input vectors.
Both parameters can be a categorical (non-numeric) variable, allowing flexibility in input types.
Variable a is used as rows, and b as columns in the contingency table.
Usage
Chi_squared(a, b)
Value
The Chi-squared statistic measuring association between the variables.
Arguments
a
First array or vector. Can be numeric or a categorical factor.
b
Second array or vector. Can be numeric or a categorical factor.