# 13. Time series: corrections, heteroskedasticity and responses

Choose a time-series uncertainty method and estimate a response at a named horizon.

## Core lesson

### 01. Choose between revising the mean, estimator and covariance

The residual diagnostics have shown why an ordered sample needs more than an independent-observation uncertainty formula. We now compare three responses: add justified dynamics to the conditional mean, specify and estimate an error process, or keep the coefficient calculation and estimate a dependence-aware covariance.

The continuing monthly traffic application and the constructed quarterly response example make these choices concrete. Each method needs exogeneity and approximation conditions appropriate to its task. A corrected standard error does not repair an omitted cause, and a fitted error process does not establish a policy experiment.

Revise the conditional mean when the economic model needs additional dynamics.

Compare model-based error transformations with HAC covariance under their stated assumptions.

### 02. Use HAC to account for unequal spread and time dependence

Newey–West keeps the OLS coefficients and changes their estimated uncertainty.

Recall how a district slope uses the part of its regressor left after adjusting for controls. For a monthly slope, call that remainder r X at date t. Let a at t be r X times the fitted error at that date. These products record the contribution of each date to uncertainty about the slope.

In a sample with dependent months, we add cross-date products as well as the same-date squares. Newey–West adds pairs up to a chosen lag and gives smaller weights to more distant pairs. At lag four, the weights for gaps one through four are 0.8, 0.6, 0.4 and 0.2. Divide by the square of the total squared regressor remainders to put the result in slope-variance units. The displayed expression omits a finite-sample scaling factor.

H A C stands for heteroskedasticity and autocorrelation consistent. A justified approximation needs a suitable time-series model and dependence conditions. The lag choice should reflect the frequency, expected dependence and available sample. The fitted regression and its coefficient stay fixed when we change only the covariance calculation.

\(a_t=rX_t\widehat u_t\), where \(rX_t\) is the regressor remainder after the other inputs.

\(w_h=1-h/(L+1)\) for \(h=1,\ldots,L\). For \(L=4\): \(0.8,0.6,0.4,0.2\).

Variance estimate: \(\dfrac{\sum_t a_t^2+2\sum_{h=1}^L w_h\sum_{t=h+1}^T a_ta_{t-h}}{(\sum_t rX_t^2)^2}\).

### 03. Predictable error variance is different from a predictable error mean

ARCH describes volatility clustering, not necessarily directional error predictability.

A large error yesterday might tell us to expect a larger spread today. It may still tell us nothing about whether today's error will be positive or negative. In the displayed A R C H model, the mean given past information is zero. The variance depends on the previous squared error. A R C H stands for autoregressive conditional heteroskedasticity.

To check that pattern, regress squared fitted residuals on an intercept and lagged squared residuals. With one lag, the null sets alpha one to zero. The actual statistic is about 0.350 and the p-value about 0.554. Under the reference conditions, the data do not give strong evidence for that particular variance pattern. Other forms of changing variance and other threats to the comparison require their own evidence.

\(E[u_t\mid I_{t-1}]=0\), \(E[u_t^2\mid I_{t-1}]=\alpha_0+\alpha_1u_{t-1}^2\), \(\alpha_0>0,\alpha_1\ge0\).

Conventional diagnostic: regress residual squares on a constant and their selected lags.

Actual monthly diagnostic: \(\chi_1^2\approx0.350\), \(p\approx0.554\).

```text
. estat archlm, lags(1)
LM test for autoregressive conditional heteroskedasticity (ARCH)
---------------------------------------------------------------------------
    lags(p)  |          chi2               df                 Prob > chi2
-------------+-------------------------------------------------------------
       1     |          0.350               1                   0.5540
---------------------------------------------------------------------------
         H0: no ARCH effects      vs.  H1: ARCH(p) disturbance
```

### 04. Run the conventional regression

Find the law coefficient and understand the labels before comparing SEs.

Check the date variable first. The command tsset tells Stata to use the monthly index. This matters when we later ask for lags. The outcome logacc is the log of total accidents. This regression also uses the trend, calendar months, the two law indicators, unemployment and the weekend count.

Find beltlaw in the output. Its coefficient is about 0.09545 and its conventional standard error is 0.01424. The constant is the intercept. Calendar-month coefficients compare each month to January. Their rows are in the full output download.

The t column compares a coefficient with zero in standard-error units. The p-value and confidence interval use the conventional uncertainty calculation. Keep the law coefficient and its standard error in view when we rerun the same equation with robust inference.

```text
. regress logacc trend i.month unem spdlaw beltlaw wkends

------------------------------------------------------------------------------
      logacc | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       trend |   .0011011   .0002579     4.27   0.000     .0005889    .0016133
             |
        unem |  -.0212173   .0033974    -6.25   0.000    -.0279659   -.0144688
      spdlaw |  -.0537593   .0126036    -4.27   0.000    -.0787948   -.0287238
     beltlaw |   .0954526    .014235     6.71   0.000     .0671765    .1237288
      wkends |   .0033333   .0037761     0.88   0.380    -.0041675    .0108342
       _cons |   10.63986   .0630859   168.66   0.000     10.51455    10.76518
------------------------------------------------------------------------------
```

### 05. Run heteroskedasticity-robust inference

vce(robust) allows unequal error variance, while preserving the OLS coefficients.

