Statalist The Stata Listserver


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

Re: st: RE: rolling prais regression in paneld dataset


From   [email protected]
To   [email protected]
Subject   Re: st: RE: rolling prais regression in paneld dataset
Date   Sun, 16 Jul 2006 13:40:50 -0400

By "doesn't seem to work well" I mean:

When I tested the code on balanced panel with individuals with 30
years of data each, rho was saved for all the regressions for each
individual in the separate file (roll.dta) but what happened is
residuals and predicted values were computed for the first
individual for most years only, it put missing values for some
years(though data for both dependent and independent vars existed
for all these years). I then have data for residuals and predicted
values for those missing years only for the next individual with
data, and for the rest of the sample it gave me missing values.

Another "red flag" is that for the first year of data in the sample,
1969, it gives values for all individuals for the entire sample size
(data for each year for each person), even though it provides no
data for predicted values or residuals for all the individuals
except for the first two as explained above.

I hope this clarifies it, and thank you again.



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


Quoting Nick Cox <[email protected]>:

> To make this more scrutable, so to speak, please
> spell out "doesn't seem to work well".
>
> Nick
> [email protected]
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]]On Behalf Of
> > [email protected]
> > Sent: 16 July 2006 18:00
> > To: [email protected]
> > 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/
>
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index