User’s Guide : Basic Data Analysis : Groups : Long-run Covariance
Long-run Covariance
Basic Options
Whitening Options
Kernel Options
Kernel Shape
Bandwidth Specification
You may compute estimates of the long-run covariance matrix of a group of series.
The discussion that follows assumes that you are familiar with the various issues and choices involved in computing a long-run covariance matrix. The technical description of the tools are given in Appendix F. “Long-run Covariance Estimation”
To compute the (possibly row-weighted) long-run covariance matrix of the series in a group, open the Group object and select View/Long-run Covariance... from the toolbar or main menu. If you wish to compute the results for a particular sample, you should set the workfile sample accordingly.
By default, EViews will estimate the symmetric long-run covariance matrix using a non-parametric kernel estimator with a Bartlett kernel and a real-valued bandwidth determined solely using the number of observations. The data will be centered (by subtracting off means) prior to computing the kernel covariance estimator, but no other pre-whitening will be performed. The results will only be displayed in the series or group window.
You may use the dialog to change these settings. The dialog (here we show the dialog for a group object) is divided into three sections. The Basic options section is used to describe the covariance that you wish to compute and to specify an output matrix, if desired. The Whitening options section is used to define pre-whitening or VARHAC options. The Kernel options section describes the non-parametric kernel settings.
Basic Options
You may instruct EViews to compute a one-sided covariance by changing the Window dropdown from the Symmetric default to one of Lower (lags), Strict lower (lags), Upper (leads), Strict upper (leads). The “lower” methods only use covariances in which the rows correspond to contemporaneous values and the columns correspond to current and lagged data; the “upper” methods employ covariances where the columns correspond to current values and leads of the data. The “strict” long-run covariances exclude the contemporaneous covariance from the computation.
You may use the Remove means checkbox to indicate whether you wish to subtract off means (center your data) prior to computing the kernel covariance estimator. By default, EViews will remove the mean from each series in the group. To compute an uncentered long-run covariance, you should uncheck this box. If you do elect to center the data, you will be prompted for whether the covariance estimates should employ a d.f. Adjustment that accounts for the estimation of the mean values.
In addition, you may provide weights by entering a series expression in the Row weights edit field. Row weights are a convenient way of instructing EViews to compute the long-run covariance on data where the series in the group are weighted by a common element. A leading application occurs in the computation of White or Newey-West regression coefficient covariances, where the group contains the regressor data and the weights are the residuals. For example, if you have the regressors series X1, X2, and X3 in your group, and the residuals are in the series RES, entering “RES” in the Row weights edit field instructs EViews to compute the long-run covariance of “X1*RES”, “X2*RES”, “X3*RES”.
Lastly, you may elect to save your results in an EViews object. Simply enter a valid EViews object name in the Output matrix edit field. EViews will save symmetric long-run covariances in a sym object and one-sided covariances in a matrix object.
In panel workfiles, EViews will compute the Phillips and Moon (1999) long-run average covariance matrix obtained by averaging the long-run covariances across cross-sections. You may provide a name in the Panel matrix edit field to EViews to save a matrix containing the individual covariance estimates. Each row will contain the vec or vech of the results matrix for the corresponding cross-section.
Whitening Options
The Whitening options section is used to define options for computing the VAR used in computing VARHAC or pre-whitened kernel estimation.
By default, EViews does not whiten the data before computing the long-run covariance. To enable whitening, you should change the lag specification dropdown menu from None to one of Fixed, Auto - AIC, Auto - Schwarz, or Auto - Hannan-Quinn.
If you specify one of the automatic methods (Auto - AIC, Auto - Schwarz, Auto - Hannan-Quinn), you must specify the maximum number of lags in the Maximum lags edit field. You may provide the actual maximum value, or you may enter “*” to instruct EViews to use an observation-based maximum given by the integer portion of as suggested by Den Haan and Levin (1997).
If you specify a Fixed lag specification, you should enter the value in the Number of lags edit field.
Kernel Options
The Kernel options section is used to define settings for estimation of the long-run covariance of the original or pre-whitened data.
Kernel Shape
The Kernel dropdown is used to define the method for computing the long-run covariance. Choosing None tells EViews to compute the long-run covariance using only the contemporaneous covariance. (The VARHAC methodology, for example, uses a combination of pre-whitening and the None setting.) The remaining choices specify the shape of the kernel function. There are a large number of pre-defined kernel shapes from which you may choose, as well as the option to provide the name of a User-specified custom kernel shape vector.
If you choose to use a user-specified kernel, EViews will prompt you for the name of a vector object containing the kernel weights. The vector should contain the weights for the (auto)covariances for lags from 0 to the lag truncation value. For example, to specify user-weights that match a Bartlett kernel with bandwidth value of 4.0, you should provide a vector of length 4 with values (1.0, 0.75, 0.5, 0.25) or equivalently a vector of length 5 with values (1.0, 0.75, 0.5, 0.25, 0.0).
Bandwidth Specification
If you elect to use one of the pre-defined kernel shapes, EViews will prompt you to provide bandwidth information. By default, the kernel bandwidth is determined by the arbitrary observation-based Newey-West Fixed bandwidth rule. You may override the default choice by selecting either the Andrews Automatic, Newey-West Automatic settings for automatic optimal bandwidth selection, or the User-specified setting if you wish to provide a bandwidth value.
The Newey-West Automatic bandwidth selection method requires specification of a Lag selection parameter. You may enter a value for the number of lags in the edit field, or you may specify “*” to use an observation-based value given by the integer portion of where depends on the properties of the selected kernel shape as given in “Kernel Function Properties” (see “Newey-West Automatic Selection” and Newey-West (1994) for discussion).
Both the Newey-West Automatic and the Andrews Automatic bandwidth selection methods allow you to adjust the chosen bandwidth by an offset, by entering a value in the Offset edit field. By default the offset is set to zero, which implies no adjustment will take place, however you may enter any positive or negative number to make an adjustment. This can be useful when trying to align the result given by EViews with results which use a different interpretation of the bandwidth. In such cases the most common required offset is a value of “1”.
The User-specified bandwidth selection requires that you provide a bandwidth value. Simply enter the value as prompted in the Bandwidth value edit field.
Lastly, EViews does not restrict bandwidth values to be integers. Notably, the bandwidths obtained from the Newey-West fixed and the Andrews and Newey-West automatic methods are likely to be real valued. You may instruct EViews to use the integer portions of these bandwidths by checking the Truncate to integer checkbox.
To illustrate the use of the long-run covariance view of a group, we employ the HAC covariance matrix example taken from Stock and Watson (2007, p. 620, Column 1). In this example Stock and Watson estimate the dynamic effect of cold weather on the price of orange juice by regressing the percent change in prices on a distributed lag of the number of freezing degree days and a constant, and obtain a HAC estimator for the coefficient covariance matrix using a Bartlett kernel estimator with lag truncation of 7. While the HAC covariances may be obtained directly from the EViews equation object (see “HAC Consistent Covariances (Newey-West)” ), here we will estimate the long-run covariance estimate of manually using the group long-run covariance view, and will use this estimate to derive the HAC coefficient covariance matrix.
First, open the workfile “STOCK WAT.WF1” and the program “STOCK_WATSON_HAC.PRG” and run the program on the workfile. In the results, notice that we have the equation object EQ_OLS which contains an estimated OLS equation (with conventional coefficient covariance and standard errors), and the group object XVARS which contains the regressors for the equation. We wish to compute the HAC coefficient covariance associated with the coefficient estimates in EQ_OLS using the group XVARS.
First, we need to obtain the residuals. Open EQ_OLS and click on Proc/Make Residual Series to display the Make Residuals dialog. Enter “RES” for the name of the residuals, then click on OK to save the regression residuals in the workfile.
Next, we will compute the symmetric long-run covariance of . Double click on XVARS to open the group containing the regressors, then select View/Long-run Covariance... to display the dialog.
We must make a few changes to the default settings. To weight the regressors using the residuals, you must enter “RES” in the Row weights edit field. Uncheck the Remove means checkbox, since the should already have mean zero. Then, enter “LRCOV” in the Output matrix edit fields so that EViews will save the results in a sym matrix object.
The Stock-Watson example uses a Bartlett kernel with no pre-whitening, so we leave the Lag spec at the default None setting and the Kernel shape choice at the default Bartlett. We should, however, change the Bandwidth method to User-specified and enter “8” in the edit field to match the 7 lags employed by Stock and Watson. Click on OK to compute and save the results.
The long-run covariance estimates are displayed in the group window and saved in the LRCOV matrix in the workfile. To obtain the d.f. corrected HAC coefficient covariances (see, for example, Hamilton (1994, p. 282)), we issue the commands:
sym xxinv = @inverse(@inner(xvars))
scalar obs = eq_ols.@regobs
scalar df = eq_ols.@regobs - eq_ols.@ncoef
sym hac_direct = (obs / df) * obs * xxinv * lrcov * xxinv
The first line computes . The next two lines get the number of observations and the number of degrees-of-freedom. The last line computes the d.f. corrected sandwich estimator using the long-run covariance in LRCOV as the estimator of .
You may wish to verify that the estimate HAC_DIRECT matches the coefficient covariance matrix obtained using equation EQ_HAC (also provided in the workfile) estimated using the same HAC settings:
equation, covbw=8) 100*dlog(poj) xvars
sym hac_eq = eq_hac.@coefcov