The next command adds vce(robust) to the same regression. This requests heteroskedasticity-robust SEs, the unequal-variance adjustment discussed earlier. The law coefficient remains about 0.09545, while its SE changes from about 0.01424 to 0.01237. The do-file checks that the coefficient is unchanged, so we are comparing uncertainty methods for the same fitted relationship.

Why can the line stay while the SE moves? OLS still minimises the same sum of squared residuals on the same observations. The robust option changes how we estimate variation in the resulting coefficient. It allows unequal error variance, but does not generally include the cross-month covariance terms we studied in the averaging example.

In this dataset the robust SE is smaller, not larger. That fact alone does not show whether it is the suitable method. The question is which error patterns the calculation allows and whether those conditions describe this application. Since the residual evidence suggests dependence across months, we will next allow those cross-date contributions using Newey–West.

```text
. regress logacc trend i.month unem spdlaw beltlaw wkends, vce(robust)

------------------------------------------------------------------------------
             |               Robust
      logacc | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       trend |   .0011011   .0002676     4.12   0.000     .0005696    .0016326
             |
        unem |  -.0212173   .0038238    -5.55   0.000    -.0288128   -.0136218
      spdlaw |  -.0537593   .0120059    -4.48   0.000    -.0776076    -.029911
     beltlaw |   .0954526   .0123682     7.72   0.000     .0708847    .1200206
      wkends |   .0033333   .0039443     0.85   0.400    -.0045016    .0111682
       _cons |   10.63986   .0681238   156.18   0.000     10.50454    10.77518
------------------------------------------------------------------------------
```

### 06. Run Newey–West on the same model

newey with lag(4) allows covariance contributions through four months.

Run newey on the same 108 months with the same outcome and regressors. In the lag option, four means that the covariance calculation uses pairs of months up to four months apart. The mean equation has the same predictors.

Read the seat-belt law row. The coefficient remains about 0.09545. The Newey–West standard error is about 0.01890, compared with 0.01237 from the unequal-variance-only calculation. The estimated relationship stayed fixed while the estimated uncertainty changed.

Explain why you chose the window in your own analysis. Ask how long shocks can last and whether there are enough observations for the selected range. Here four lags make the comparison concrete. Next we translate the coefficient and its uncertainty into percent units.

```text
. newey logacc trend i.month unem spdlaw beltlaw wkends, lag(4)

------------------------------------------------------------------------------
             |             Newey–West
      logacc | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       trend |   .0011011   .0003897     2.83   0.006      .000327    .0018752
             |
        unem |  -.0212173   .0051302    -4.14   0.000    -.0314079   -.0110268
      spdlaw |  -.0537593   .0170449    -3.15   0.002    -.0876169   -.0199018
     beltlaw |   .0954526   .0188985     5.05   0.000     .0579131    .1329922
      wkends |   .0033333   .0028746     1.16   0.249    -.0023768    .0090434
       _cons |   10.63986   .0635823   167.34   0.000     10.51356    10.76616
------------------------------------------------------------------------------
```

### 07. Convert the fitted log difference into percent

Use 100[exp(b)−1] for the exact contrast between exponentiated fitted values.

Start with the belt-law coefficient, about 0.09545 on the log scale. Take its exponential, subtract one, then multiply by one hundred. The fitted contrast is about 10.02 percent between the exponentiated fits.

The second line gives the local slope of that transformation. It is one hundred times the exponential of b, about 110.02 at our estimate. If b moves by 0.01 near this point, the percentage contrast moves by about 1.10 percentage units.

Multiply the local slope by the Newey–West standard error of about 0.01890. The transformed standard error is about 2.08 percentage units. This is the delta method, a local approximation that passes uncertainty through a function. Stata's nlcom uses the fitted covariance to make this calculation. If you want a contrast between arithmetic mean accidents, also check the retransformation factors from the log-model lesson.

\(g(b)=100\{\exp(b)-1\}\)

\(g\,\!^{\prime}(b)=100\exp(b)\approx110.02\)

\(SE\{g(\widehat b)\}\approx|g\,\!^{\prime}(\widehat b)|SE(\widehat b)\approx2.08\) percentage units

```text
. nlcom 100*(exp(_b[beltlaw])-1)

------------------------------------------------------------------------------
      logacc | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
       _nl_1 |   10.01567    2.07913     4.82   0.000     5.940653    14.09069
------------------------------------------------------------------------------
```

### 08. Which change addresses the problem we found?

Compare improving dynamics, changing an error model and estimating a future response.

The serial-correlation lesson left two tasks: check whether the conditional mean uses relevant past information, and estimate uncertainty for dependence that remains. In this second part, we compare actual dynamic and Prais–Winsten accident fits, then apply the same reasoning to future inflation responses.

The quarterly inflation example is a controlled simulation with a known shock and known population response. Its Stata output is real software output from generated data, not an empirical estimate for a country. Knowing the truth lets us see how finite samples and horizon choices affect reported response paths without pretending that a regression identifies a real macroeconomic shock by itself.

### 09. Transform a serial-error equation step by step

Subtracting the error carry-over also transforms the regressors.

Suppose the outcome equation is Y at t equal to an intercept a plus beta times X at t plus u at t. Model the error as rho times the previous error plus a new mean-zero innovation. For a later observation, subtract rho times the entire previous outcome equation from the current equation. The new error is u at t minus rho times the previous u, which equals the innovation.

