chi2_independent(A, B, alpha)
Computes a Chi-Square independence test using data in arrays A and B and significance level alpha. The program builds a contingency table and then applies the Chi-Square independence test.
chi2_independent(M, alpha)
Computes a Chi-Square independence test using the data in matrix M and significance level alpha. Matrix M must store a contingency table as depicted in the example below.
See also chi2_goodness chi2_yates chi2_table chi2_totable
Example
(See NOTE below)
M
0 "Abstain" "1-60" "Over 60" "Total"
"Single" 67 213 74 354
"Married" 411 633 129 1173
"Widowed" 85 51 7 143
"Divorced" 27 60 15 102
"Total" 590 957 225 1772
chi2_independent(M, .05)
Chi-Square Independence Test.
Hypothesis test for association.
Ho : The two variables are not associated
Ha : The two variables are associated
Significance level : 0.05 (5.0%)
Results:
Test statistics X2 : 94.26880078578765
Critical right value found is 12.591587243731063
P value is : 0.0
Reject the null hypothesis.
NOTE: The data used in this example was taken from the textbook Introductory Statistics 6th Ed. by Neil A. Weiss with kind permission of Addison Wesly Longman, Inc. (AWL). AWL does not endorse nor it supports the Calcugator.