# Importance of ordinality assumption in ordinal logistic regression when covariates are binary

**URL:** <https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585>\
**Category:** modeling strategy\
**Tags:** ordinal, rms\
**Created:** [July 15, 2020, 10:16pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585 "2020-07-15T22:16:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elias\_Eythorsson](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/elias_eythorsson/32/2524_2.png) [@Elias\_Eythorsson](https://discourse.datamethods.org/u/Elias_Eythorsson)\
**Post date:** [July 15, 2020, 10:16pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/1 "2020-07-15T22:16:09Z")

</div>

I am trying to wrap my head around methodological issues while constructing a predictive model.

The predictive model was developed following the Tripod guidelines. It has a defined use-case. An ordinal logistic regression model was chosen and the outcome variable defined based on subject matter knowledge of clinical collaberators without “looking at the data”. The included covariates where chosen based on subject matter knowledge, and respecting the number of candidate parameters the data could support.

Now I have fit a tentative ordinal model. Examining the residuals, there are some covariates which show strong evidence of not following the proportional odds assumption. However, most of the variables are binary, 0 and 1 which I feel may affect the interpretation of the importance of this violation. I am also aware that there is a literature regarding the proportional hazards assumption, and that violations of this may not matter. I am therefore curious how I should proceed, when I have already chosen the model and the variables, but now find violations.

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/e/e3909b75972f9f7dd10c428d28ba67079505aa28.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/0/0f3950fd53701df66a80c862f87cef513730eae6.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/8/8fbe60ac728ee1f813c47fa071eb3be8e8a2120e.png)

Specifically when I do not believe the violations have any real significance to the model performance. Here I show the calibration plots for the first, second and third outcomes. The third outcome is rare, and I am not surprsied it performs relatively poorly. The overall model seems to perform well. How to I reconcile violations of assumptions with this fact?

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/4/41401fde5c1fcc1af053f5f1ee051b80a5e02c42.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/7/7be6a934496d2b05fab41eb4baa557b151a2fd44.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/2/23eb0dbde0bdf7b272c5c90089d444d3d2ff3140.png)

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 16, 2020, 11:05am UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/2 "2020-07-16T11:05:22Z")

</div>

This is a really excellent question and one that comes up often, but the literature on what to do about non-proportional odds for a minority of predictors is not fully developed. Here are some random thoughts:

- The partial residual plots need to be put on a common scale and interpreted in such a way that non-PO in minor predictors is de-emphasized
- Fitting a model that has non-PO for a minority of predictors is almost always better than alternative models which may have different assumptions violated, and is certainly better than fitting separate binary logistic models
- The most rational approach, though one that complicates the model, is to use a Bayesian partial proportional odds model where priors are put on model components that represent departures from PO. In other words we have somewhat skeptical priors on the extra model terms that favor PO but allow for non-PO as the sample size expands and more information is available for such customization (just as as do for Bayesian modeling of covariate interactions). This is implemented in the new R `rmsb` package which will be available on CRAN on about 2020-07-23 and for which many examples are shown [here](https://hbiostat.org/R/rmsb/blrm.html).

---

<div class="post-metadata">

**Author:** ![Elias\_Eythorsson](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/elias_eythorsson/32/2524_2.png) [@Elias\_Eythorsson](https://discourse.datamethods.org/u/Elias_Eythorsson)\
**Post date:** [July 19, 2020, 4:58pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/3 "2020-07-19T16:58:54Z")

</div>

Thank you for your reply! I would love to better understand the interpretation of residuals in binary logistic and ordinal logistic models. I have been using your excellent RMS book (and course, and package).

[quote="f2harrell, post:2, topic:3585]

- The partial residual plots need to be put on a common scale and interpreted in such a way that non-PO in minor predictors is de-emphasized  
[/quote]

Showing the partial residuals on a common scale definitely does drive home the point how minor these violations are for most variables.

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/0/0c004abb097e27dd949019a67ba1061e8b227716.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/2/29e37795be5be2116fd8de45937bdc7a971dc071.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/d/d1c58296edcee68e4a708af5e597b9d46a93dc4f.png)

I still wonder what effect (if any) the dichotomous nature of the variables have on the interpretation of ordinality. The above approach seems to assume that the variable is continuous. I played around with visualisations, but I imagine I am just misunderstanding the problem at hand.

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/6/6799729916e7559eb5d66de764074dae12f05723.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/c/cb7d986bd1718c9f529307b99cc685923c0121ed.png)

Likewise, I wonder if confidence limits to the LOESS smoother for the partial residuals aids in interpretation of the seriousness of the ordinality violation. I notice that the LOESS trend tends to diverge where there is the lease amount of information in the data. Again, this could all just be a big misunderstanding on my part.

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/c/c4177a7eecb975f0f22aee0e2260ea2dac4e7cab.png)

 ![image](https://discourse.datamethods.org/uploads/default/original/2X/e/e659249967f12a0d323265d8d504cba17806dac7.png)

> [@f2harrell](#):
>
> The most rational approach, though one that complicates the model, is to use a Bayesian partial proportional odds model where priors are put on model components that represent departures from PO. In other words we have somewhat skeptical priors on the extra model terms that favor PO but allow for non-PO as the sample size expands and more information is available for such customization (just as as do for Bayesian modeling of covariate interactions). This is implemented in the new R `rmsb` package which will be available on CRAN on about 2020-07-23 and for which many examples are shown [here](https://hbiostat.org/R/rmsb/blrm.html).

Yet another reminder that I have to push for clinical time off to finish Richard McElreath’s book to get started on understanding Bayesian approaches. The package looks amazing.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 21, 2020, 10:44pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/4 "2020-07-21T22:44:16Z")

</div>

And if the failing variable is a non-linear continuous variable, eg a spline, what is best to do? A PPO model without proportionality for the spline, or a PO model ignoring the issue?

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 21, 2020, 11:00pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/5 "2020-07-21T23:00:04Z")

</div>

Sometimes you find that a different link function works better, but then you have trouble interpreting the effects. I would go usually with the constrained partial proportional odds model. Example of the Bayesian Wilcoxon test is in the link above, where the departure from proportional odds is linear in transformed y. It should be on CRAN in 2 days, and requires a new version of the `rms` package also, which is already on CRAN.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 22, 2020, 10:03pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/6 "2020-07-22T22:03:17Z")

