Statalist The Stata Listserver


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

st: rolling prais regression in paneld dataset


From   ocg2001@columbia.edu
To   statalist@hsphsun2.harvard.edu
Subject   st: rolling prais regression in paneld dataset
Date   Sun, 16 Jul 2006 12:59:47 -0400

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


Olga Gorbachev Melloni
Economics Ph.D. Student
Columbia University
www.columbia.edu/~ocg2001



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