# harreg

This is a Stata module written by Eben Lazarus and Daniel J. Lewis for HAR (heteroskedasticity- and autocorrelation-robust) inference in time-series regression using fixed-*b* asymptotics. It will be uploaded to and available on Github/SSC but is provided here as well. The JF replication code requires the use of only harreg.ado and underlying utilities, but all files are provided here. Note that only the orthonormal series code (as used in the JF paper) has been tested thoroughly, and the remaining code is an alpha version that may contain bugs. Please see the SSC archive or Github (when available) for a production version.

## Description

**harreg** fits a time-series regression by OLS and reports HAR standard errors based on fixed-*b* asymptotics, as recommended by Lazarus, Lewis, Stock, and Watson (2018) and Lazarus, Lewis, and Stock (2021).

**harwald** performs HAR Wald tests after `harreg` estimation, including tests of linear combinations of coefficients.

Supported LRV estimators:
- **EWC** (equal-weighted cosine) — default, recommended
- **EWP** (equal-weighted periodogram)
- **NW** (Newey-West/Bartlett)
- **QS** (quadratic spectral)

## Installation

**From SSC Archive:**
```stata
ssc install harreg, replace
```

**From GitHub:**
```stata
net install harreg, replace from(https://raw.githubusercontent.com/ebenlazarus/harreg/main/)
```

Requires Stata 14 or newer.

## Examples

```stata
webuse lutkepohl2
tsset

harreg dln_inv dln_inc dln_consump                          // EWC (default)
harreg dln_inv dln_inc dln_consump, estimator(nw) lags(8)   // Newey-West

harwald                                // joint test of all slope coefficients
harwald (dln_inc + dln_consump - 1)    // test if sum equals 1
```

## References

Lazarus, E., D. J. Lewis, J. H. Stock, and M. W. Watson. 2018. HAR inference: Recommendations for practice. *Journal of Business & Economic Statistics* 36: 541–559.

Lazarus, E., D. J. Lewis, and J. H. Stock. 2021. The size-power tradeoff in HAR inference. *Econometrica* 89: 2497–2516.

## Authors

Eben Lazarus, UC Berkeley (lazarus@berkeley.edu)

Daniel J. Lewis, University College London (daniel.j.lewis@ucl.ac.uk)