</div>

I have been reading about the constrained partial proportional odds model, and thought it was beautiful. But, in that case, is it a good idea to use the proportionality constraints for the spline coefficients of continuous variables? These coefficients usually violate the assumption of PO the most. In principle, it should be possible, as with other variables, right?

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 22, 2020, 10:42pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/7 "2020-07-22T22:42:27Z")

</div>

Yes it’s just that with restricted cubic spline with k knots you’ll have k-1 parameters to estimate for departures from PO. Use e.g.

```auto
require(rmsb)
f <- blrm(y ~ sex + rcs(age, 4), ~ rcs(age, 4), cppo=function(y) y)

```

This assumes PO for sex.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 23, 2020, 10:40am UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/8 "2020-07-23T10:40:50Z")

</div>

And is it possible to plot nomograms from such models using Exprob?

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 23, 2020, 11:10am UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/9 "2020-07-23T11:10:46Z")

</div>

Yes - see the vignettes. Estimation is not implemented for the general partial proportional odds model though; only for the constrained version.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 23, 2020, 9:34pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/10 "2020-07-23T21:34:04Z")

</div>

Yeah, I can see the vignettes, but I can’t wait to try the package.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 29, 2020, 5:31pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/11 "2020-07-29T17:31:36Z")

</div>

And, can you explain the interpretation of the coefficientes from the Constrained Partial Proportional Odds Ordinal Logistic Model??  
For example, the response variable h7 has 3 ordered levels (poor, regular, good) and cir is a binary predictor (0,1).

```
Constrained Partial Proportional Odds Ordinal Logistic Model
 
 blrm(formula = h7 ~ cir, ppo = ~cir, cppo = function(y) y == 
     "good", data = DAT)
 
                    Mixed Calibration/ Discrimination Rank Discrim.    
                Discrimination Indexes Indexes Indexes    
     Obs219 LOO log L-194.75+/-9.02 g 0.348 [0.001, 0.708] C 0.617 [0.366, 0.634]    
      poorl21 LOO IC 389.5+/-18.04 gp 0.03 [0, 0.063] Dxy 0.234 [-0.269, 0.269]    
  regular63 Effective p4.02+/-0.35 EV 0.014 [0, 0.042]                                 
   good135 B 0.087 [0.086, 0.088] v 0.168 [0, 0.511]                                 
  Draws4000 vp 0.001 [0, 0.004]                                 
    Chains4                                                                                       
     p 1                                                                                       
 
              Mode Beta Mean Beta Median Beta S.E. Lower Upper Pr(Beta>0) Symmetry
 y>=regular 2.5648 2.5896 2.5731 0.3471 1.8988 3.2595 1.0000 1.16    
 y>=good 0.7290 0.7217 0.7184 0.1905 0.3650 1.0949 1.0000 1.06    
 cir=1 -0.6076 -0.6111 -0.6069 0.2964 -1.1675 -0.0187 0.0163 0.93    
 cir=1 x f(y) 0.0375 0.0376 0.0357 0.2136 -0.3693 0.4637 0.5692 1.05    

```

So, in order to understand cir=1 x f(y) I need to manually obtain the beta coefficient for regular and good?  
I have seen this in the vignette but how can I calculate that myself?  
h \<- bs22$cppo  
k \<- coef(bs22)  
k  
k[3] + h(1:2) \* k[4]

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 29, 2020, 10:27pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/12 "2020-07-29T22:27:10Z")

</div>

So glad to see the new `rmsb` package used Alberto. You are close. Before answering your question directly you can use `Predict(fit, ycut='regular')` or `contrast(fit, list(...), list(...), y=c('regular', 'good'))`. For the manual approach, use e.g.

