Dear Achim On 3/16/10, Achim Zeileis <achim.zeil...@uibk.ac.at> wrote: > Hence, when saying summary() different models with "no effects" are > assumed. For gr_fe the model without effects just omits value/capital but > keeps the firm-specific interecepts. For gr_lm not even the intercept is > kept in the model. Thus: > > gr_fe_null <- lm(invest ~ 0 + firm, data = pgr) > gr_lm_null <- lm(invest ~ 0, data = pgr) > What would be the more useful "no effects" model in the plm(..., effect="twoways") case? Considering the same setting, 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"))
I am fitting a "twoways" model and an "individual" with manually specified time 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 > 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 *** year1936 -83.9625 53.6143 -1.57 0.1261 year1937 -150.9206 58.3282 -2.59 0.0139 * year1938 -81.2343 50.7175 -1.60 0.1180 year1939 -137.4579 53.4385 -2.57 0.0144 * year1940 -96.3584 53.9837 -1.78 0.0827 . year1941 -56.5587 53.0089 -1.07 0.2931 year1942 -36.6539 50.9966 -0.72 0.4769 year1943 -78.0794 52.0249 -1.50 0.1421 year1944 -66.4725 52.5047 -1.27 0.2136 year1945 -89.5562 54.2876 -1.65 0.1077 year1946 -59.1147 55.3115 -1.07 0.2923 year1947 -87.5444 52.6530 -1.66 0.1051 year1948 -119.9125 53.3167 -2.25 0.0307 * year1949 -167.9552 54.1999 -3.10 0.0038 ** year1950 -172.7676 55.0212 -3.14 0.0034 ** year1951 -191.1369 57.6114 -3.32 0.0021 ** year1952 -195.4503 59.6377 -3.28 0.0023 ** year1953 -174.6639 66.3451 -2.63 0.0124 * year1954 -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 Following the reasoning in your previous e-mail, I assume that the (more useful) "no effects" model used in the "twoways" case is > gr_fe1_null <- lm(invest ~ 0 + firm + year, data = pgr) However I cannot replicate the F-statistic: 107.246. > anova(gr_fe1_null, gr_fe1) Analysis of Variance Table Response: invest Df Sum Sq Mean Sq F value Pr(>F) firm 3 7664439 2554813 101.46 <2e-16 *** year 19 932060 49056 1.95 0.040 * Residuals 38 956886 25181 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Warning message: In anova.lmlist(object, ...) : models with response "NULL" removed because response differs from model 1 > anova(gr_fe1_null, gr_fe2) Analysis of Variance Table Response: invest Df Sum Sq Mean Sq F value Pr(>F) firm 3 7664439 2554813 101.46 <2e-16 *** year 19 932060 49056 1.95 0.040 * Residuals 38 956886 25181 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Warning message: In anova.lmlist(object, ...) : models with response "NULL" removed because response differs from model 1 In the case of "individual" with manually introduced time effects, I assume the following null is used: > gr_fe2_null <- lm(invest ~ 0 + firm, data = pgr) But even here I cannot replicate the F-statistic: 21.8327. > anova(gr_fe2_null, gr_fe2) Analysis of Variance Table Response: invest Df Sum Sq Mean Sq F value Pr(>F) firm 3 7664439 2554813 77.1 <2e-16 *** Residuals 57 1888946 33139 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Warning message: In anova.lmlist(object, ...) : models with response "NULL" removed because response differs from model 1 Am I doing something wrong? Liviu ______________________________________________ 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.