Can you use Stata's predict command after runmlwin?

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/

Can you use Stata's predict command after runmlwin?

Postby jbherman » Wed May 11, 2011 7:53 pm

hi,

any plan to extend the postestimation predict command to include random effects and work on out of sample data?


thanks, j
jbherman
 
Posts: 1
Joined: Sun May 08, 2011 12:22 am

Re: Can you use Stata's predict command after runmlwin?

Postby GeorgeLeckie » Thu May 12, 2011 11:12 am

Dear J,

This is a good question. No we don't plan to extend Stata's postestimation predict command to work with runmlwin. This would involve working out and implementing the prediction formula for a very wide range of multilevel models. The aim of runmlwin is to make MLwiN functionality accessible to Stata users, not to directly implement MLwiN functionality in Stata. The latter would be much more ambitious!

However, the good news is that you can easily calculate a wide range of in-sample and out-of-sample predictions using runmlwin. All you need to do is to pull back the residuals from MLwiN and then do a small amount of data manipulation.

So for example, if you ran the following two-level growth trajectories model for child weight:

use http://www.stata-press.com/data/r11/childweight, clear

. bysort id (age): gen occasion = _n

. generate cons = 1

. generate agesq = age^2

. runmlwin weight cons age agesq, ///
level2(id: cons age, residuals(u)) ///
level1(occ: cons) plugin


You would generate and graph the growth trajectory for the mean child as follows:

. generate xb = _b[cons] + _b[age]*age + _b[agesq]*agesq

. line xb age, sort


And you would generate and graph the child specific growth trajectories as follows:

. generate xbu = xb + u0 + u1*age

. line xbu age, connect(a)


For a wide range of examples, for both continuous and discrete response models, please see the runmlwin do-files for the MLwiN User Manual.

http://www.bristol.ac.uk/cmm/software/r ... /examples/

I hope this helps

George
*************************
George Leckie
runmlwin developer
Centre for Multilevel Modelling
*************************
GeorgeLeckie
Site Admin
 
Posts: 320
Joined: Fri Apr 01, 2011 3:14 pm


Return to runmlwin user forum

Who is online

Users browsing this forum: ashish123 and 2 guests