## ---------------------------------------------------------------------------- ## Baltagi (2002) -> Boot and De Wit (1960) ## ## data ## availability: electronic ## firms: General Motors, US Steel, General Electric, Chrysler, Atlantic Refining, ## IBM, Union Oil, Westinghouse, Goodyear, Diamond Match ## errors: none ## note: grunfeld.dat was provided on disk for 1st edition, ## on Springer Web page afterwards ## ## analysis ## result: all results can be exactly reproduced, but taking lags is wrong ## ---------------------------------------------------------------------------- ## preliminaries source("start.R") ## Exercise 10.9, p. 263 (independent of edition) ## - consider first 3 firms (General Motors, US Steel, General Electric) ## - 1st and 2nd edition ask to: run OLS of I on a constant, F_{-1}, C_{-1} ## - 3rd edition asks to: run OLS of I on a constant, F, C ## The solutions manual (Baltagi 1998, pp. 211) follows the 1st and 2nd edition ## and erroneously lags the regressors. For replication of the solutions manual ## we follow the erroneous approach. gr <- subset(Grunfeld, firm %in% c("General Motors", "US Steel", "General Electric")) gr$firm <- factor(gr$firm) gr$value1 <- c(NA, gr$value[1:59]) gr$capital1 <- c(NA, gr$capital[1:59]) gr <- gr[-c(1, 21, 41),] pgr <- plm.data(gr, c("firm", "year")) ## (a) separate regressions, (b) test for serial correlation lm_GM <- lm(invest ~ value1 + capital1, data = gr, subset = firm == "General Motors") summary(lm_GM) dwtest(lm_GM) t(sapply(1:3, function(x) bgtest(lm_GM, order = x)[c("statistic", "p.value")])) vcov(lm_GM) lm_US <- lm(invest ~ value1 + capital1, data = gr, subset = firm == "US Steel") summary(lm_US) dwtest(lm_US) t(sapply(1:3, function(x) bgtest(lm_US, order = x)[c("statistic", "p.value")])) vcov(lm_US) lm_GE <- lm(invest ~ value1 + capital1, data = gr, subset = firm == "General Electric") summary(lm_GE) dwtest(lm_GE) t(sapply(1:3, function(x) bgtest(lm_GE, order = x)[c("statistic", "p.value")])) vcov(lm_GE) ## visualization plot(ts(residuals(lm_GM), start = 1936), type = "n", ylim = c(-300, 300), xlab = "Year", ylab = "Residual") abline(h = -2:2 * 100, col= "lightgray", lty = 2) lines(ts(residuals(lm_GM), start = 1936), type = "b", pch = 22, lty = 1) lines(ts(residuals(lm_US), start = 1936), type = "b", pch = 2, lty = 2) lines(ts(residuals(lm_GE), start = 1936), type = "b", pch = 8, lty = 6) legend("topleft", c("General Motors", "US Steel", "General Electric"), lty = c(1, 2, 6), pch = c(22, 2, 8), bty = "n") ## (c) SUR for first 2 firms pgr2 <- subset(pgr, firm %in% c("General Motors", "US Steel")) pgr2$firm <- factor(pgr2$firm) sf_SUR2 <- systemfit(invest ~ value1 + capital1, method = "SUR", data = pgr2) summary(sf_SUR2) ## details: covariance/correlation matrices summary(sf_SUR2)$residCovEst cov2cor(summary(sf_SUR2)$residCovEst) solve(cov2cor(summary(sf_SUR2)$residCovEst)) solve(summary(sf_SUR2)$residCovEst) ## (d) SUR for first 3 firms sf_SUR3 <- systemfit(invest ~ value1 + capital1, method = "SUR", data = pgr) summary(sf_SUR3) ## details: covariance/correlation matrices summary(sf_SUR3)$residCovEst cov2cor(summary(sf_SUR3)$residCovEst) solve(cov2cor(summary(sf_SUR3)$residCovEst)) solve(summary(sf_SUR3)$residCovEst)