Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Jibonayan Raychaudhuri <jibonayanrc@yahoo.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: xtmepoisson out of sample prediction error |
Date | Wed, 9 Feb 2011 14:50:29 -0800 (PST) |
Hello Statalist users, I have estimated a random intercept Poisson regression model using xtmepoisson in Stata : xtmepoisson y x1 x2 x3 exposure(expvar) || district:, irr I now want to carry out an out-of-sample prediction for y using the estimated parameters of the above model. This is what I have done: Step 1: Estimate the model Step 2: predict b*,reffects Step 3: preserve Step 4: use newdata.dta,clear (new.dta has data on x1,x2 and x3 and the exposure variable expvar only--this is the out of sample data) Step 5: predict n (this is to predict mean count of y for newdata.dta) However Stata gives me an error message which says "variable y not found r(111)" The reason why I have used xtmepoisson instead of xtpoisson,normal is because I want predicted mean count to be based on both fixed and random effects. This is easy for an in-smaple prediction. However as I mentioned this is not working for an out-of-sample prediction. I know that this works if I set random effect=0 but this is not what I want. Can someone tell me why I am getting this error message? Any help would be greatly appreciated. Thanks in advance. Best Regards, Jibonayan Raychaudhuri * * 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/