I have several variables that consist of ordinal categories (i.e. no fruit consumption, 1 portion a day, 2 portions, etc.) and I would like to test whether they differ significantly with respect to a binary variable (i.e. stroke and no stroke). Can I use a chi-squared test for this or does it violate the assumptions?

Thank you.

  • 1
    $\begingroup$ I would use an ordinal logistic regression, regressing the categories on the binary variable. $\endgroup$ – Noah Jul 26 at 20:25

Other methods, such as the one suggested in @Noah's comment, may be preferable. However, to answer your question directly, you could use a chi-squared test, provided that you have enough data for the expected counts to be large enough.

Suppose your counts were as follows for 100 Stroke patients and 1000 patients with no stroke.

Fruits/day   0    1    2    3    4+ 
Stroke      33   37   22    7    1
NonStr     181  347  305  130   37

Because the expected counts are mostly above 5 and the remaining one is above 3, you could do a chi-squared test to see whether the probabilities of various amounts of fruit per day are the same for the two groups of patients. (You'd still get a significant result by combining categories 3 and 4+.) Output from R:

       Pearson's Chi-squared test

data:  DTA
X-squared = 17.307, df = 4, p-value = 0.001685

Warning message:
In chisq.test(DTA) : Chi-squared approximation 
   may be incorrect

The warning message is because of the one one expected count below 5.

Notice, however, that this test does not take into account that the Fruit variable is ordinal.

Two additional possibilities for such large numbers of subjects: Using actual counts, both a Welch two-sample t test and a two-sample Wilcoxon test give essentially 0 P-values. Strictly speaking, assumptions for neither test are met, but large sample sizes and tiny P-values show strong evidence of a difference---for my fake data.

Note: Fake data were generated in R as:

x1 = rbinom(100, 5, .2)
x2 = rbinom(1000, 5, .3)

Roughly, the model is that people have five opportunities a day to eat fruit, breakfast, lunch, dinner, and a couple of snacks. At any one opportunity, respective probabilities of doing so are $0.2$ and $0.3.$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.