8.7 Specification tests in software

Software 8.7.1 (Dummy variables and omitted-variable bias: the 1983 seat-belt law). R’s Seatbelts data record monthly UK car-driver deaths from 1969 to 1984, with kilometres driven, the real petrol price, and a dummy law equal to one from February 1983, when wearing a front seat belt became compulsory. Regress log deaths on log kilometres, log petrol price, the law dummy and eleven monthly dummies; then add a linear trend:

> sb <- data.frame(Seatbelts)
> sb$month <- factor(cycle(Seatbelts[, "drivers"]))
> m <- lm(log(drivers) ~ log(kms) + log(PetrolPrice) + law + month,
+         data = sb)
> summary(m)$coef[c(1:4), ]
                   Estimate Std. Error   t value     Pr(>|t|)
(Intercept)       7.9934777 0.47968603 16.663978 4.176961e-38
log(kms)         -0.1568296 0.04575640 -3.427490 7.575927e-04
log(PetrolPrice) -0.4027112 0.05663307 -7.110884 2.739724e-11
law              -0.1614110 0.02266780 -7.120716 2.592012e-11
> sb$t <- 1:192
> m2 <- update(m, . ~ . + t)
> summary(m2)$coef[c(2:4, 16), 1:3]
                     Estimate   Std. Error   t value
log(kms)          0.432120223 0.1208090215  3.576887
log(PetrolPrice) -0.286746370 0.0573535455 -4.999628
law              -0.150397278 0.0212633632 -7.073071
t                -0.001954302 0.0003749919 -5.211585

Reading the output. factor(month) makes R create eleven monthly dummies, January being the base, so the dummy trap is avoided automatically. In the first model the law coefficient is \(-0.161\): deaths were \(100(e^{-0.161} - 1) = 14.9\%\) lower after the law, other things equal, with a \(t\) ratio of \(-7.1\). But the kilometre elasticity is negative, implying that more driving means fewer deaths, which is implausible. Over the sixteen years traffic grew steadily while cars and roads became safer, so kilometres driven are correlated \(0.78\) with time. Without a trend, \(\log (\text {kms})\) partly stands in for the omitted improvement in safety. Theorem 8.1.1(i) predicts the sign of the bias: safety improvement lowers deaths, and it is positively correlated with kms, so the bias is downward. With the trend included, the elasticity is \(+0.43\), as it should be, and the trend coefficient says deaths fell by about \(0.2\%\) a month for other reasons. The law effect barely moves, to \(-0.150\) (\(-14.0\%\)): it was not much correlated with the omitted trend, because it is a step at a single date.

Stata: regress ln_drivers ln_kms ln_petrol law i.month. EViews: ls log(drivers) c log(kms) log(petrolprice) law @expand(@month, @droplast).

Software 8.7.2 (Chow tests at a known date). Without the law dummy, do the coefficients differ before and after February 1983? The first set has \(169\) months and the second \(23\); with \(k = 14\) coefficients both are long enough for the break test:

> pre <- sb$law == 0
> m0 <- lm(log(drivers) ~ log(kms) + log(PetrolPrice) + month,
+          data = sb)
> m1 <- update(m0, subset = pre); m2 <- update(m0, subset = !pre)
> RSS <- deviance(m0); RSS1 <- deviance(m1); RSS2 <- deviance(m2)
> k <- length(coef(m0)); n <- nrow(sb)
> Fb <- ((RSS - RSS1 - RSS2)/k) / ((RSS1 + RSS2)/(n - 2*k))
> c(F = Fb, p = pf(Fb, k, n - 2*k, lower = FALSE))
           F            p
4.496431e+00 8.130793e-07
> Ff <- ((RSS - RSS1)/sum(!pre)) / (RSS1/(sum(pre) - k))
> c(F = Ff, p = pf(Ff, sum(!pre), sum(pre) - k, lower = FALSE))
           F            p
2.812683e+00 8.499661e-05

Reading the output. The break test (Theorem 8.3.1) gives \(F = 4.50\) on \((14, 164)\) degrees of freedom, and the forecast test (Theorem 8.2.2) gives \(F = 2.81\) on \((23, 155)\). Both reject stability decisively: the pre-law relation does not describe the post-law months. The seat-belt dummy in Software 8.7.1 is the specific alternative that explains the instability: an intercept shift at the date of the law. These data are monthly, and the residuals may well be autocorrelated, in which case the \(F\) distributions are only approximate; the next sections develop the tools to check.

Stata: estat sbknown, break(tm(1983m2)) after regress on tsset data. EViews: View \(\to \) Stability Diagnostics \(\to \) Chow Breakpoint Test (or Chow Forecast Test), entering the break date.

Software 8.7.3 (The RESET test). For the savings regression, add the squares and cubes of the fitted values:

> LCS <- LifeCycleSavings; LCS$yh <- fitted(fit)
> fr <- lm(sr ~ pop15 + pop75 + dpi + ddpi + I(yh^2) + I(yh^3),
+          data = LCS)
> anova(fit, fr)
  Res.Df    RSS Df Sum of Sq      F Pr(>F)
1     45 650.71
2     43 616.32  2    34.396 1.1999 0.3111

Reading the output. The powers of \(\hat Y\) reduce the residual sum of squares by \(34.4\), giving \(F = 1.20\) with \(p = 0.31\). There is no evidence against the linear specification. (The table’s header lines are omitted here.) I(yh^2) protects the power from being read as formula syntax. (R’s lmtest package automates this as resettest(fit).)

Stata: estat ovtest after regress. EViews: View \(\to \) Stability Diagnostics \(\to \) Ramsey RESET Test.

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.