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

st: Re: question about stata and rolling regressions

From   Kit Baum <>
Subject   st: Re: question about stata and rolling regressions
Date   Wed, 18 Jul 2007 16:22:02 -0400

The current design of -rollreg-, as you probably know, leaves behind timeseries of coefficient estimates and of their standard errors. It does not leave behind the full VCE from each regression. That full VCE (in particular the off-diagonal elements) would be needed to do any test on multiple coefficients such as lincom provides.

As far as I can see the official Stata rolling: prefix will not do this either if the command is regress. You can save _b and _se, but not matrices (matrix operators that return matrices not allowed in this context; error in expression: e(V)).

To circumvent this with rolling: you need to write a 'wrapper' program for regress and lincom, such as

program myregress, rclass
version 9.2
syntax varlist(ts) [if]
regress `varlist' `if'
lincom L.wpi+L2.wpi+L3.wpi+L4.wpi
return scalar sum=`r(estimate)'
return scalar se=`r(se)'

and then execute it with

webuse wpi1,clear
rolling sum=r(sum) se=r(se) ,window(30) saving(bethany,replace) : myregress wpi L(1/4).wpi t

The resulting file (bethany.dta) will contain the lincom estimates and their standard errors for each period.


Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

On Jul 18, 2007, at 11:30 AM, wrote:

I have been using your stata program to run rolling regressions. My empiricial model has four lags of the dependent variable and I am interested in the sum of the coefficients and the standard error of this sum. Is there a command to have your program generate the time series of this standard error? I know that the command "lincom" does this in the base stata program. Can this command be used within your program?

Thanks for your time.

Bethany Tinlin
Research Department
Federal Reserve Bank of Cleveland
P.O. Box 6387
Cleveland, OH 44101-1387
Phone: (216) 579-2059
Fax: (216) 579-3050
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index