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: Cycling Through Regressions and Storing Residuals
From
"FINERTY A.J.J." <[email protected]>
To
<[email protected]>
Subject
st: Cycling Through Regressions and Storing Residuals
Date
Wed, 13 Feb 2013 21:42:55 -0000
Dear Statalist members,
I am new to Stata (and Statalist), so please accept my apologies if this
question lacks the finesse of one posed by a more seasoned user.
I have panel (longitudinal) data on three variables (not that it's
relevant, but the variables are output, general government consumption
and general government investment). Each of these variables is observed
over 21 countries and a maximum of 99 time periods.
For each country, I want to de-trend each variable quadratically, i.e. I
want to find the residuals of the regression for each country (denoted
by the variable id, ranging from 1 to 21) of e.g. output on time and
time^2.
I'm sure that this must be a common sort of thing to want to do and that
there's some way to implement a foreach loop, but I can't work out what
it is.
One potential complication is that the data are unbalanced; output,
consumption and investment data are not available for every country in
every time period.
I would be most grateful if anyone could help.
Best wishes,
Alistair Finerty.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/