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 and Griliches (1960) -> Grunfeld (1958) > ## > ## data > ## availability: none > ## firms: General Motors, General Electric, US Steel, Atlantic Refining, > ## Union Oil, Diamond Match, Goodyear, American Steel > ## > ## analysis > ## result: R^2 for General Motors cannot be reproduced > ## ---------------------------------------------------------------------------- > > ## 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", "General Electric", "US Steel", + "Atlantic Refining", "Union Oil", "Diamond Match", "Goodyear", "American Steel")) > gr$firm <- factor(gr$firm) > pgr <- plm.data(gr, c("firm", "year")) > > ## R^2 of individual OLS regressions (Table 1, p. 2, cited from Grunfeld, 1958) > sf <- systemfit(invest ~ value + capital, method = "OLS", data = pgr) > gsummary(sf) 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 > > ## alternatively: > lm_GM <- lm(invest ~ value + capital, data = gr, subset = firm == "General Motors") > lm_GE <- lm(invest ~ value + capital, data = gr, subset = firm == "General Electric") > lm_US <- lm(invest ~ value + capital, data = gr, subset = firm == "US Steel") > lm_AR <- lm(invest ~ value + capital, data = gr, subset = firm == "Atlantic Refining") > lm_UO <- lm(invest ~ value + capital, data = gr, subset = firm == "Union Oil") > lm_DM <- lm(invest ~ value + capital, data = gr, subset = firm == "Diamond Match") > lm_GY <- lm(invest ~ value + capital, data = gr, subset = firm == "Goodyear") > lm_AS <- lm(invest ~ value + capital, data = gr, subset = firm == "American Steel") > > ## aggregate regression > gr_macro <- aggregate(gr[,-4], list(gr$year), sum)[,-1] > lm_macro <- lm(invest ~ capital + value, data = gr_macro) > summary(lm_macro)$r.squared [1] 0.9289183 >