How to use predict after a multinomial model

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin 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 runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
MForseth
Posts: 6
Joined: Fri Jun 21, 2024 9:12 am

How to use predict after a multinomial model

Post by MForseth »

Hi
I use runmlwin and have run a multinomial model, and wish to use predict. My model is as follows:
runmlwin iscore cons hybridnum _Itempcat* hybridtempint1-hybridtempint5 rain temprainint1-temprainint5, ////
> level3(id_farm: cons) ////
> level2(flock_id: cons) ////
> level1(idvar) ////
> discrete(dist(multinomial) link(mlogit) denom(cons) basecategory(0)) ////
> nopause igls maxiterations(50)

I have tried the following commands, but they all returned errors as follows:
. predict y,xb outcome(=1)
equation =1 not found
r(303); t=0.01 9:09:01

. predict y,xb
variable cons_1 not found

. predict y,xb outcome(1)
equation 1 not found
r(303); t=0.00 9:18:08

. predict y
variable cons_1 not found
r(111); t=0.00 9:18:29

Any suggestions on how to use predict after a multinomial model?
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: How to use predict after a multinomial model

Post by ChrisCharlton »

Unfortunately we do not offer an automatic way to calculate these predictions. I think that your options are :
  • Remove the nopause option from the command and the once the model is estimated use Model>Customised predictions within MLwiN. You can then copy/paste these results back into Stata.
  • Perform the calculation manually within Stata. There is a simple example of this in the user guide chapter 10 replication materials, but obviously this become a lot more complicated once you add predictors.
MForseth
Posts: 6
Joined: Fri Jun 21, 2024 9:12 am

Re: How to use predict after a multinomial model

Post by MForseth »

Thank you for your reply. I will try an alternative approach.
matronrocket
Posts: 1
Joined: Tue Oct 29, 2024 8:30 am

Re: How to use predict after a multinomial model

Post by matronrocket »

Ensure that you are specifying the outcome correctly. In multinomial models, outcomes are typically indexed or labeled. You might need to refer to the exact labels used in your model. Use the command list or describe on your outcome variable to check how it's formatted. If you're predicting probabilities or linear predictions, you might want to use something like: geometry dash lite

Code: Select all

predict y, pr outcome(1) // for probabilities of outcome 1
Post Reply