# What hypothesis test to use for categorical variables? Possibly in R?

Edit: I think this is a better question, Say, I have categorical characteristics such as gender, race. How should I use Fisher's test and chi-square test? I was looking at this: http://math.hws.edu/javamath/ryan/ChiSquare.html

end edit.

I want to do a hypothesis testing for cancer patients.

Everyone is admitted to the hospital, a small portion went developed cancer, while the rest didn't. The dependent variable is categorical, not numerical, meaning something like severe, mild, and unknown.

How should I give a hypothesis test? Is it possible? Thanks!

Edit: The data analyst used Fisher's Exact or Chi-squared test. I don't know how I can do that, R asks the 2 test groups of equal length

-
Are you only interested in the severity of those who do have cancer, or also of the characteristics of those who develop cancer compared to those who don't? –  Peter Ellis Sep 23 '12 at 0:50

Sounds like you want ordinal logistic regression. The hypothesis would be something like:

Null: The IVS were not related to the severity of XXX Alt: The IVS were related to the severity of XXX

You can do ordinal logistic regression in R, SAS or many other programs. I wrote a presentation on ordinal logistic using SAS, but some of it will apply more generally.

But "unknown" as a category worries me. That's not ordinal, that's missing data. Or do you mean that those people didn't get cancer?

-
unknown is another category, not missing value. There are 3 categories in total, unknown is the name of one of the categories. –  user1061210 Aug 21 '12 at 20:57
Hard to see how a person can pick up logistic regression when the Chi-Square Test is posing problems. –  rolando2 Aug 21 '12 at 22:47
@rolando2 True, but perhaps the person cannot do the analysis him/her self. Sometimes the best answer is "find an expert". –  Peter Flom Aug 22 '12 at 12:09
I see -- Fair enough! –  rolando2 Aug 23 '12 at 3:24

http://ww2.coastal.edu/kingw/statistics/R-tutorials/independ.html

-
thanks, that is very helpful! –  user1061210 Aug 21 '12 at 21:19

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

The categorical responses have distributions (e.g. the percentage that answer severe, the percentage that answer mild and the percentage that answer unknown. You can do a test of the null hypothesis that the distributions are the same for both groups vs the alternative that they differ.

To the revised question I would answer that you can construct the 3x2 contingency table with no restriction on the number of counts in each cell or column or row of cells and apply the Fisher test. A good contingency table analysis program written in R should allow you to do that.

-