Page 1 of 1

Can you use Stata's predict command after runmlwin?

Posted: Wed May 11, 2011 6:53 pm
by jbherman
hi,

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


thanks, j

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

Posted: Thu May 12, 2011 10:12 am
by GeorgeLeckie
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