Dear R users I get different F-statistic results for a "within" model, when using "time" or "twoways" effects in plm() [1] and when manually specifying the time control dummies [2]. [1] vignette("plm") [2] http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf
Two examples below: library("AER") data("Grunfeld", package = "AER") library("plm") gr <- subset(Grunfeld, firm %in% c("General Electric", "General Motors", "IBM")) pgr <- plm.data(gr, index = c("firm", "year")) > dim(pgr) [1] 60 5 ## the first example is actually on "individual" effects > gr_fe <- plm(invest ~ value + capital, data = pgr, + model = "within", effect="individual") > summary(gr_fe) Oneway (individual) effect Within Model Call: plm(formula = invest ~ value + capital, data = pgr, effect = "individual", model = "within") Balanced Panel: n=3, T=20, N=60 Residuals : Min. 1st Qu. Median 3rd Qu. Max. -167.00 -26.10 2.09 26.80 202.00 Coefficients : Estimate Std. Error t-value Pr(>|t|) value 0.1049 0.0163 6.42 0.000000033 *** capital 0.3453 0.0244 14.16 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Total Sum of Squares: 1890000 Residual Sum of Squares: 244000 F-statistic: 185.407 on 2 and 55 DF, p-value: <2e-16 > summary(fixef(gr_fe)) Estimate Std. Error t-value Pr(>|t|) General Motors -70.6 67.8 -1.04 0.30 General Electric -239.6 32.8 -7.29 3e-13 *** IBM -24.6 16.2 -1.52 0.13 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > gr_lm <- lm(invest ~ 0+value + capital + firm, data = pgr) > summary(gr_lm) Call: lm(formula = invest ~ 0 + value + capital + firm, data = pgr) Residuals: Min 1Q Median 3Q Max -167.33 -26.14 2.09 26.84 201.68 Coefficients: Estimate Std. Error t value Pr(>|t|) value 0.1049 0.0163 6.42 0.0000000330 *** capital 0.3453 0.0244 14.16 < 2e-16 *** firmGeneral Motors -70.5629 67.8196 -1.04 0.30 firmGeneral Electric -239.5560 32.8400 -7.29 0.0000000012 *** firmIBM -24.6480 16.1726 -1.52 0.13 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 66.6 on 55 degrees of freedom Multiple R-squared: 0.974, Adjusted R-squared: 0.972 F-statistic: 420 on 5 and 55 DF, p-value: <2e-16 In the first case, plm(..., effect="individual"), F-statistic: 185.407 and in the second F-statistic: 420, while all other regression coefficients and standard errors are the same. Which F-statistic should be considered? ## A second example with "twoways" effects > gr_fe1 <- plm(invest ~ value + capital, data = pgr, + model = "within", effect="twoways") > summary(gr_fe1) Twoways effects Within Model Call: plm(formula = invest ~ value + capital, data = pgr, effect = "twoways", model = "within") Balanced Panel: n=3, T=20, N=60 Residuals : Min. 1st Qu. Median 3rd Qu. Max. -153.00 -29.10 2.23 34.80 125.00 Coefficients : Estimate Std. Error t-value Pr(>|t|) value 0.1295 0.0224 5.77 1.4e-06 *** capital 0.4184 0.0353 11.85 5.5e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Total Sum of Squares: 957000 Residual Sum of Squares: 138000 F-statistic: 107.246 on 2 and 36 DF, p-value: 6.84e-16 > #summary(fixef(gr_fe1, "time")) > gr_fe2 <- plm(invest ~ value + capital + year, data = pgr, + model = "within", effect="individual") > summary(gr_fe2) Oneway (individual) effect Within Model Call: plm(formula = invest ~ value + capital + year, data = pgr, effect = "individual", model = "within") Balanced Panel: n=3, T=20, N=60 Residuals : Min. 1st Qu. Median 3rd Qu. Max. -153.00 -29.10 2.23 34.80 125.00 Coefficients : Estimate Std. Error t-value Pr(>|t|) value 0.1295 0.0224 5.77 1.4e-06 *** capital 0.4184 0.0353 11.85 5.5e-14 *** year[T.1936] -83.9625 53.6143 -1.57 0.1261 year[T.1937] -150.9206 58.3282 -2.59 0.0139 * year[T.1938] -81.2343 50.7175 -1.60 0.1180 year[T.1939] -137.4579 53.4385 -2.57 0.0144 * year[T.1940] -96.3584 53.9837 -1.78 0.0827 . year[T.1941] -56.5587 53.0089 -1.07 0.2931 year[T.1942] -36.6539 50.9966 -0.72 0.4769 year[T.1943] -78.0794 52.0249 -1.50 0.1421 year[T.1944] -66.4725 52.5047 -1.27 0.2136 year[T.1945] -89.5562 54.2876 -1.65 0.1077 year[T.1946] -59.1147 55.3115 -1.07 0.2923 year[T.1947] -87.5444 52.6530 -1.66 0.1051 year[T.1948] -119.9125 53.3167 -2.25 0.0307 * year[T.1949] -167.9552 54.1999 -3.10 0.0038 ** year[T.1950] -172.7676 55.0212 -3.14 0.0034 ** year[T.1951] -191.1369 57.6114 -3.32 0.0021 ** year[T.1952] -195.4503 59.6377 -3.28 0.0023 ** year[T.1953] -174.6639 66.3451 -2.63 0.0124 * year[T.1954] -181.1273 68.5794 -2.64 0.0121 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Total Sum of Squares: 1890000 Residual Sum of Squares: 138000 F-statistic: 21.8327 on 21 and 36 DF, p-value: 1.32e-14 In the first case, F-statistic: 107.246 , while in the second F-statistic: 21.8327. Again, which one is correct? Thank you Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.