Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: FW: Re: xtmixed slope cross validation


From   [email protected] (Yulia Marchenko, StataCorp LP)
To   "[email protected]" <[email protected]>
Subject   st: FW: Re: xtmixed slope cross validation
Date   Fri, 02 Dec 2011 14:46:33 -0600

Petra <[email protected]> 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
[email protected]
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index