2

I have a question of fixed effects in R. So I am trying to use plm function to find fixed effects like following:

> plm(PM25 ~ policy + 1, data=subset(part2, Delhi == 1), model="within", 
>     index=c("station_id", "date")) %>% summary()

The results I get:

> Oneway (individual) effect Within Model
> 
> Call: plm(formula = PM25 ~ policy + 1, data = subset(part2, Delhi == 
>           1), model = "within", index = c("station_id", "date"))
> 
> Unbalanced Panel: n = 7, T = 73-159, N = 992
> 
> Residuals:
>      Min.   1st Qu.    Median   3rd Qu.      Max. 
> -193.7049  -54.6776   -9.6843   54.7431  318.4094 
> 
> Coefficients:
>        Estimate Std. Error t-value  Pr(>|t|)     
> policy  76.8167     9.9787  7.6981 3.354e-14 ***
> --- 
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> Total Sum of Squares:    6846900 
> Residual Sum of Squares: 6458000
> R-Squared:      0.056803 
> Adj. R-Squared: 0.050093 
> F-statistic: 59.2603 on 1 and 984 DF, p-value: 3.3535e-14

I am wondering how can I find the intercept?

jay.sf
  • 556
  • 3
  • 19
Bing
  • 29
  • 1
  • 3

1 Answers1

2

The within model you specify amounts to fitting a separate intercept for each unit in your panel data set, as in $$ y_{it}=a_i+\beta x_{it}+u_{it} $$ See, e.g., these posts for some context:

Difference between fixed effects dummies and fixed effects estimator?

How exactly does a "random effects model" in econometrics relate to mixed models outside of econometrics?

Hence, you cannot additionally fit an overall intercept $a$, as you would then have perfect collinearity between the $a_i$ and $a$, as the sum of the $a_i$ is identically one.

You can retrieve these estimates as follows:

data("Grunfeld", package = "plm")

wi <- plm(inv ~ value + capital,
          data = Grunfeld, model = "within", effect = "twoways")

fixef(wi)

One might of course leave out one of the intercepts. Something related to what you seek seems to be achieved by this command: https://rdrr.io/rforge/plm/man/within_intercept.html

Christoph Hanck
  • 25,948
  • 3
  • 57
  • 106