# How to handle ordinal categorical variable as independent variable

I am using a logit model. My dependent variable is binary. However I have an independent variable which is categorical and contains the responses: 1.very good, 2.good, 3.average, 4.poor and 5.very poor. So, it is ordinal ("quantitative categorical"). I am not sure how to handle this in the model. I am using gretl.

-
My dependent variable takes value 0 and 1, i have 6 independent variable, 3 of them are categorical these variable are like "how do you rate local health services in your area? how do you rate local transportation in your area and how do you rate police services in your area? the responses are very good, good, average, poor and very poor. – rahmat Feb 12 at 14:49
@Tim If the dependent variable is binary, then there is no need for any ordinal regression. The implication is to handle an ordinal predictor using indicator (dummy) variables. – Nick Cox Feb 12 at 14:52
@NickCox right, I misread it. – Tim Feb 12 at 14:55
thanks tim, if i am not mistaken what you say is that i should create dummy for all the categories?? for instance i have five response (very good, good, average, poor and very poor) for one indep varible, so i should create 5 dummies. – rahmat Feb 12 at 14:58

The problem with ordinal independent variable is that since, by definition, the true metric intervals between its levels are not known, no appropriate type relationship - apart from umbrella "monotonic" - can be assumed apriori. We have to do something about it, for example - to "screen or to combine variants" or to "prefer what maximizes something".

If you insist on treating your likert rating IV as ordinal (rather than interval or nominal) I've got a pair of alternatives for you.

1. Use polynomial contrasts I.e. each such predictor used in the model enters not only linearly but also quadratically and cubically. So, not only linear, but more general, monotonic effect can be captured (the linear effect corresponds to the predictor kept as scale/interval and the other two effects tastes it as having nonqual intervals). Additionally, dummies of each predictor could be entered as well, which will test for the nominal/factorial effect. In the end of all that, you know how much your predictor acts as factor, how much as linear covariate, and how much as nonlinear covariate. This option is easy to do in almost any regression (linear, logistic, other generalized-linear models). It will consume dfs, so the sample size should be large enough.
2. Use optimal scaling regression. This approach transforms monotonically an ordinal predictor into an interval one so as to maximize linear effect on the predictand. CATREG (categorical regression) is an implementation of this idea in SPSS. One problem of your specific case is that you want to do logistic, not linear regression but CATREG is not logit model based. I think this obstacle is relatively minor since your predictand is only 2-category (binary): I mean you might still do CATREG for optimal scaling, then do final logistic regression with the optained transformed scale predictors.
3. Note also that in simple case of one scale or ordinal DV and one ordinal IV Jonckheere-Terpstra test might be a reasonable analysis instead of regression.

There could be other suggestions, too. The three above are what come to my mind just instantly reading your question.

Let me recommend you also to visit these threads: Associating between nominal and scale or ordinal; Associating between ordinal and scale. They could be helpful despite that they are not about specifially regressions.

But these threads are about regressions, particularly logistic: you must look inside: one, two, three, four, five.

-
(+1) (1) You can also use only the first few polynomial contrasts if you think they're enough. (2) Defining predictors from the response in the same data set should come with a health warning. (3) You can also penalize discrepancy between the coefficients of adjacent levels - see stats.stackexchange.com/q/77796/17230. – Scortchi Feb 12 at 16:15
@Scortchi, Thank you for the comment. Regarding (2) - yes, in particular, it is of course more reliable to do optimal scaling on on a separate subset of the data on which the final regression will be done. (3) - thanks, too, I'll get myself acquainted with it. – ttnphns Feb 12 at 16:30
Another option is to use an aditive model, and represent the ordinal independent variable via a spline. – kjetil b halvorsen Apr 18 at 8:45
@kjetilbhalvorsen, Yes it is possible, thank you. This option however is already implied in Pt 2 because one of the methods of optimal scaling for ordinal variables uses spline. – ttnphns Apr 18 at 10:19

You need dummy variables but you need $k-1$ dummy variables, where $k$ is the number of potential responses. In your case with 5 response values (1-5) you would create 4 dummy variables. When a response is "5" your four dummy variables would be all 0s. Make sense?

-
I've unilaterally (and pedantically, or otherwise) changed your tiny use of notation. Although it's trivial, $n$ is more usually a count of observations, and I've often seen beginners get confused by such matters. – Nick Cox Feb 12 at 15:21
thanks tim and nick. So i have to run all four dummies in the regression. right? if so i have 3 categorical variables each with 5 response. therefore, my model will have 12 variables. right? – rahmat Feb 12 at 15:42
Thanks @NickCox -- I'm new to the CV world and appreciate the respectful corrections – Austin T Feb 12 at 15:48
Unfortunately, you have not explained why dummy variables will be needed at all. I don't feel that this answer, as for how it is currently, looks as an answer to the question. – ttnphns Feb 12 at 16:40
In support, I don't think it's a case of arguing that indicators are needed; it's just that they allow a variety of effects to be captured, including non-monotonic relationships. – Nick Cox Feb 12 at 20:09

Just to add to the other excellent answers: A modern way of handling it could be via an additive model, representing the ordinal independent variable via a spline. If you are quite sure the effect of the variable is monotone, you could restrict to a monotone spline.

-
It would be nice just a bit expand it, to include a few more details how it will work with ordinal predictors. – ttnphns Apr 18 at 11:12