plm is a package for R which intends to make the estimation of linear panel models straightforward. plm provides functions to estimate a wide variety of models and to make (robust) inference.
For a gentle and comprehensive introduction to the package, please see the package's vignette.
The main functions to estimate models are:
plm: panel data estimators using lm on transformed data,
pvcm: variable coefficients models
pgmm: generalized method of moments (GMM) estimation for panel
data,
pggls: estimation of general feasible generalized least squares models,
pmg: mean groups (MG), demeaned MG and common correlated effects
(CCEMG) estimators,
pcce: estimators for common correlated effects mean groups (CCEMG) and
pooled (CCEP) for panel data with common factors,
pldv: panel estimators for limited dependent variables.
Next to the model estimation functions, the package offers several functions for statistical tests related to panel data/models.
Multiple functions for (robust) variance–covariance matrices are at hand as well.
The package also provides data sets to demonstrate functions and to
replicate some text book/paper results. Use
data(package="plm") to view a list of available data sets in
the package.
Useful links:
data("Produc", package = "plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc, index = c("state","year"))
summary(zz)
#> Oneway (individual) effect Within Model
#>
#> Call:
#> plm(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
#> data = Produc, index = c("state", "year"))
#>
#> Balanced Panel: n = 48, T = 17, N = 816
#>
#> Residuals:
#> Min. 1st Qu. Median 3rd Qu. Max.
#> -0.120456 -0.023741 -0.002041 0.018144 0.174718
#>
#> Coefficients:
#> Estimate Std. Error t-value Pr(>|t|)
#> log(pcap) -0.02614965 0.02900158 -0.9017 0.3675
#> log(pc) 0.29200693 0.02511967 11.6246 < 2.2e-16 ***
#> log(emp) 0.76815947 0.03009174 25.5273 < 2.2e-16 ***
#> unemp -0.00529774 0.00098873 -5.3582 1.114e-07 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Total Sum of Squares: 18.941
#> Residual Sum of Squares: 1.1112
#> R-Squared: 0.94134
#> Adj. R-Squared: 0.93742
#> F-statistic: 3064.81 on 4 and 764 DF, p-value: < 2.22e-16
# replicates some results from Baltagi (2013), table 3.1
data("Grunfeld", package = "plm")
p <- plm(inv ~ value + capital,
data = Grunfeld, model="pooling")
wi <- plm(inv ~ value + capital,
data = Grunfeld, model="within", effect = "twoways")
swar <- plm(inv ~ value + capital,
data = Grunfeld, model="random", effect = "twoways")
amemiya <- plm(inv ~ value + capital,
data = Grunfeld, model = "random", random.method = "amemiya",
effect = "twoways")
walhus <- plm(inv ~ value + capital,
data = Grunfeld, model = "random", random.method = "walhus",
effect = "twoways")