Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Proitsi, Petroula" <petroula.proitsi@kcl.ac.uk> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: FW: Re: xtmixed slope cross validation |
Date | Mon, 12 Dec 2011 16:13:39 +0000 |
Hi thats great! it works now! many many thanks! Petra ________________________________________ From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Yulia Marchenko, StataCorp LP [ymarchenko@stata.com] Sent: 02 December 2011 20:46 To: statalist@hsphsun2.harvard.edu Subject: st: FW: Re: xtmixed slope cross validation Petra <petroula.proitsi@kcl.ac.uk> has a follow-up question about computing BLUPs after -xtmixed- using test data after the model is fit using training data: > however, I get all my people with empty values when i do this: my exact code > is > > . use:" data...." > * i have already a variable training =1 if it is training and 0 if it is test > . xi:xtmixed var1 days ....... if training==1 || id:days, reml cov(un) > . predict rs1 rs2 it training!=1, reffects > > why do you think this is? by the way im using stata10 ic > do you think this may be the reason? In this case, the most likely reason for getting missing values of BLUPs after -predict, reffects- is that the group identifiers in the test data are different from the group identifiers in the training data. When creating a training indicator, Petra needs to make sure that each group is represented in both test and training datasets. For example, . webuse pig, clear // set seed for reproducibility . set seed 287634 // select 50% of obs within each group into a training sample . by id, sort: gen training = runiform()>0.5 . xtmixed weight week if training || id: week . predict r* if !training, reffects . summarize r* -- Yulia ymarchenko@stata.com * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/