The left side becomes current Y minus rho times previous Y. The regressor becomes current X minus rho times previous X, and the intercept becomes a times one minus rho. Transforming only the outcome would leave a different model. If the error process and exogeneity assumptions are appropriate, this transformed equation removes that particular error carry-over and can use information more efficiently.

\(Y_t=a+\beta X_t+u_t,\quad u_t=\rho u_{t-1}+\varepsilon_t\)

\(Y_t-\rho Y_{t-1}=a(1-\rho)+\beta(X_t-\rho X_{t-1})+\varepsilon_t\)

### 10. Make the transformation feasible

Prais–Winsten estimates the carry-over and retains the first observation.

The carry-over rho is usually unknown. Prais–Winsten estimates it from the fitted error pattern and uses that estimate to transform the outcome and every regressor. With rho equal to 0.5, an outcome pair of ten followed by twelve gives a transformed later outcome of twelve minus five, or seven. A regressor pair of two followed by three becomes three minus one, or two. The intercept column becomes one half.

For stationary AR(1) errors with absolute rho below one, the first observation has a different variance from the transformed later innovations. Prais–Winsten retains it with a square-root-of-one-minus-rho-squared weight. The method therefore uses a structured error model and can change coefficients as well as standard errors. Its potential precision gain depends on that structure and the exogeneity assumptions being credible; it is not interchangeable with retaining OLS and using HAC.

For \(\rho=0.5\): \(12-0.5(10)=7\), \(3-0.5(2)=2\)

First-observation weight: \(\sqrt{1-\rho^2}\)

Estimate rho, transform all columns, and fit the transformed equation.

### 11. Prais–Winsten models an AR(1) error process

Its additional structure can change the fit.

Prais–Winsten estimates an AR(1) carry-over in the errors and transforms the regression accordingly, including a special first-observation adjustment. In the original accident equation, its law coefficient is 0.101 with SE 0.020. It is not required to equal the OLS coefficient.

The potential efficiency benefit depends on the error model and appropriate regressor assumptions. If that structure is not credible, the resulting precision claim may be misleading. Compare this with HAC, which addresses selected covariance contributions without imposing exactly this AR(1) transformation. A method is useful when its assumptions fit the problem, not because its name contains correction.

```text
. prais logacc trend i.month unem spdlaw beltlaw wkends

------------------------------------------------------------------------------
      logacc | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       trend |   .0009183    .000368     2.50   0.014     .0001874    .0016493
             |
        unem |   -.019975   .0047144    -4.24   0.000    -.0293397   -.0106104
      spdlaw |   -.045256   .0179614    -2.52   0.013     -.080934   -.0095779
     beltlaw |   .1008944   .0201055     5.02   0.000     .0609572    .1408315
      wkends |   .0042874   .0028062     1.53   0.130    -.0012867    .0098615
       _cons |   10.61796   .0628171   169.03   0.000     10.49318    10.74274
-------------+----------------------------------------------------------------
```

### 12. Specify the known quarterly data-generating rule

A stable process gives a transparent response benchmark.

Change applications explicitly: we now use a constructed quarterly inflation experiment, not the historical accident data. Pi denotes inflation. Its rule is 0.6 times last quarter's inflation plus 0.8 times the current shock s plus a separate innovation epsilon. The shock and innovation draws are independent across dates and of each other in this experiment.

Define the intervention as increasing the current s by one while holding all other external draws and the previous inflation value fixed. The inflation mechanism is then allowed to carry the change forward. Inflation rises by 0.8 immediately, 0.48 next quarter and 0.288 the quarter after. At horizon h, measured in quarters after the initial date, the known response is 0.8 times 0.6 to power h. This response is known because we specified the causal mechanism and its inputs; it is not a fitted historical policy effect.

\(\pi_t=0.6\pi_{t-1}+0.8s_t+\varepsilon_t\)

Hold other external draws fixed; allow inflation to propagate.

Known intervention response: \(0.8(0.6)^h\)

### 13. A local projection asks about a specified future outcome

Define the shock and horizon before the coefficient.

Fix a starting quarter t. At horizon zero, regress that quarter's inflation on its shock and on inflation from the previous quarter. At horizon four, change the outcome to inflation four quarters later. Keep the shock and previous inflation tied to the same starting quarter.

Read b sub h in the equation. It is the fitted inflation difference h quarters ahead for one additional unit of the starting shock, holding the stated earlier information fixed. A sub h is the horizon's intercept and c sub h multiplies previous inflation. Each horizon has its own error because the outcome date changes.

In this simulation the shock is independent of the other innovations, so we can compare the fitted response with the known one. With observed data, explain why the measured shock and chosen controls give a credible comparison.

\(\pi_{t+h}=a_h+b_hs_t+c_h\pi_{t-1}+u^{(h)}_{t+h}\)

\(h\): quarters ahead; \(b_h\): response per current shock unit.

### 14. The horizon coefficient has outcome-per-shock units

Do not confuse a future value with a cumulative sum.

At horizon four, the coefficient concerns inflation four quarters after the shock. It is not the sum of responses over the first four quarters. A cumulative response requires a separately defined sum, with uncertainty reflecting covariance among the estimated responses.

