Simple ordinal regression with a categorical (non-binary) x

Theoretical examples

Example 1
We want to investigate the association between educational attainment (x) and happiness (y). Educational attainment has the values: 1=Compulsory, 2=Upper secondary, and 3=University. We choose Compulsory as our reference category. Happiness has the values 1=Happy, 2=Neither happy not unhappy; 3=Unhappy. Let us say that we get an OR for Upper secondary that is 0.87 and we get an OR for University that is 0.66. We can thus conclude that higher educational attainment is associated with less unhappiness (or more happiness). 
Example 2
Suppose we are interested in the association between family type (x) and adolescent smoking (y). Family type has three categories: 1=Two-parent household, 2=Joint custody, and 3=Single-parent household. We choose Two-parent household as our reference category. Adolescent smoking has the values 1=No, 2=Occasionally, and 3=Frequently. The analysis results in an OR of 1.33 for Joint custody and an OR of 3.01 for Single-parent household. That would mean that adolescents living in family types other than two-parent households smoke more. 

Practical example

Dataset
StataData1.dta
Variable nameeduc
Variable labelEducational level (Age 40, Year 2010)
Value labels1=Compulsory
2=Upper secondary
3=University
Variable namebestfriends
Variable labelNumber of best friends (Age 15, Year 1985)
Value labels1=No best friends
2=One best friend
3=Two best friends
4=Three best friends
5=Four or more best friends

sum educ bestfriends if pop_ordinal==1

The variable bestfriends has five categories: 1=No best friends, 2=One best friend, 3=Two best friends, 4=Three best friends, and 5=Four or more best friends. Here, we (with ib1) specify that the first category (No best friends) will be the reference category.  

ologit educ ib1.bestfriends if pop_ordinal==1, or

When we look at the results for the dummies for bestfriends, we see that the odds ratios range from 1.18 for One best friend, to 3.60 for Four or more best friends. Put differently, having more best friends is associated with higher levels of educational attainment.  

All dummies for bestfriends are significantly different from the reference category, as reflected in the p-values and the 95% confidence intervals. 

Testing the overall effect

The output presented and interpreted above, is based on the odds ratios for the dummy variables of bestfriends. Let us also assess the overall statistical effect of bestfriends on educ? We can assess it through contrast, which is a postestimation command.  

contrast p.bestfriends, noeffects

Here, we focus on the row for linear, which shows a p-value (P>chi2) below 0.05. This suggests that we have a statistically significant trend in educ according to bestfriends

More information
help contrast

We will also produce a graph of the trend. First, however, we need to apply the post-estimation command margins

Note
This command can also be used for variables that are continuous or binary, but is particularly useful for categorical, non-binary (i.e. ordinal) variables.

margins bestfriends

marginsplot

Note
The y-axis shows predicted probabilities (i.e. not log odds or odds ratios). The different colours reflect the different levels of the y-variable.

This graph is quite interesting. It shows that the greater the number of best friends, the lower the probabilities of compulsory education, and the higher the probabilities of university education. The trend for upper secondary education is rather unexpected it is quite flat first, and then decreasing. 

More information
help marginsplot

Summary
There seem to be a quite clear, and statistically significant, trend in level of educational attainment at age 40 according to the number of best friends at age 15. Having more friends is particularly associated with higher probabilities of university education.