# What differentiates the wilcoxon test from t test regarding ordinal variables?

I'm wondering what the wilcoxon test differentiates from the t test so it can be used with ordinal variables. In other words why can't we use a t test for ordinal variables but can we use a wilcoxon test? I know the difference between the t test and the wilcoxon test is already answered(e.g. here), however the difference in the type of variable required for input (e.g ordinal or interval) were not discussed.
I came across this while looking at this flowchart, to choice which test is when the "best" choice: • why can't we use a t test for ordinal variables We can't. t-test is for "scale" (= metrical = interval+ratio) data - where numbers are values. Ordinal data isn't scale and when presented as numbers (such as 1-2-3...) those are just arbitrary codes, not values. So, to use t-test for such data you have to re-decide what type is the data and claim they are scale. Ordinal data are categorical. They can be converted to "scale" by means of some quantification (= scaling). The re-decision I've mentioned is the simplest form of it. – ttnphns Jan 9 '17 at 21:26
• Btw I'd say I'm not 100% in agreement with @whubers answer which is too empiricistic: both tests apply to any type of data that can be meaningfully represented by (real) numbers. "Represented" could be measures or could be codes - quite different things. – ttnphns Jan 9 '17 at 21:31
• Since ordinal data has rankings associated with it I can see using the wilcoxon test. I think applying the t test while possible is very problematic. Although not part of the question I think that if we were dealing with numerical data that is continuous the Wilcoxon loses information in the data by ranking while the t does not. If the data is known to be approximately normal the t test would be better. Dr. Huber covers himself by detailing conditions where one method should be preferred over the other. – Michael R. Chernick Jan 9 '17 at 21:57

The short answer is that you can always use either test in place of the other--but typically they will produce different results. That demonstrates the issue is not one of applicability, but suitability. The rest of this answer discusses what "suitability" might amount to.

S. S. Stevens' original (but often misunderstood) classification of measurements into four types--nominal, ordinal, interval, and ratio--was based on the groups of transformations admitted by each type.

• Student t-tests are invariant under affine transformations (rescaling and recentering), and therefore are appropriate for data whose meaning is not changed by affine transformations. Consequently the result of a t-test does not depend on the units of measurement used (nor it origin or "zero" value) to record the data, but it usually will change if the data are transformed in any nonlinear way.

• The Wilcoxon tests are invariant under arbitrary monotonic transformations (which is a far larger transformation group): such transformations merely need to respect the order of the data (larger remain larger, smaller remain smaller). Therefore the result of a Wilcoxon test does not depend on the numeric codes used to designate ordinal data (provided those codes respect the ordering, of course).

The implications are important.

First, both tests apply to any type of data that can be meaningfully represented by (real) numbers. You always have the choice of which test to use. That choice needs to depend on what the test aims to accomplish, on what it might cost you to make errors, and on the statistical characteristics of the data. Therefore, a flowchart like the one shown in the question cannot be correct or universally applicable. (I would suggest throwing it away.)

Second, because t-test results will change when data are transformed in nonlinear ways, it is crucial to decide how best to record one's data for test purposes. For instance, with positive data (such as concentrations), there is no a priori reason to prefer using the original numbers or (say) their logarithms--but t-tests based on the original numbers and t-tests based on the logarithms will usually produce different results. Since ignorance will not make this phenomenon go away, we always need to consider what the appropriate method of recording our data ought to be. (How to find such a method is another question, with a large literature and sizable body of techniques.)

Third, many nominal datasets do not contain the information needed to record the values numerically in a meaningful or useful way. For instance, a nominal variable with the possible values "good," "better," and "best" could be encoded as 0, 1, and 2, respectively, or possibly 0, 1, and 10. Which should it be? Since these two sets of numbers are not related in a linear way, the results of a test can depend on which numbers you choose. That should be a concern if you want to produce defensible, non-arbitrary, non-subjective results. Using a Wilcoxon test (or any other rank-based test) will produce the same results regardless of your coding system and therefore can be one key part of defending the result.

Fourth, the t-test will likely be misleading in the presence of outlying data or skewed distributions: it is not resistant to unexpected data and is only a little bit robust to departures from distributional assumptions. Although the Wilcoxon test makes distributional assumptions, they tend to be less restrictive and the test is more resistant and more robust.

Fifth, the t-test will be more powerful than the Wilcoxon test (or any other rank-based test) provided its underlying statistical assumptions approximately hold. Thus, it can be superior in the sense of requiring less data (and therefore less cost and time) to detect an important difference provided you are confident in the assumptions you make.

These implications show that the choice of a statistical test cannot possibly be reduced to a simple flow chart. At the very least, the choice involves the purpose of the test, the costs of potential errors, the assumptions you can make about the data-generation process, whether the data appear consistent with those assumptions, and on the flexibility you have to re-express the data in nonlinear ways.

• First of all thankyou for the suggestion ( "I would suggest throwing it away") hahahah and further I have great respect for people like you who really give a thorough explanation to make it clear for other people (I actually had to read this 3 times and search for the meaning of some terms hahah ) – KingBoomie Jan 9 '17 at 20:58
• I got one question whith this sentence: "we always need to consider what the appropriate method of recording our data ought to be" do you mean that we would (possibly) transform our data if we would expect that our distribution would be other than that of what we measured? like your example with log, because I remember when doing gene expression analysis we tranformed it with log to make it "look like" a normal distribution because general the gene expression values should be normally distributed – KingBoomie Jan 9 '17 at 21:05
• I think you're basically correct. I don't want to leave the impression that the choice of transformation is arbitrary or should be determined entirely by expectations--there can be many more and nuanced reasons than that. The important message is that transformation is an option that always is available for analyzing data. – whuber Jan 9 '17 at 21:18