Write the economic sentence before calculating: a one-unit shock is associated with a fitted difference in the outcome at a specified future date, conditional on the included information. In the controlled simulation, the shock's independence supports the intended causal response. In a real application, that causal sentence needs a justified shock measure and appropriate controls.

At horizon four, the coefficient concerns inflation four quarters after the shock.

Write the economic sentence before calculating: a one-unit shock is associated with a fitted difference in the outcome at a specified future date, conditional on the included information.

### 15. Inspect the estimated path without forcing it to match the truth

Finite-sample response estimates can be noisy.

The plotted points and SEs come from the Stata regressions at horizons zero through eight. The line is the known simulation response. Estimates need not equal the line in any particular generated dataset, and an individual 95% interval need not contain its true value.

This is not a reason to select a different random seed after seeing an inconvenient result. The simulation helps us learn that sampling uncertainty remains even with a correctly identified constructed shock. At longer horizons, fewer usable observations and greater unexplained variation can make the path less precise. Report that uncertainty instead of drawing a smooth curve that hides the actual estimates.

### 16. Read the horizon-four output honestly

A negative sample estimate can coexist with a positive true response.

The estimated horizon-four coefficient in this generated sample is -0.178, with HAC SE 0.101. The known population response is 0.8 times 0.6 to the fourth power, about 0.104. This particular point estimate is quite different from that truth.

A confidence procedure has a repeated-sample coverage property, not a promise for each sample or every horizon simultaneously. The example is deliberately retained rather than edited to obtain a visually pleasing response. Use the difference to explain uncertainty, the limits of pointwise intervals, meaning intervals for individual horizons rather than for the whole path together, and the distinction between a known simulation population and an observed research setting.

```text
. newey F4.inflation shock L.inflation, lag(8)

------------------------------------------------------------------------------
             |             Newey–West
F4.inflation | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       shock |    -.17841   .1013114    -1.76   0.080    -.3780179    .0211979
             |
   inflation |
         L1. |   .0652363   .0710399     0.92   0.359    -.0747295    .2052021
             |
       _cons |  -.2784281   .1669179    -1.67   0.097    -.6072968    .0504406
------------------------------------------------------------------------------
```

### 17. Future-outcome errors can overlap across dates

A sensible mean model can still leave serial dependence.

Consider a two-period outcome sum. At starting date t, its error contains the shocks from t plus one and t plus two. Now move the starting date one period later. Its error contains the shocks from t plus two and t plus three.

Point to the shared term. Both contain the shock at t plus two. Even if all the underlying shocks are independent, these two errors move together because they contain the same shock. The example illustrates overlap. The exact error in the inflation regression depends on that regression and its horizon.

When you choose the covariance calculation, ask which dates can share shocks at the horizon you are studying. This dependence concerns uncertainty about the response. Whether the response identifies a causal effect is a separate question about the shock and controls.

Illustration: \(w_t=v_{t+1}+v_{t+2}\)

\(w_{t+1}=v_{t+2}+v_{t+3}\): shared \(v_{t+2}\)

### 18. Pointwise intervals do not cover an entire response path at the same rate

Multiple horizons change the inferential question.

A pointwise 95-percent interval is designed for one specified horizon considered by itself. Covering every point on a response path is a different event: every horizon's interval must succeed together. For illustration, if nine separate coverage events were independent and each had probability 0.95, their joint probability would be 0.95 to the ninth power, about 0.63.

Actual local-projection estimates across horizons are correlated, so 0.63 is not the coverage probability of this graph. The example shows why individual confidence levels do not automatically provide the same simultaneous confidence level. A claim about the whole path, a peak or a cumulative response needs an inference procedure for that joint quantity, using its covariance and an appropriate reference argument.

Pointwise coverage: one stated horizon.

Simultaneous coverage: the complete stated collection of horizons.

Illustration only, with independent events: \(0.95^9\approx0.63\).

### 19. Controlling a mechanism can change the response being studied

A current mediator is not just another lag control.

Consider a new causal story for observed inflation: a shock changes expectations, and expectations help determine future inflation. This expectations variable is not part of the small simulation's specified equation. We add it here to analyze a possible control choice. It is a mediator when it carries part of the shock's total effect.

Other news may also affect expectations and future inflation. Select expectations in the graph. Doing so blocks part of the shock's mechanism and can open a path through other news because expectations are a collider on that alternative route. A smaller adjusted shock coefficient would therefore not prove that its difference is a mediated effect. The intervention target, timing, support and mediator–outcome assumptions must be stated before interpreting the adjusted comparison.

New application: expectations mediate a shock and also respond to other news.

Post-shock controls can change the target and create selection.

### 20. Distinguish an estimated shock from a known innovation

Measurement and first-step uncertainty can matter.

In the simulation, the independent shock is observed exactly because we generated it. In applied macroeconomics, a shock may instead be inferred from a first regression, a statistical decomposition or a separate source of economic variation. An inferred shock contains estimation uncertainty and may mix the intended innovation with other economic news.

Putting that estimated series into a response regression is a two-step procedure. Inference must consider how the first-step estimation affects the response estimate, including dependence between the steps. A suitable joint method or a resampling procedure that repeats both estimation steps on appropriately redrawn histories depends on the actual construction and target. Before choosing one, explain what intervention the shock is meant to represent and why its variation is independent of omitted future-outcome causes. We develop the outside-instrument argument in Meeting 14.

