3.6 Functional form in software
Software 3.6.1 (A constant growth curve). Transformations are written directly in the model formula:
> subs <- c(38.1, 80.0, 170.4, 354.5, 744.4); T <- -2:2 > g <- lm(log(subs) ~ T) > summary(g)$coef Estimate Std. Error t value Pr(>|t|) (Intercept) 5.128735 0.002747891 1866.4259 3.391861e-10 T 0.743341 0.001943052 382.5635 3.938668e-08 > b <- coef(g)["T"]; exp(b) - 1 T 1.10295
Reading the output. The slope \(0.7433\) and intercept \(5.1287 = \overline {\log Y}\) agree with the hand calculation of Example 3.2.2. The growth rate is computed from the coefficient, not printed by lm: \(\hat g = 1.103\), or \(110\%\) a year. The tiny standard errors reflect an almost exact fit with only three residual degrees of freedom, and should not be over-interpreted: five points that lie on a smooth curve say little about how long the curve will continue.
Stata: generate lnsubs = ln(subs), regress lnsubs T, then nlcom exp(_b[T]) - 1, which also gives the delta-method standard error. EViews: ls log(subs) c t; then scalar g = exp(@coefs(2)) - 1.
Software 3.6.2 (Comparing a linear and a linear-log model). For the savings data, the savings rate against income per head, in levels and in logarithms:
> f1 <- lm(sr ~ dpi, data = LifeCycleSavings) > f2 <- lm(sr ~ log(dpi), data = LifeCycleSavings) > c(summary(f1)$r.squared, summary(f2)$r.squared) [1] 0.04855805 0.07636831 > summary(f2)$coef Estimate Std. Error t value Pr(>|t|) (Intercept) 1.756107 4.0203461 0.4368048 0.66421166 log(dpi) 1.207970 0.6063571 1.9921764 0.05205621
Reading the output. Both models explain sr, so their \(R^2\) values are comparable, and the linear-log form fits better. Income per head ranges from about $89 to $4 000, and a model in which each extra dollar matters equally across that range is implausible. The coefficient means that a \(10\%\) higher income per head is associated with a savings rate higher by \(1.208 \times \log 1.1 = 0.115\) percentage points, roughly \(1.208/10\). The \(p\)-value of \(0.052\) is borderline, and income on its own explains little of the variation in savings rates.
Stata: generate lndpi = ln(dpi), then regress sr lndpi. EViews: ls sr c log(dpi).
Software 3.6.3 (Box–Cox comparison of a linear and a growth model). For the subscriber data, compare a linear trend in \(Y\) with the growth curve, after scaling by the geometric mean:
> gm <- exp(mean(log(subs))); ys <- subs / gm > rss_lin <- sum(resid(lm(ys ~ T))^2) > rss_log <- sum(resid(lm(log(ys) ~ T))^2) > c(gm, rss_lin, rss_log) [1] 1.688035e+02 1.652347e+00 1.132636e-04
Reading the output. On the common scale the growth curve’s residual sum of squares is about \(14\,600\) times smaller. By Theorem 3.5.2 the log-likelihood difference is \(\frac 52\log 14\,589 = 24.0\) in favour of the growth curve, an overwhelming margin. The \(R^2\) values (\(0.858\) and \(0.99998\)) happened to point the same way here, but they could not have been relied on to do so.
Stata: boxcox subs T estimates \(\lambda \) by maximum likelihood. EViews has no built-in Box–Cox command; the scaled comparison above is done with two ls commands on the scaled series.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.