Graphing predicted probabilities with predictor variable

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
marloesc
Posts: 6
Joined: Thu Jan 03, 2013 11:35 pm

Graphing predicted probabilities with predictor variable

Post by marloesc »

I have fitted a two-level random intercept logistic model with 3 predictors. I want to make a graph in MLwiN that plots this:
graph
graph
graph example.png (16.23 KiB) Viewed 6110 times
Although in my case I want to plot the predicted probabilities for increase in age.

I have tried customised predictions -> predict mean probabilities (with standardised age range from -3 to 3, in .25 steps) -> plot grid Y = pred.mean and X = pred.age

However this does not give me what I want, because it predicts the mean probability for the age when combined with every other category from the other predictor variables. And I would like to see only one probability per age value. I think I could fit a model with only age as predictor, however, this can give of course a wrong estimate because I don't control for other variables.

I have seen some examples in section 4.2 of the User Guide (http://www.bristol.ac.uk/cmm/software/m ... man-09.pdf) and section 2 of the Manual Supplement (http://www.bristol.ac.uk/cmm/software/m ... 0-supp.pdf), however these either plot logodds instead of probabilities, or use a grouping variable.
marloesc
Posts: 6
Joined: Thu Jan 03, 2013 11:35 pm

Re: Graphing predicted probabilities with predictor variable

Post by marloesc »

I actually went to predictions -> predict the lododds as a function only of Beta(age) x Age (no intercept). Then calculated this to probabilities with this formula:

exp(logodds)/(1+exp(logodds))

And then plotted these probabilities with age. It looks OK.

However if anyone sees a problem with this, or can learn me a better way, please don't hesitate to share.
joneskel
Posts: 26
Joined: Thu Nov 15, 2012 3:09 pm

Re: Graphing predicted probabilities with predictor variable

Post by joneskel »

The Customised predictions window will do a plot of the predicted probabilities from a logit model for a single predictor controlling for other variables. Say you have three predictors and a Constant in the model, and you are interested in just showing the plot for X1. You have to choose a range of values for X1 and this could be from 20 to 60 in steps of 10 years. In the customised predictions, highlight Age, select Change range, then range , then the upper and lower and step. You then have to choose the values for the Constant ( so keep it at 1), and then choose the values for X2 and X3. If you do not want them to vary set them at their average value or any particular value that makes sense - you are not allowed to chhose values outside the range of the data. This is normally done automatically in the Customised predictions so you must mistakenly have changed X2 and X3 to a range of values; you now need to change them back to a single value.

You will find some guidance with specific examples in

Kelvyn Jones, SV Subramanian (2012) Developing multilevel models for analysing contextuality, heterogeneity and change Volume 1, 1-269. for normal theory model

Kelvyn Jones, SV Subramanian (2012) Developing multilevel models for analysing contextuality, heterogeneity and change Volume 2, 1-312. for logit model; chapter 12 shows then for odds, logits and probabilities.

These are available for download from

http://www.mendeley.com/profiles/kelvyn ... ions/book/
Post Reply