My question relates to the 'rollreg' routine available via ssc install.
I have panel data on which I wish to perform rolling regressions.
However, for consistency with prior research I want to use standard OLS
regressions as produced by "regress" rather than ivreg (or ivreg2). Here
is an example of problem.
. rollreg y x1 x2 if id == 1, move(5) stub(rr)
time variable not set, use -tsset varname ...-
r(111);
// It seems I must set the time variable.
. tsset id year
panel variable: id, 1 to 2
time variable: year, 1980 to 1994
. rollreg y x1 x2 if id == 1, move(5) stub(rr)
. list id year rr_cons if id == 1 & year == 1985
+----------------------+
| id year rr_cons |
|----------------------|
6. | 1 1985 29.03253 |
+----------------------+
// The constant is 29.03253 which differs from that for the ordinary OLS
// where _cons = 85.21505. What happens if I remove the if clause?
. drop rr*
. rollreg y x1 x2, move(5) stub(rr)
. list id year rr_cons if id == 1 & year == 1985
+----------------------+
| id year rr_cons |
|----------------------|
6. | 1 1985 29.03253 |
+----------------------+
// Same problem.
I am not very familiar with the use of regression in a time series
context. I am happy to accept that the results reported by rollreg are
"superior" because they take the temporal nature of the data into
account. However, is there a way I can force rollreg to generate the
same results as those generated by a simple "regress" command?