Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: rolling prais regression in paneld dataset


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: rolling prais regression in paneld dataset
Date   Sun, 16 Jul 2006 18:18:16 +0100

To make this more scrutable, so to speak, please 
spell out "doesn't seem to work well". 

Nick 
n.j.cox@durham.ac.uk 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of
> ocg2001@columbia.edu
> Sent: 16 July 2006 18:00
> To: statalist@hsphsun2.harvard.edu
> Subject: st: rolling prais regression in paneld dataset
> 
> 
> Hi I am using Stata9's new rolling capability with prais regression
> on a panel dataset (unbalanced panal with about 10,000 individuals
> and roughly 15 years for each).
> 
> Stata-tech support helped me write a little program that collects,
> in addition to coefficients of the regression, its predicted values
> and residuals. But the program doesn't seem to work well, and I am
> not sure where the bug is, I tried recontacting tech support, but
> so far no answer. Here is my code, any help would be greately
> appreciated:
> *************************
> 
> tsset person year
> 
> program myforecast, rclass
> 	syntax [if]
> 	prais r exp `if'
> 	summ year if e(sample)
> 	local min=r(min)
> 	predict pred`min' if e(sample)
> 	predict resid`min' if e(sample), r
> 	return scalar n=r(N)
> 	return scalar rho=e(rho)
> end
> 
> 
> rolling rho=r(rho) n=r(n), window(15) ///
> 	saving(roll, replace): myforecast
> save pred, replace
> *****************************
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index