How to change reference category in ordered logistic regression

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
GerineLodder
Posts: 42
Joined: Thu Jul 28, 2016 11:33 am

How to change reference category in ordered logistic regression

Post by GerineLodder » Thu Jan 25, 2018 1:32 pm

I have a variable with 5 levels.
Level 5 is now automatically taken as the reference category (that is: I get intercept_1 thru intercept_4), but I want level 1 to be the reference category (i.e., have intercept_2 thru intercept_5 estimated).
What code do I have to add to change that?

If this information is available in any documentation, I would be happy if you could point me to that info as well (So far, I have worked through the Zang et al. 2016 paper, the "translation" of chapter 13 about ordered logistic regression into R2mlwin and the LEMMA course material, although that doesn't include Rcode).

ChrisCharlton
Posts: 1094
Joined: Mon Oct 19, 2009 10:34 am

Re: How to change reference category in ordered logistic regression

Post by ChrisCharlton » Fri Jan 26, 2018 9:57 am

To do this you can either use the R relevel() function (https://stat.ethz.ch/R-manual/R-devel/l ... level.html) as used at the beginning of http://www.bristol.ac.uk/cmm/media/r2ml ... rGuide10.R or you can specify the reference category in the model equation as in the section 11.4 A two-level model in http://www.bristol.ac.uk/cmm/media/r2ml ... rGuide11.R.

GerineLodder
Posts: 42
Joined: Thu Jul 28, 2016 11:33 am

Re: How to change reference category in ordered logistic regression

Post by GerineLodder » Mon Jan 29, 2018 9:34 am

Could you indicate where in the function of 11.4 the reference category is specified?

I have tried replacing:

Code: Select all

Function <- logit(variable, cons, 5) ~ 1 + (1[1:4] |school)  
With:

Code: Select all

Function <- logit(variable, cons, 5) ~ 1 + (1[2:5] |school)  
But that doesn't work.

ChrisCharlton
Posts: 1094
Joined: Mon Oct 19, 2009 10:34 am

Re: How to change reference category in ordered logistic regression

Post by ChrisCharlton » Mon Jan 29, 2018 10:24 am

It's the third parameter of the logit() function. The three parameters are:
  1. Response
  2. Denominator
  3. Reference category
Note that the category specified needs to be the underlying value if it is a factor variable.

GerineLodder
Posts: 42
Joined: Thu Jul 28, 2016 11:33 am

Re: How to change reference category in ordered logistic regression

Post by GerineLodder » Mon Jan 29, 2018 11:06 am

Thanks!! Thought the 5 was for "N categories", so good to know!

Post Reply