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. > ## ---------------------------------------------------------------------------- > ## Baltagi (2005) > ## > ## data > ## availability: electronic > ## firms: General Motors, US Steel, General Electric, Chrysler, Atlantic Refining, > ## IBM, Union Oil, Westinghouse, Goodyear, Diamond Match > ## errors: none > ## > ## analysis > ## result: exact at precision given > ## ---------------------------------------------------------------------------- > > ## 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) > pgr <- plm.data(gr, c("firm", "year")) > > ## Panel models: OLS / Between / Within / RE (Example 2.6.1, p. 21) > plm_pool <- plm(invest ~ value + capital, data = pgr, model = "pooling") > ## or: lm(invest ~ value + capital, data = pgr) > plm_between <- plm(invest ~ value + capital, data = pgr, model = "between") > plm_within <- plm(invest ~ value + capital, data = pgr, model = "within") > plm_walhus <- plm(invest ~ value + capital, data = pgr, model = "random", random.method = "walhus") > plm_amemiya <- plm(invest ~ value + capital, data = pgr, model = "random", random.method = "amemiya") > plm_swarmy <- plm(invest ~ value + capital, data = pgr, model = "random", random.method = "swar") > > gsummary(plm_pool) (Intercept) value capital R^2 sigma^2 -42.714 0.116 0.231 0.812 8912.947 9.512 0.006 0.025 > gsummary(plm_between) (Intercept) value capital R^2 sigma^2 -8.527 0.135 0.032 0.858 7229.023 47.515 0.029 0.191 > gsummary(plm_within) value capital R^2 sigma^2 0.110 0.310 0.767 2784.458 0.012 0.017 > gsummary(plm_walhus) (Intercept) value capital R^2 sigma^2 -57.554 0.11 0.307 0.77 2834.217 25.336 0.01 0.017 > gsummary(plm_amemiya) (Intercept) value capital R^2 sigma^2 -57.762 0.11 0.308 0.77 2798.267 27.838 0.01 0.017 > gsummary(plm_swarmy) (Intercept) value capital R^2 sigma^2 -57.834 0.11 0.308 0.77 2786.315 28.899 0.01 0.017 >