Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: FW: Re: xtmixed slope cross validation


From   "Proitsi, Petroula" <petroula.proitsi@kcl.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: FW: Re: xtmixed slope cross validation
Date   Fri, 2 Dec 2011 06:12:03 +0000

Dear Yulia
thank you so much  for this
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?
many thanks again
Petra
________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Yulia Marchenko, StataCorp [ymarchenko@stata.com]
Sent: 01 December 2011 16:39
To: statalist@hsphsun2.harvard.edu
Subject: st: Re: xtmixed slope  cross validation

Petra <petroula.proitsi@kcl.ac.uk> uses -predict, reffects- after -xtmixed- on
a test dataset which does not include the original data used in estimation and
receives a "no observations" error:

> I have predicted the slopes for memory decline in a sample of demented
> patients - in order to validate my model I split my sample into a "training"
> and "test" set with the idea to fit a model on the training set and then
> predict the slopes of the "test"set and compare these to the slopes of the
> whole sample.
>
> in the help for the predict command says that you can run a model using one
> dataset (I used the "train"), use a different dataset (then used the "test")
> and then used predict (in my case I typed:  predict r_slope1 r_inter1,
> reffects)- However, I get that message: no observations.  Does anyone have
> any idea of how to predict the slopes for the "test" set, using the slopes
> of the "train" set?

Unlike linear prediction, fitted values, etc., the computation of the
estimates (BLUPs) of random effects requires the original data used in
estimation be in memory.  We will improve the error message to clarify this.

To obtain BLUPs of random effects for the test data, Petra can do the
following:

 . use <entire_data>                               // load training+test data
 . generate byte training = ...   // create indicator for the training sample
 . xtmixed ... if training            // run -xtmixed- on the training sample
 . predict ... if !training, reffects          // predict REs for test sample


-- 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index