R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## ---------------------------------------------------------------------------- > ## Maddala (1977) -> Boot and De Wit (1960) / Grunfeld and Griliches (1960) > ## > ## data > ## availability: printed > ## firms: General Motors, US Steel, General Electric, Chrysler, Atlantic Refining, > ## IBM, Union Oil, Westinghouse, Goodyear, Diamond Match > ## errors: invest_AR,1953 = 81.90 (Atlantic Refining) > ## capital_US,1946 = 232.6 (US Steel) BUT apparently not used for calculations > ## calls Atlantic Refining Atlantic Richfield > ## > ## analysis > ## result: exact at precision given > ## (exceptions: last printed digit for sigma^2 for GE and IBM, and for > ## correlation between AR,GY) > ## compares results to Grunfeld and Griliches (1960), obtaining a different > ## R^2 for General Motors (for unknown reason in G&G) and Atlantic Refining > ## (due to data error for invest_AR,1953) > ## ---------------------------------------------------------------------------- > > ## preliminaries > source("start.R") Loading required package: kinship Loading required package: survival Loading required package: splines Loading required package: nlme Loading required package: lattice [1] "kinship is loaded" Loading required package: Formula Loading required package: MASS Loading required package: sandwich Loading required package: zoo Loading required package: Matrix Loading required package: car Loading required package: lmtest > > ## data pre-processing > gr <- subset(Grunfeld, firm %in% c("General Motors", "US Steel", "General Electric", "Chrysler", + "Atlantic Refining", "IBM", "Union Oil", "Westinghouse", "Goodyear", "Diamond Match")) > gr$firm <- factor(gr$firm) > gr$invest[19] <- 81.90 > pgr <- plm.data(gr, c("firm", "year")) > gr_macro <- aggregate(gr[,-4], list(gr$year), sum)[,-1] > > ## Micro and macro regressions (Table 10-5, p. 216) > sf <- systemfit(invest ~ value + capital, method = "OLS", data = pgr) > gsummary(sf) Method: OLS (Intercept) value capital R^2 sigma^2 Atlantic.Refining 26.125 0.134 0.008 0.633 83.426 6.925 0.057 0.022 Chrysler -6.190 0.078 0.316 0.914 176.320 13.506 0.020 0.029 Diamond.Match 0.162 0.005 0.437 0.643 1.178 2.066 0.027 0.080 General.Electric -9.956 0.027 0.152 0.705 777.446 31.374 0.016 0.026 General.Motors -149.782 0.119 0.371 0.921 8423.875 105.842 0.026 0.037 Goodyear -7.723 0.075 0.082 0.666 82.786 9.359 0.034 0.028 IBM -8.686 0.131 0.085 0.952 65.325 4.545 0.031 0.100 US.Steel -49.198 0.175 0.390 0.471 9299.604 148.075 0.074 0.142 Union.Oil -4.500 0.088 0.124 0.764 88.671 11.289 0.066 0.017 Westinghouse -0.509 0.053 0.092 0.744 104.308 8.015 0.016 0.056 > structure(sapply(sf$eq, function(x) dwtest(x)$statistic), + .Names = sapply(sf$eq, function(x) x$eqnLabel)) Atlantic.Refining Chrysler Diamond.Match General.Electric 2.3837379 1.9840360 1.0721853 1.0720986 General.Motors Goodyear IBM US.Steel 0.9374539 1.2986857 1.7633251 0.9456072 Union.Oil Westinghouse 1.6657490 1.4130207 > > ## alternatively: > lm_GM <- lm(invest ~ value + capital, data = gr, subset = firm == "General Motors") > lm_US <- lm(invest ~ value + capital, data = gr, subset = firm == "US Steel") > lm_GE <- lm(invest ~ value + capital, data = gr, subset = firm == "General Electric") > lm_CH <- lm(invest ~ value + capital, data = gr, subset = firm == "Chrysler") > lm_AR <- lm(invest ~ value + capital, data = gr, subset = firm == "Atlantic Refining") > lm_IBM<- lm(invest ~ value + capital, data = gr, subset = firm == "IBM") > lm_UO <- lm(invest ~ value + capital, data = gr, subset = firm == "Union Oil") > lm_WH <- lm(invest ~ value + capital, data = gr, subset = firm == "Westinghouse") > lm_GY <- lm(invest ~ value + capital, data = gr, subset = firm == "Goodyear") > lm_DM <- lm(invest ~ value + capital, data = gr, subset = firm == "Diamond Match") > > ## macro regression > lm_macro <- lm(invest ~ value + capital, data = gr_macro) > gsummary(lm_macro) (Intercept) value capital R^2 sigma^2 -327.742 0.099 0.260 0.939 22411.6 193.373 0.020 0.024 > > ## Table 10-6, p. 217 > round(summary(sf)$residCor, 2) Atlantic.Refining Chrysler Diamond.Match General.Electric Atlantic.Refining 1.00 0.11 0.10 -0.01 Chrysler 0.11 1.00 0.11 -0.07 Diamond.Match 0.10 0.11 1.00 0.56 General.Electric -0.01 -0.07 0.56 1.00 General.Motors -0.35 -0.27 -0.26 0.28 Goodyear -0.15 0.07 0.26 0.41 IBM 0.16 0.20 0.39 0.46 US.Steel 0.21 0.34 0.70 0.43 Union.Oil 0.15 -0.12 -0.22 -0.02 Westinghouse -0.02 0.12 0.57 0.73 General.Motors Goodyear IBM US.Steel Union.Oil Westinghouse Atlantic.Refining -0.35 -0.15 0.16 0.21 0.15 -0.02 Chrysler -0.27 0.07 0.20 0.34 -0.12 0.12 Diamond.Match -0.26 0.26 0.39 0.70 -0.22 0.57 General.Electric 0.28 0.41 0.46 0.43 -0.02 0.73 General.Motors 1.00 0.21 0.12 -0.26 0.51 0.16 Goodyear 0.21 1.00 -0.17 0.28 0.19 0.52 IBM 0.12 -0.17 1.00 0.36 0.13 0.52 US.Steel -0.26 0.28 0.36 1.00 -0.27 0.61 Union.Oil 0.51 0.19 0.13 -0.27 1.00 0.14 Westinghouse 0.16 0.52 0.52 0.61 0.14 1.00 >