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. > ## ---------------------------------------------------------------------------- > ## Grunfeld (1958) > ## > ## data > ## availability: printed > ## firms: General Motors, General Electric, US Steel, Atlantic Refining, > ## Union Oil, Diamond Match, Goodyear, American Steel, > ## Chrysler, IBM, Westinghouse > ## errors: none (by definition) > ## > ## analysis > ## result: mostly minor variations re last digit, > ## General Motors: slopes and one s.e. (capital) are in error. > ## Reasons unclear. > ## Macro regression: discrepancies for all coef.s and se.s, > ## presumably due to discrepancies for GM. > ## ---------------------------------------------------------------------------- > > > ## 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 > gr8 <- subset(Grunfeld, firm %in% c("General Motors", "General Electric", "US Steel", + "Atlantic Refining", "Union Oil", "Diamond Match", "Goodyear", "American Steel")) > gr8$firm <- factor(gr8$firm) > pgr8 <- plm.data(gr8, c("firm", "year")) > > gr3 <- subset(Grunfeld, firm %in% c("IBM", "Chrysler", "Westinghouse")) > gr3$firm <- factor(gr3$firm) > pgr3 <- plm.data(gr3, c("firm", "year")) > > > # Table 25, p. 132 (constant terms not given) > lm_GM <- lm(invest ~ value + capital, data = gr8, subset = firm == "General Motors") > lm_GE <- lm(invest ~ value + capital, data = gr8, subset = firm == "General Electric") > lm_US <- lm(invest ~ value + capital, data = gr8, subset = firm == "US Steel") > lm_AR <- lm(invest ~ value + capital, data = gr8, subset = firm == "Atlantic Refining") > lm_UO <- lm(invest ~ value + capital, data = gr8, subset = firm == "Union Oil") > lm_DM <- lm(invest ~ value + capital, data = gr8, subset = firm == "Diamond Match") > lm_GY <- lm(invest ~ value + capital, data = gr8, subset = firm == "Goodyear") > lm_AS <- lm(invest ~ value + capital, data = gr8, subset = firm == "American Steel") > > gsummary(lm_GM) (Intercept) value capital R^2 sigma^2 -149.782 0.119 0.371 0.921 8423.875 105.842 0.026 0.037 > gsummary(lm_GE) (Intercept) value capital R^2 sigma^2 -9.956 0.027 0.152 0.705 777.446 31.374 0.016 0.026 > gsummary(lm_US) (Intercept) value capital R^2 sigma^2 -49.198 0.175 0.390 0.471 9299.604 148.075 0.074 0.142 > gsummary(lm_AR) (Intercept) value capital R^2 sigma^2 22.707 0.162 0.003 0.68 82.167 6.872 0.057 0.022 > gsummary(lm_UO) (Intercept) value capital R^2 sigma^2 -4.500 0.088 0.124 0.764 88.671 11.289 0.066 0.017 > gsummary(lm_DM) (Intercept) value capital R^2 sigma^2 0.162 0.005 0.437 0.643 1.178 2.066 0.027 0.080 > gsummary(lm_GY) (Intercept) value capital R^2 sigma^2 -7.723 0.075 0.082 0.666 82.786 9.359 0.034 0.028 > gsummary(lm_AS) (Intercept) value capital R^2 sigma^2 -2.646 0.066 0.084 0.142 9.825 6.797 0.042 0.083 > > ## alternatively > sf8 <- systemfit(invest ~ value + capital, method = "OLS", data = pgr8) > gsummary(sf8) Method: OLS (Intercept) value capital R^2 sigma^2 American.Steel -2.646 0.066 0.084 0.142 9.825 6.797 0.042 0.083 Atlantic.Refining 22.707 0.162 0.003 0.680 82.167 6.872 0.057 0.022 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 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 > > ## Macro regression (Table 25, col. "Aggr.") > gr8_macro <- aggregate(gr8[,-4], list(gr8$year), sum)[,-1] > lm_macro <- lm(invest ~ value + capital, data = gr8_macro) > gsummary(lm_macro) (Intercept) value capital R^2 sigma^2 -329.333 0.103 0.269 0.929 18698.34 182.307 0.021 0.024 > > > ## Table 30, p. 148 (constant terms not given) > ## R^2s in Table 29, p. 146 > lm_IBM <- lm(invest ~ value + capital, data = gr3, subset = firm == "IBM") > lm_CH <- lm(invest ~ value + capital, data = gr3, subset = firm == "Chrysler") > lm_WH <- lm(invest ~ value + capital, data = gr3, subset = firm == "Westinghouse") > > gsummary(lm_IBM) (Intercept) value capital R^2 sigma^2 -8.686 0.131 0.085 0.952 65.325 4.545 0.031 0.100 > gsummary(lm_CH) (Intercept) value capital R^2 sigma^2 -6.190 0.078 0.316 0.914 176.32 13.506 0.020 0.029 > gsummary(lm_WH) (Intercept) value capital R^2 sigma^2 -0.509 0.053 0.092 0.744 104.308 8.015 0.016 0.056 > > ## alternatively > sf3 <- systemfit(invest ~ value + capital, method = "OLS", data = pgr3) > gsummary(sf3) Method: OLS (Intercept) value capital R^2 sigma^2 Chrysler -6.190 0.078 0.316 0.914 176.320 13.506 0.020 0.029 IBM -8.686 0.131 0.085 0.952 65.325 4.545 0.031 0.100 Westinghouse -0.509 0.053 0.092 0.744 104.308 8.015 0.016 0.056 > > > ## aggregate regression using Grunfeld's Table 10 (Appendix), p. 164 > ## very different from gsummary(lm_macro) > lm_agg <- lm(invest ~ value + capital, data = Grunfeld_agg) > gsummary(lm_agg) (Intercept) value capital R^2 sigma^2 -11.074 0.068 0.284 0.919 21165.33 141.029 0.017 0.026 >