plm {plm} | R Documentation |
Linear models for panel data estimated using the lm
function on transformed data.
plm(formula, data, subset, weights, na.action, effect = c("individual", "time", "twoways", "nested"), model = c("within", "random", "ht", "between", "pooling", "fd"), random.method = NULL, random.models = NULL, random.dfcor = NULL, inst.method = c("bvk", "baltagi", "am", "bms"), restrict.matrix = NULL, restrict.rhs = NULL, index = NULL, ...) ## S3 method for class 'panelmodel' print(x, digits = max(3, getOption("digits") - 2), width = getOption("width"), ...) ## S3 method for class 'plm' plot(x, dx = 0.2, N = NULL, seed = 1, within = TRUE, pooling = TRUE, between = FALSE, random = FALSE, ...)
formula |
a symbolic description for the model to be estimated, |
x |
an object of class |
data |
a |
subset |
see |
weights |
see |
na.action |
see |
effect |
the effects introduced in the model, one of
|
model |
one of |
random.method |
method of estimation for the variance components
in the random effects model, one of |
random.models |
an alternative to the previous argument, the models used to compute the variance components estimations are indicated, |
random.dfcor |
a numeric vector of length 2 indicating which degree of freedom should be used, |
inst.method |
the instrumental variable transformation: one of
|
index |
the indexes, |
restrict.matrix |
a matrix which defines linear restrictions on the coefficients, |
restrict.rhs |
the right hand side vector of the linear restrictions on the coefficients, |
digits |
number of digits for printed output, |
width |
the maximum length of the lines in the printed output, |
dx |
the half–length of the individual lines for the plot method (relative to x range), |
N |
the number of individual to plot, |
seed |
the seed which will lead to individual selection, |
within |
if |
pooling |
if |
between |
if |
random |
if |
... |
further arguments. |
plm
is a general function for the estimation of linear panel
models. It supports the following estimation methods: pooled OLS
(model = "pooling"
), fixed effects ("within"
), random
effects ("random"
), first–differences ("fd"
), and between
("between"
). It supports unbalanced panels and two–way effects
(although not with all methods).
For random effects models, four estimators of the transformation
parameter are available by setting random.method
to one of
"swar"
(Swamy and Arora (1972)) (default), "amemiya"
(Amemiya (1971)), "walhus"
(Wallace and Hussain (1969)), or
"nerlove"
(Nerlove (1971)).
For first–difference models, the intercept is maintained (which from a
specification viewpoint amounts to allowing for a trend in the levels
model). The user can exclude it from the estimated specification the
usual way by adding "-1"
to the model formula.
Instrumental variables estimation is obtained using two–part formulas,
the second part indicating the instrumental variables used. This can be
a complete list of instrumental variables or an update of the first
part. If, for example, the model is y ~ x1 + x2 + x3
, with
x1
and x2
endogenous and z1
and z2
external
instruments, the model can be estimated with:
formula = y~x1+x2+x3 | x3+z1+z2
,
formula = y~x1+x2+x3 | . -x1-x2+z1+z2
.
If an instrument variable estimation is requested, argument inst.method
selects the instrument variable transformation method:
"bvk"
(default) for Balestra and Varadharajan-Krishnakumar (1987),
"baltagi"
for Baltagi (1981),
"am"
for Amemiya and MaCurdy (1986),
"bms"
for Breusch, Mizon, and Schmidt (1989).
The Hausman–Taylor estimator (Hausman and Taylor (1981)) is computed if model = "ht"
.
An object of class c("plm", "panelmodel")
.
A "plm"
object has the following elements :
coefficients |
the vector of coefficients, |
vcov |
the variance–covariance matrix of the coefficients, |
residuals |
the vector of residuals (these are the residuals of the (quasi-)demeaned model), |
df.residual |
degrees of freedom of the residuals, |
formula |
an object of class |
model |
the model frame as a |
ercomp |
an object of class |
aliased |
named logical vector indicating any aliased coefficients which
are silently dropped by |
call |
the call. |
It has print
, summary
and print.summary
methods.
The summary
method creates an object of class "summary.plm"
that
extends the object it is run on with information about (inter alia) F statistic
and (adjusted) R-squared of model, standard errors, t–values, and p–values of
coefficients, (if supplied) the furnished vcov, see summary.plm
for further details.
Yves Croissant
Amemiya, T. (1971) The estimation of the variances in a variance–components model, International Economic Review, 12(1), pp. 1–13.
Amemiya, T. and MaCurdy, T.E. (1986) Instrumental–variable estimation of an error components model, Econometrica, 54(4), pp. 869–880.
Balestra, P. and Varadharajan-Krishnakumar, J. (1987) Full information estimations of a system of simultaneous equations with error components structure, Econometric Theory, 3(2), pp. 223–246.
Baltagi, B.H. (1981) Simultaneous equations with error components, Journal of Econometrics, 17(2), pp. 189–200.
Baltagi, B.H.; Song, S.H.; Jung, B.C. (2001), “The unbalanced nested error component regression model”, Journal of Econometrics, 101(2), pp. 357–381.
Baltagi, B.H. (2013) Econometric Analysis of Panel Data, 5th ed., John Wiley and Sons.
Breusch, T.S., Mizon, G.E. and Schmidt, P. (1989) Efficient estimation using panel data, Econometrica, 57(3), pp. 695–700.
Hausman, J.A. and Taylor, W.E. (1981) Panel data and unobservable individual effects, Econometrica, 49(6), pp. 1377–1398.
Nerlove, M. (1971) Further evidence on the estimation of dynamic economic relations from a time series of cross sections, Econometrica, 39(2), pp. 359–382.
Swamy, P.A.V.B. and Arora, S.S. (1972) The exact finite sample properties of the estimators of coefficients in the error components regression models, Econometrica, 40(2), pp. 261–275.
Wallace, T.D. and Hussain, A. (1969) The use of error components models in combining cross section with time series data, Econometrica, 37(1), pp. 55–72.
summary.plm
for further details about the associated
summary method and the "summary.plm" object both of which provide some
model tests and tests of coefficients. fixef
to
compute the fixed effects for "within" models (=fixed effects models).
data("Produc", package = "plm") zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, index = c("state","year")) summary(zz) # 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") # summary and summary with a funished vcov (passed as matrix, # as function, and as function with additional argument) summary(wi) summary(wi, vcov = vcovHC(wi)) summary(wi, vcov = vcovHC) summary(wi, vcov = function(x) vcovHC(x, method = "white2")) # nested random effect model # replicate Baltagi/Song/Jung (2001), p. 378 (table 6), columns SA, WH # == Baltagi (2013), pp. 204-205 data("Produc", package = "plm") pProduc <- pdata.frame(Produc, index = c("state", "year", "region")) form <- log(gsp) ~ log(pc) + log(emp) + log(hwy) + log(water) + log(util) + unemp summary(plm(form, data = pProduc, model = "random", effect = "nested")) summary(plm(form, data = pProduc, model = "random", effect = "nested", random.method = "walhus"))