Known simulated shock: observed by construction.

Estimated empirical shock: identification and first-step uncertainty need separate arguments.

### 21. Choose among the three changes using the application

The preferred response follows the diagnosed failure.

For omitted predictable dynamics, reconsider the conditional-mean equation and its timing assumptions. For a justified AR(1) error model, Prais–Winsten may offer a useful transformed estimator. For remaining weakly dependent errors under a valid coefficient model, HAC may provide an appropriate covariance estimate.

None automatically solves policy endogeneity or shock mismeasurement. Explain what changes in the coefficient target, sample and error assumptions. This gives a reader a reason to trust the method choice beyond a list of software options and keeps a technically correct calculation connected to its practical purpose.

For omitted predictable dynamics, reconsider the conditional-mean equation and its timing assumptions.

None automatically solves policy endogeneity or shock mismeasurement.

### 22. Compare a known response with a noisy estimate

Reproduce the evidence, then explain its economic meaning.

Run lab_12.do. In its explicitly constructed quarterly experiment, calculate the true response four quarters after a unit shock. Compare it with the actual horizon-four estimate and approximate interval. Explain what the discrepancy teaches about finite-sample estimates and why the experiment does not identify an observed historical supply shock.

Then use actual traffic.csv. Add one lag of log accidents to the monthly mean model, retain the calendar and policy controls, and use four-month HAC inference. Report the law coefficient and the stable-model long-run contrast. Explain why this observed application has no known historical causal truth supplied by the simulation. Write and run your own commands, then save the code, execution log and an explanation in your own words. The independent practice file is a worked reference.

**Practice:** Then use actual traffic.csv. Add one lag of log accidents to the monthly mean model, retain the calendar and policy controls, and use four-month HAC inference. Report the law coefficient and the stable-model long-run contrast. Explain why this observed application has no known historical causal truth supplied by the simulation. Keep your commands, log, output and interpretation.

### 23. Compare a known response with a noisy estimate: explanation

A reproducible result needs both a calculation and an interpretation.

The known response is 0.8 times 0.6 to the fourth power, or 0.10368. The estimated horizon-four coefficient is -0.178410, with SE 0.101311. Its approximate 1.96 interval is [-0.3770, 0.0202]. This particular interval misses the true positive response.

A coverage statement concerns repeated samples, so a particular estimated response can have the wrong sign and a particular interval can miss the truth. The displayed result has not been replaced with its theoretical target. The independent shock is known by construction in this experiment. Observed macroeconomic work still needs a credible shock measure, appropriate dated controls and justified inference.

The real-data dynamic fit uses 107 months: the lag coefficient is 0.332658 and the law impact coefficient is 0.065212. The model-implied long-run log contrast is 0.097719 (approximate delta-method SE 0.019357). It assumes stability and a defensible exogenous permanent input change. HAC does not repair endogeneity from an invalid lagged-outcome specification.

Constructed quarterly response: known truth and realised estimate differ.

Real monthly fit: lag coefficient \(0.332658\); law impact \(0.065212\).

Stable-model long-run log contrast \(0.097719\), approximate SE \(0.019357\).

### 24. From time-series methods to repeated units and instruments

We have distinguished three responses to a time-series problem: revise the conditional mean, model the error process for estimation, or preserve the coefficient calculation and revise its covariance estimate. Horizon regressions use the same distinctions when outcomes overlap across dates.

The next meeting adds repeated units and instruments. Panel transformations remove specified stable factors, while an instrument proposes a different source of regressor variation. Each method brings its own identifying conditions.

From time-series methods to repeated units and instruments

## Appendix

Further examples, practice and technical derivations for study after the core lesson.

### 25. HAC estimates covariance of regressor-error scores across dates

Autocorrelation of errors and covariance of the coefficient estimates are connected by the regressors.

For a time-series regression, define the regressor-error product vector s t as the regressor vector x t multiplied by the model error u t. The long-run covariance sums covariance of these vectors across all date separations, when that sum and the required limit approximation are well defined. With Q equal to the limiting regressor second moment, the coefficient covariance is approximately Q inverse times this long-run covariance times Q inverse, divided by T.

A Newey–West estimate uses fitted residuals, a finite lag window and weights that taper with lag distance. Here bandwidth means the number of lagged cross-products kept in that window. Its consistency requires suitable exogeneity, moments, dependence and bandwidth conditions. Changing the lag choice changes which empirical cross-date products contribute. It does not remove an omitted cause or automatically guarantee accurate inference in a short persistent sample.

\(s_t=x_tu_t\), \(S=\sum_{h=-\infty}^{\infty}E[s_ts_{t-h}\prime]\), when the sum and limits are justified.

Approximate coefficient covariance: \(Q^{-1}SQ^{-1}/T\).

Newey–West estimates a weighted, truncated version using fitted residuals.

### 26. Interpret the lag in calendar time

Interpret the selected maximum lag using months or quarters.

Our maximum lag L must be interpreted using the data frequency, meaning how often we observe the series. These observations are monthly, so lag(4) allows covariance contributions through four months. In quarterly data, one observation covers three months; the same lag option would reach four quarters, or one year.

This maximum lag is also called a bandwidth in this setting. It controls how far apart two observations can be and still contribute directly to the estimated covariance. It does not add lagged accidents, lagged policy variables or more seasonal controls to the regression equation. Adding those variables would change the mean model; selecting this window changes the uncertainty calculation.

