Tests for independence between a pair of categorical variables.
Technical details
Description
It tests to see if knowledge of the value of an observation in one categorical variable can be used to predict the likely values of the other variable.
When no weights are used, the standard Pearson Chi-Square Test of Independence[1] is used.
When weights are used, we use the Second Order Rao-Scott Test of Independence [2] instead of the standard Chi squared test. In this test, the Chi-Square statistic is computed using the weighted counts and then adjusts it using a multiplier that measures the weighted design effect. This weighted design effect involves computing the ratio of the variability with design weights against the variability with simple random sampling. This adjusted statistic uses the F-distribution to compute p-values to account for the extra variability in using the adjustment. It is also named the second order adjustment since the adjusted statistic has the first two moments matched against the asymptotic Chi-Square distribution.
Inputs
Two Nominal or Ordinal variables. Any non-categorical variables that are supplied will be treated as categorical, that is to say, cases with the same value are treated as being in the same category, and date variables are categorized by period.
- Variable 1 Sample to analyze.
- Variable 2 Second sample to compare to Variable 1.
- Variable names Display Variable Names in the output, instead of Variable Labels.
- More decimal places Display numeric values with 8 decimal places.
Output
An output shown below:
Additional Properties
When using this feature you can obtain additional information that is stored by inspecting it using custom R code in an item below:
#change YourReferenceName to the reference name (under Properties > General) of your analysis
item = YourReferenceName
str(item)
References
- Pearson, Karl (1900). "On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling". Philosophical Magazine. Series 5. 50 (302): 157–175. doi:10.1080/14786440009463897.
- ↑ Rao, J. N. K. and A. J. Scott (1984). 'On Chi-Squared Tests for Multiway Contingency Tables with Cell Proportions Estimated from Survey Data.' The Annals of Statistics, 12, 1, 46-60. doi: https://doi.org/10.1214/aos/1176346391
Method
- In Displayr: How to do a Chi-Square Test of Independence
- In Q: Create > Test > Chi-Square Test of Independence