[R] Panel models: Fixed effects & random coefficients in plm

Downey, Patrick PDowney at urban.org
Thu Mar 8 16:28:40 CET 2012


Hello,

I am using {plm} to estimate panel models. I want to estimate a model that
includes fixed effects for time and individual, but has a random individual
effect for the coefficient on the independent variable.

That is, I would like to estimate the model:
Y_it = a_i + a_t + B_i * X_it + e_it
Where i denotes individuals, t denotes time, X is my independent variable,
and B (beta) is the coefficient on that random variable. I want both a
coefficients to be estimated with fixed effects because I expect them to be
correlated with Y, and B to be estimated using a random effect.

I understand how to estimate two way fixed effects models in plm (which
have the fixed effects for time and individual, as I want) and how to
estimate random coefficient models (which have random effects for all
coefficients, including the intercept and the beta). I want to combine
these, though, and I cannot figure out how to do that. It seems like the
plm package is capable, but I can't figure it out.

Below is reproducible code (assuming you have plm installed) taken from the
vignette available on cran. It shows the two models I know how to estimate.
Any guidance on estimating the third model would be greatly appreciated.

-Mitch

# Data setup
library(plm)
data("EmplUK", package="plm")
names(EmplUK)
E <- pdata.frame(EmplUK, index = c("firm", "year"), drop.index = TRUE,
row.names = TRUE)

# Two-way fixed effects model with constant beta

m1 <- plm(wage ~ output,data=E,model="within",effect="twoways")
summary(m1)

# Random (individual) effects for both intercept and beta

m2 <- pvcm(wage ~ output,data=E,model="random")
summary(m2)



More information about the R-help mailing list