Move L in the graph and watch which weights remain positive. A larger window includes more estimated covariance contributions, but it does not guarantee a larger or better SE. Those extra terms can add noise, and their values can have different signs. The graph changes the taper weights only; it does not rerun Stata. To compare actual SEs for several windows, we would run the same regression with each stated lag choice and explain why those windows are plausible for the application.

\(w_k=1-\dfrac{k}{L+1},\quad k=0,\ldots,L\)

Bartlett weights taper the contribution of later error covariances.

**Practice:** For quarterly data, what calendar window is lag(12)? Does that option add twelve regressors?

**Explanation:** It reaches twelve quarters, or three years. It adjusts the covariance calculation; it adds no conditional-mean regressors.

### 27. What stays fixed in the three fits?

Hold the fitted model fixed and compare its three SE calculations.

We are now ready to compare the three SE methods in the actual accident regression. The outcome, regressors and 108 observations are identical in all three fits. Conventional, heteroskedasticity-robust and Newey–West calculations therefore report the same OLS law coefficient. The different bars show different estimated uncertainty, rather than three different estimated policy relationships.

Each bar is an approximate 95% confidence interval calculated as the estimate plus or minus 1.96 SEs. A confidence interval comes from a procedure designed to cover the population coefficient at its stated rate across comparable datasets. The multiplier 1.96 uses a normal reference distribution, the familiar bell-shaped pattern that gives a large-sample approximation under suitable conditions. Stata's tables use their own stated reference rule, so their interval endpoints differ slightly from this graph.

Notice that the robust SE is smaller than the conventional SE, while the HAC4 SE is larger. HAC4 means Newey–West with a maximum of four lags. There is no rule that a robust SE must always increase. We should choose a method because its assumptions match the dependence in the application, not because it gives the widest interval or the preferred test result. With that distinction clear, we can ask which problems this adjustment still leaves unresolved.

### 28. Calculate, then explain the comparison

Calculate the test and interval, then report what they describe.

Use the three SEs to calculate the t ratio for a zero-coefficient null. The coefficient is the same each time, so divide about 0.09545 by each SE. The results are approximately 6.71 with conventional SEs, 7.72 with robust SEs and 5.05 with HAC4. Different uncertainty calculations change how far the estimate lies from zero in SE units.

Using the normal large-sample rule, an absolute ratio above about 1.96 rejects a zero null at the two-sided 5% level. All three ratios pass that threshold here. Yet they do not express the same amount of uncertainty. With the HAC4 SE, the approximate 95% interval is 0.09545±1.96×0.01890, or about [0.05841, 0.13249]. These endpoints are in log-outcome coefficient units, not percent.

Write the result as part of an empirical report. State that the data are monthly, describe the fitted law association, give the uncertainty method and name its four-month window. Then state the main condition that the report has not established, such as the absence of unmeasured changes related to policy timing. A precise report explains both the number and the comparison behind it.

**Practice:** Use b=0.09545264 and HAC4 SE=0.01889849 to calculate the approximate t ratio and 95% interval for b.

**Explanation:** t≈5.05. The large-sample interval is 0.09545264±1.96×0.01889849≈[0.05841, 0.13249], on the log-outcome coefficient scale. This is uncertainty about the fitted coefficient under the inference assumptions; it is not automatically an interval for a causal law effect.

### 29. DAG practice: persistent disturbances and HAC

Trace the routes before choosing a control.

The earlier disturbance affects the current disturbance, but the input nodes have no common-cause connection to these disturbances in the stated graph. Does disturbance persistence alone create regressor endogeneity? What does HAC change, and which arrows does it remove?

Name the target comparison first. Trace each route through the relevant variables and say whether it is directed, blocked or open under the stated conditioning. Use the diagram controls to test your proposed explanation before opening the worked reasoning.

**Practice:** The earlier disturbance affects the current disturbance, but the input nodes have no common-cause connection to these disturbances in the stated graph. Does disturbance persistence alone create regressor endogeneity? What does HAC change, and which arrows does it remove?

### 30. DAG practice: persistent disturbances and HAC: explanation

Explain what conditioning changes in this stated graph.

Persistence alone need not create endogeneity in this proposed model. It can create dependent outcomes and errors while the relevant input–disturbance mean conditions remain valid. Those are separate questions.

HAC changes the estimated covariance of the coefficient under suitable exogeneity, dependence and sample conditions. It removes no causal arrows and keeps OLS coefficients fixed on an identical specification and sample. If the actual input selection process introduces a common-cause route to the disturbance, HAC does not close that new route.

Persistence alone need not create endogeneity in this proposed model. It can create dependent outcomes and errors while the relevant input–disturbance mean conditions remain valid. Those are separate questions. HAC changes the estimated covariance of the coefficient under suitable exogeneity, dependence and sample conditions. It removes no causal arrows and keeps OLS coefficients fixed on an identical specification and sample. If the actual input selection process introduces a common-cause route to the disturbance, HAC does not close that new route.

### 31. Choose an uncertainty statement for repeated months

Reproduce the evidence, then explain its economic meaning.