```auto
k <- coef(fit, 'mean') # if using posterior mean parameters
k['cir=1'] # beta coefficient for y >= 'regular'
k['cir=1'] + k['cir=1 x f(y)'] * cppo('good') # beta for y = 'good'

```

Check me by running against `Predict`.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 29, 2020, 11:11pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/13 "2020-07-29T23:11:44Z")

</div>

Well, I’m glad you’re glad, I have been using your codes for years, but now I have a lot of doubts on this model… For example, this is the output from constrast, but to understand the Peterson-Harrell model I would like to know the interpretation of cir=1 x f(y) 0.0375 above. For example:

```
> contrast(bs22, list(cir=1), list(cir=0), y=c("good","regular","poor"))
                 Contrast S.E. Lower Upper Pr(Contrast>0) NA
1 h7=good -0.5814817 0.2799829 -1.116538 -0.03558248 0.0135 bien
2 h7=regular -0.6586901 0.4706123 -1.598199 0.23096145 0.0755 regular
3* h7=poor -0.6586901 0.4706123 -1.598199 0.23096145 0.0755 mal

Redundant contrasts are denoted by *

Intervals are 0.95 highest posterior density intervals
Contrast is the posterior mean 

```

I suppose the output above are log odd ratios but how can I derive the -0.58 from the model coefficients?

Also I don’t understand the difference between the estimates from contrast and this:

```
k <- coef(bs22, 'mean') # if using posterior mean parameters
k['cir=1'] # beta coefficient for y >= 'regular'
     cir=1 
-0.6110959 

```

Something seems to happen with cppo, R tell me that the function can’t be found:

```
> k['cir=1'] + k['cir=1 x f(y)'] * cppo('good') # beta for y = 'good'
Error in cppo("good") : no se pudo encontrar la función "cppo"

```

Also can you please explain the interpretation of this??

```
> Predict(bs22, ycut='regular')
      cir yhat lower upper .predictor.
cir.1 0 0.72172180 0.3650206 -0.8754442 cir
cir.2 1 0.06303166 1.0949340 0.8880748 cir

Response variable (y): log odds 

Limits are 0.95 confidence limits

> Predict(bs22, ycut='good')
      cir yhat lower upper .predictor.
cir.1 0 0.7217218 0.3650206 -0.2731482 cir
cir.2 1 0.1402401 1.0949340 0.5463421 cir

Response variable (y): log odds 

Limits are 0.95 confidence limits
```

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 30, 2020, 1:59am UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/14 "2020-07-30T01:59:59Z")

</div>

You are calling `cppo` `h`. I forgot that and used code as if you had entered `cppo <- bs22$cppo`,

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 30, 2020, 1:59pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/15 "2020-07-30T13:59:24Z")

</div>

Thank you, Frank, if cir=1 is radical mastectomy and cir=0 is breast conserving surgery, and hr7 is quality of life at the end of chemotherapy, can you help me interpret these coefficients, please? In particular, I have been reading Peterson & Harrell 1990, and I understand Eq. 6 for the constrained model as β + Γ\*γ but I don’ t understand the reason to normalize gamma Γ by the weighted mean and sd of Y (in this case it is quality of life).

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 30, 2020, 5:25pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/16 "2020-07-30T17:25:41Z")

</div>

The normalization of the \Gamma function (called `cppo` in `blrm`) is done to make MCMC behave better in the Bayesian posterior sampling. Always use the derived `cppo` function from the fit object in all of your calculations and you can ignore that this is happening, since the modified `cppo` function does the scaling and centering automatically.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 30, 2020, 6:09pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/17 "2020-07-30T18:09:39Z")

</div>

But if you normalize, the beta coefficient changes as well. For example, in the cisplatin example, in the blrm output, the beta is 0.94, but after applying the cppo formula the final result is 1.06.  
Likewise, I can no longer interpret γ as the factor by which 0.94 varies for Y=5…

Also what happens if you can’t predict the coefficients linearly?

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 30, 2020, 10:53pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/18 "2020-07-30T22:53:58Z")

</div>

I’m not getting your question. As long as you always multiply the regression coefficient by fit$cppo(y) you’ll have the right answer. When communicating to others just print the function so they can incorporate the same scale/centering.

---

<div class="post-metadata">

**Author:** ![albertoca](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/albertoca/32/297_2.png) [@albertoca](https://discourse.datamethods.org/u/albertoca)\
**Post date:** [July 31, 2020, 10:59am UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/19 "2020-07-31T10:59:29Z")

</div>

I understand that you mean that the model estimates are invariant after normalization, and this does not affect the predictions either. I think I’m going to start a new thread in datamethods for practical or code issues with the new package, with your permission. It will be easier for other people to find in google. Thanks.

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [July 31, 2020, 7:12pm UTC](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585/20 "2020-07-31T19:12:19Z")

</div>

Good idea. I see it now.

[Next page](https://discourse.datamethods.org/t/importance-of-ordinality-assumption-in-ordinal-logistic-regression-when-covariates-are-binary/3585.md?page=2)
