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. > ## ---------------------------------------------------------------------------- > ## Theil (1971) -> Zellner (1962) > ## > ## data > ## availability: printed > ## firms: General Electric, Westinghouse > ## 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 Electric", "Westinghouse")) > gr$firm <- factor(gr$firm) > pgr <- plm.data(gr, c("firm", "year")) > > ## OLS (p. 295) > fmGE <- lm(invest ~ value + capital, data = gr, subset = firm == "General Electric") > fmWH <- lm(invest ~ value + capital, data = gr, subset = firm == "Westinghouse") > summary(fmGE) Call: lm(formula = invest ~ value + capital, data = gr, subset = firm == "General Electric") Residuals: Min 1Q Median 3Q Max -37.511 -23.359 -3.922 7.824 58.737 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -9.95631 31.37425 -0.317 0.755 value 0.02655 0.01557 1.706 0.106 capital 0.15169 0.02570 5.902 1.74e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 27.88 on 17 degrees of freedom Multiple R-squared: 0.7053, Adjusted R-squared: 0.6706 F-statistic: 20.34 on 2 and 17 DF, p-value: 3.088e-05 > summary(fmWH) Call: lm(formula = invest ~ value + capital, data = gr, subset = firm == "Westinghouse") Residuals: Min 1Q Median 3Q Max -13.505 -7.793 -1.937 6.484 17.265 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.50939 8.01529 -0.064 0.95007 value 0.05289 0.01571 3.368 0.00365 ** capital 0.09241 0.05610 1.647 0.11787 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 10.21 on 17 degrees of freedom Multiple R-squared: 0.7444, Adjusted R-squared: 0.7144 F-statistic: 24.76 on 2 and 17 DF, p-value: 9.196e-06 > ## alternatively: > ## systemfit(invest ~ value + capital, method = "OLS", data = pgr) > > > ## SUR (p. 300) > fm <- systemfit(invest ~ value + capital, method = "SUR", data = pgr, + control = systemfit.control(methodResidCov = "noDfCor")) > gsummary(fm) Method: SUR (Intercept) value capital R^2 sigma^2 General.Electric -27.719 0.038 0.139 0.693 811.081 27.033 0.013 0.023 Westinghouse -1.252 0.058 0.064 0.740 105.959 6.956 0.013 0.049 > > ## matrix of mean squares and products (p. 299) > summary(fm)$residCovEst * 20 General.Electric Westinghouse General.Electric 13216.588 3528.981 Westinghouse 3528.981 1773.234 > > ## covariance matrices (p. 301) > vcov(fmGE) * 17/20 * 1e6 (Intercept) value capital (Intercept) 836691982.7 -383739.55097 -146659.65998 value -383739.6 205.95806 -40.21385 capital -146659.7 -40.21385 561.59491 > vcov(fmWH) * 17/20 * 1e6 (Intercept) value capital (Intercept) 54608128.3 -93113.4922 143574.6095 value -93113.5 209.6901 -555.4608 capital 143574.6 -555.4608 2675.0306 > vcov(fm) General.Electric_(Intercept) General.Electric_(Intercept) 730.7737897 General.Electric_value -0.3292660 General.Electric_capital -0.1462417 Westinghouse_(Intercept) 126.9626218 Westinghouse_value -0.2261930 Westinghouse_capital 0.3925148 General.Electric_value General.Electric_capital General.Electric_(Intercept) -3.292660e-01 -1.462417e-01 General.Electric_value 1.766271e-04 -3.404815e-05 General.Electric_capital -3.404815e-05 5.306383e-04 Westinghouse_(Intercept) -5.268840e-02 -3.962129e-02 Westinghouse_value 1.199926e-04 -1.687242e-05 Westinghouse_capital -3.247996e-04 5.948291e-04 Westinghouse_(Intercept) Westinghouse_value General.Electric_(Intercept) 126.96262178 -2.261930e-01 General.Electric_value -0.05268840 1.199926e-04 General.Electric_capital -0.03962129 -1.687242e-05 Westinghouse_(Intercept) 48.39075924 -8.002251e-02 Westinghouse_value -0.08002251 1.798552e-04 Westinghouse_capital 0.11361780 -4.745933e-04 Westinghouse_capital General.Electric_(Intercept) 0.3925147667 General.Electric_value -0.0003247996 General.Electric_capital 0.0005948291 Westinghouse_(Intercept) 0.1136178044 Westinghouse_value -0.0004745933 Westinghouse_capital 0.0023913076 >