Run lab_11.do. Confirm that conventional, robust and Newey–West fits retain the same law coefficient. Compare their SEs and approximate intervals. Explain why a smaller robust SE is possible, why four lags means four months here, and what none of these uncertainty options can establish about law adoption.

Change the Newey–West bandwidth from four to eight months without changing the conditional-mean model or observations. Verify the identical coefficient and compare the SEs. Write and run your own commands, then save the code, execution log and an explanation in your own words. The independent practice file is a worked reference.

**Practice:** Change the Newey–West bandwidth from four to eight months without changing the conditional-mean model or observations. Verify the identical coefficient and compare the SEs. Keep your commands, log, output and interpretation.

### 32. Choose an uncertainty statement for repeated months: explanation

A reproducible result needs both a calculation and an interpretation.

The common law coefficient is about 0.095453. The SEs are about 0.014235, 0.012368 and 0.018898 for conventional, robust and HAC4 inference. Using the common estimate plus or minus 1.96 times each SE gives different approximate intervals without changing the fitted model.

A robust SE can be smaller because its covariance estimate responds to the actual relationship between regressor leverage and error spread. Four covariance lags are four months in this monthly dataset; the option does not add four regressors. HAC allows a specified treatment of remaining time dependence under suitable conditions, while none of these choices makes law adoption exogenous or removes omitted dynamics from the conditional mean.

The common law coefficient remains 0.095453 on 108 months. The four- and eight-month HAC SEs are 0.018898 and 0.021580. The bandwidth changes the covariance estimate, not the list of regressors or the causal adoption argument.

Coefficient unchanged: \(0.095453\).

HAC SE, four versus eight months: \(0.018898\) versus \(0.021580\).

The bandwidth changes estimated uncertainty, not the conditional-mean regressors.

### 33. Exit check: connect the model, estimate and SE

Explain the three choices as responses to different empirical concerns.

Explain why the same fitted law coefficient can have three different standard errors. The conventional formula assumes the stated equal-variance and independence conditions. Heteroskedasticity-robust inference allows unequal spread but does not automatically allow time dependence. The Newey–West calculation adds weighted covariance information across nearby dates under its own conditions.

Give the calendar meaning of four covariance lags for monthly data, and state whether any new predictor was added. Then write one connected paragraph reporting the fitted magnitude, its uncertainty and the evidence that adoption provides a credible policy comparison. If that last argument is missing, say what design evidence would be needed. Next in this block, we derive structured error transformations and then study responses at future horizons.

Same equation/sample → same OLS coefficient.

Different justified covariance calculations → potentially different intervals.

A policy effect still needs an assignment argument.

**Practice:** In one paragraph, compare adding a lag, using Newey–West and fitting Prais–Winsten. Interpret lag(4) for this dataset.

**Explanation:** Adding a lag changes the mean equation and may change the sample and coefficients. Newey–West keeps OLS coefficients on the same equation and sample, while changing their estimated covariance; lag(4) here reaches four months. Prais–Winsten uses an AR(1) error model to transform the fit and may change coefficients and SEs. None of these changes, by itself, creates an exogenous policy comparison.

### 34. Recall what HAC preserves

An uncertainty adjustment does not add predictors.

Newey–West retains the OLS coefficient on the same equation and sample while changing its estimated covariance. Adding a lagged outcome changes the equation and usually the usable sample. Prais–Winsten uses an error-process model to transform the fit and can change coefficients and SEs.

Before comparing the results, say which concern motivates each operation. If an omitted lag helps explain current accidents, a mean-model change may be relevant. If the mean model is credible but errors remain dependent, a covariance adjustment may suffice for that part of the problem. An endogenous policy variable requires a separate identification response.

Newey–West retains the OLS coefficient on the same equation and sample while changing its estimated covariance.

Before comparing the results, say which concern motivates each operation.

### 35. The first observation needs its own GLS transformation

Quasi-differencing and ordinary first differences impose different error models.

For an AR one error model with absolute rho below one, subtract rho times the lagged regression equation at dates after the first. This gives the innovation e t as the transformed error. If the initial error is drawn from the stationary AR one distribution, multiplying the first row of the entire regression by square root of one minus rho squared puts its error on the same variance scale.

Prais–Winsten keeps this adjusted first row; Cochrane–Orcutt drops it. In practice rho is estimated, so feasible GLS needs a credible error specification and additional conditions for its large-sample claims. Transform the intercept and every regressor as well as the outcome. Ordinary first differencing instead uses rho equal to one in the algebra; it is not interchangeable with a stationary-error GLS model.

For \(t\ge2\): \(Y_t-\rho Y_{t-1}=(1-\rho)\beta_0+\beta_1(X_t-\rho X_{t-1})+e_t\).

Stationary first row: \((Y_1^\star,X_1^\star,1^\star)=\sqrt{1-\rho^2}(Y_1,X_1,1)\).

Estimated rho and a misspecified error process require care.

### 36. Model or inference?

Try the comparison before opening the explanation.

Compare adding a lagged regressor, changing OLS SEs to HAC, and fitting Prais–Winsten. Which can change coefficients?

Compare three operations: add a predictor, retain OLS but change covariance, or transform the equation using a modeled error process.

**Practice:** Compare adding a lagged regressor, changing OLS SEs to HAC, and fitting Prais–Winsten. Which can change coefficients?

### 37. Model or inference?: explanation

Follow the calculation and interpret its units.

