Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Cycling Through Regressions and Storing Residuals

From   "FINERTY A.J.J." <>
To   <>
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

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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index