Slope changes according to the reference category

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software 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!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
jeanninekhan
Posts: 6
Joined: Wed Dec 02, 2009 10:28 am

Slope changes according to the reference category

Post by jeanninekhan »

Hallo

I have a problem concerning the reference category of variables. Depending on wether I choose a low ore a high reference category, the slope changes after calculating. We have a big sample of 1100 students and we want to show graphs that are representative for all of the students. But in the strict sense we have to show the slope for each reference category, because every slope is different according to the reference category. How do others deal with this problem?

We also observed that by taking the lowest reference category, we often get an error message that the matrix has gone negative. If we take the middle category of the same variable, the model calculates without any problem.
Lydia
Posts: 26
Joined: Tue Oct 13, 2009 2:55 pm

Re: Slope changes according to the reference category

Post by Lydia »

Are you talking about a categorical variable for the response, or as an explanatory variable? I'm assuming you mean an explanatory variable, because I don't think you can choose the middle category as the reference for an ordered categorical response variable in MLwiN (or, probably, any other software- it wouldn't really make sense).

Also, when you say slope, do you just mean the coefficients of the different categories of the explanatory variable? Or have you interacted the categorical variable with a continuous variable and are referring to these coefficients? Or have you put a random slope on the categorical explanatory variable?

Whichever of these you are talking about, you would expect to get different values when you use a different reference category. Let's take the simplest possibility: you don't have any interactions or random slopes, you're just looking at the coefficients of the dummy variables for your categorical explanatory variable. How do we interpret this? Well, the intercept is the predicted or average value of the response when all the explanatory variables have the value 0. So in this case, the intercept beta_0 is the expected value of the response for a student in the reference category (and with all other explanatory variables having the value 0). Let's suppose that this value is 1 for your low category, 2 for your mid category, and 5 for your high category. So you will get an intercept of 1 when the low category is your reference, an intercept of 2 when the mid category is your reference, and an intercept of 5 when the high category is your reference.

Now suppose you have the low category as your reference. The coefficient of the dummy variable for the mid category is the difference between the expected value of the response for a student in the mid category (with all other explanatory variables = 0) and the expected value of the response for a student in the low category (with all other explanatory variables = 0). We were supposing that the value of the response for a student in the mid category, with all other explanatory variables = 0, was 2. So this coefficient will be 1. The coefficient of the dummy variable for the high category will similarly be 4. So when we have the low category as the reference, we have an intercept of 1 and two coefficients for the dummy variables of 1 and 4- let's write (1,1,4) for short.

What if we have the mid category as the reference instead? Now the intercept is 2, and the coefficient of the dummy variable for the low category is the difference between the expected value of the response for a student in the low category (with all other explanatory variables = 0), which we are supposing is 1, and the expected value of the response for a student in the mid category (with all other explanatory variables = 0), which we are supposing is 2. So this coefficient will be -1. Similarly the coefficient for the high category will be 3. So our estimates are (2,-1,3)- different from the estimates when we chose the low category as the reference category.

If we choose the high category as the reference then the estimates will be (5,-3,-4)- different again. For similar reasons, if we have an interaction between the categorical and the continuous variable, we will get different estimates depending on which category we take as the reference, and the same for a random slope on each category of the dummy variable.

What does this mean for your graph? Well, to draw the graph we will make predictions from the model. To get the predicted value of the response for a student in the reference category (with all other explanatory variables = 0), we just take the intercept. To get the predicted value of the response for a student in one of the other categories (with all other explanatory variables = 0), we need to take the intercept plus the coefficient for that category. So:

Reference category = low
Low = 1
Mid = 1 + 1 = 2
High = 1 + 4 = 5

Reference category = mid
Low = 2 - 1 = 1
Mid = 2
High = 2 + 3 = 5

Reference category = high
Low = 5 - 4 = 1
Mid = 5 - 3 = 2
High = 5

So we always get the same predicted values: 1 for the low category, 2 for the mid category, and 5 for the high category. Similarly if we have an interaction between the categorical variable and a continuous variable.

Or perhaps that's not what you meant? Did you mean that when you perform those calculations you end up with different predicted values depending on which category you take as the reference? If so, I have not seen that happen before, and it sounds like there's something wrong.

In terms of your difficulties with estimation, usually you would expect it would be possible to estimate the model with any reference category that you want; but if you have a particularly tricky model (perhaps with a binary response, for example, or it may be that your data just happens to be awkward!) then some reference categories may not work. I'm not surprised it was the middle category that worked for you; it's like centring a continuous variable, which can also help with the estimation.
Lydia
Posts: 26
Joined: Tue Oct 13, 2009 2:55 pm

Re: Slope changes according to the reference category

Post by Lydia »

Oh, forgot to mention that if you get an error message 'matrix has gone negative definite. Continue estimation?', it's often worth pressing 'Yes'- sometimes the message keeps reappearing but if you keep pressing Yes then eventually it will estimate. (Sometimes it won't!)
Post Reply