Adding regressors changes the conditional-mean model and generally the OLS coefficients and sample. HAC on the identical specification and sample preserves OLS coefficients. Prais–Winsten transforms/weights the model under a modeled error process and can change coefficients as well as SEs; its assumptions must be justified.

Adding regressors changes the conditional-mean model and generally the OLS coefficients and sample. HAC on the identical specification and sample preserves OLS coefficients. Prais–Winsten transforms/weights the model under a modeled error process and can change coefficients as well as SEs; its assumptions must be justified.

### 38. A horizon

Try the comparison before opening the explanation.

In quarterly local projections \(Y_{t+h}=a_h+b_h\,shock_t+\text{controls}+u_{t+h}\), what does \(b_4\) describe?

Keep the shock date fixed and move the outcome date forward by h observation periods. Translate those periods into quarters.

**Practice:** In quarterly local projections \(Y_{t+h}=a_h+b_h\,shock_t+\text{controls}+u_{t+h}\), what does \(b_4\) describe?

### 39. A horizon: explanation

Follow the calculation and interpret its units.

It describes the outcome association or response four quarters, one year, after a unit shock, conditional on the specification. A causal impulse-response interpretation requires valid shock identification and controls; the regression form alone does not provide it.

It describes the outcome association or response four quarters, one year, after a unit shock, conditional on the specification. A causal impulse-response interpretation requires valid shock identification and controls; the regression form alone does not provide it.

### 40. A HAC lag has calendar meaning

The same number describes different windows at different frequencies.

The simulation uses quarterly data and Newey–West lag eight, allowing contributions through eight quarters, or two years. The accident example used monthly data with lag four, a four-month window. These are not interchangeable adjustments.

The appropriate window depends on the dependence structure and the asymptotic justification, and a finite-sample analysis should inspect plausible choices. A longer window is not automatically more conservative or more accurate. Also remember that lag selection in the covariance calculation does not add regressors to the horizon equation.

The simulation uses quarterly data and Newey–West lag eight, allowing contributions through eight quarters, or two years.

The appropriate window depends on the dependence structure and the asymptotic justification, and a finite-sample analysis should inspect plausible choices.

### 41. Mediation is not proven

Try the comparison before opening the explanation.

A shock coefficient becomes smaller after adding current expectations. Does this prove that expectations mediate the causal effect?

Trace the mediated route and the route through other news. A coefficient difference alone cannot tell which mechanism produced the change.

**Practice:** A shock coefficient becomes smaller after adding current expectations. Does this prove that expectations mediate the causal effect?

### 42. Mediation is not proven: explanation

Follow the calculation and interpret its units.

No. It is consistent with a mediation story but may reflect confounding, post-treatment conditioning, endogeneity or other specification changes. State the target and the assumptions under which conditioning has a direct-effect interpretation.

No. It is consistent with a mediation story but may reflect confounding, post-treatment conditioning, endogeneity or other specification changes. State the target and the assumptions under which conditioning has a direct-effect interpretation.

### 43. Initial information and post-shock information have different roles

Timing determines what a control can do.

A variable known before the shock can help account for the state of the economy that predicts both measured shocks and future outcomes. A variable changed by the shock can instead be part of its transmission. The same variable name can play different roles depending on when it is measured.

Write a time line for the shock, controls and outcome. This is especially useful when survey expectations, policy announcements and quarterly averages are recorded at different points. A regression with many controls can still target the wrong response if their timing is not aligned with the economic question.

A variable known before the shock can help account for the state of the economy that predicts both measured shocks and future outcomes.

Write a time line for the shock, controls and outcome.

### 44. DAG practice: expectations after a shock

Trace the routes before choosing a control.

A shock changes expectations and future inflation. Other news affects expectations and future inflation. Explain why adding current expectations can remove a mechanism and also create an alternative route, even if the shock initially had no common cause with the news.

Name the target comparison first. Trace each route through the relevant variables and say whether it is directed, blocked or open under the stated conditioning. Use the diagram controls to test your proposed explanation before opening the worked reasoning.

**Practice:** A shock changes expectations and future inflation. Other news affects expectations and future inflation. Explain why adding current expectations can remove a mechanism and also create an alternative route, even if the shock initially had no common cause with the news.

### 45. DAG practice: expectations after a shock: explanation

Explain what conditioning changes in this stated graph.

Expectations lie on \(s_t\rightarrow M\rightarrow\pi_{t+h}\), so conditioning on them blocks part of the shock’s response. They also form a collider on \(s_t\rightarrow M\leftarrow U\rightarrow\pi_{t+h}\); conditioning can open the route through other news.

The adjusted shock coefficient therefore does not automatically identify a direct response. An observed reduction in its size is compatible with several stories. State the target, the control’s timing and the additional assumptions needed to separate mediation from selection or mediator–outcome confounding.

Expectations lie on \(s_t\rightarrow M\rightarrow\pi_{t+h}\), so conditioning on them blocks part of the shock’s response. They also form a collider on \(s_t\rightarrow M\leftarrow U\rightarrow\pi_{t+h}\); conditioning can open the route through other news. The adjusted shock coefficient therefore does not automatically identify a direct response. An observed reduction in its size is compatible with several stories. State the target, the control’s timing and the additional assumptions needed to separate mediation from selection or mediator–outcome confounding.

