# Estimation of error components models with the plm function" In plm: Linear Models for Panel Data

library("knitr")
opts_chunk$set(message = FALSE, warning = FALSE)  library("texreg") extract.plm <- function(model, include.rsquared = TRUE, include.adjrs = TRUE, include.nobs = TRUE, include.ercomp = TRUE, ...) { s <- summary(model, ...) coefficient.names <- rownames(coef(s)) coefficients <- coef(s)[, 1] standard.errors <- coef(s)[, 2] significance <- coef(s)[, 4] rs <- s$r.squared
adj <- s$r.squared n <- length(model$residuals)

gof <- numeric()
gof.names <- character()
gof.decimal <- logical()

if (include.ercomp == TRUE){
if (model$args$model == "random"){

# Instrumental variable estimators

All of the models presented above may be estimated using instrumental variables (IV). The instruments are specified using two- or three-part formulas, each part being separated by a | sign :

• the first part contains the covariates,
• the second part contains the "double-exogenous" instruments, i.e., variables that can be used twice as instruments, using their within and the between transformation,
• the third part contains the "single-exogenous" instruments, i.e., variables for which only the within transformation can be used as instruments, those variables being correlated with the individual effects.

The instrumental variables estimator used is indicated with the inst.method argument:

• "bvk", from @BALE:VARA:87, the default value : in this case, all the instruments are introduced in quasi-differences, using the same transformation as for the response and the covariates,
• "baltagi", from @BALT:81, the instruments of the second part are introduced twice using the between and the within transformation as those of the third are only introduced with the within transformation,
• "am", from @AMEM:MACU:86, the within transformation of the variables of the second parts for each period are also included as instruments,
• "bms", from @BREU:MIZO:SCHM:89, the within transformation of the variable of the second and of the third parts are included as instruments.

The various possible values of the inst.method argument are not relevant for fixed effect IV models as there is only one method for this type of IV models but many for random effect IV models.

The instrumental variable estimators are illustrated in the following example from @BALT:2005, p. 120/ @BALT:13, p. 137.

data("Crime", package = "plm")
crbalt <- plm(lcrmrte ~ lprbarr + lpolpc + lprbconv + lprbpris + lavgsen +
ldensity + lwcon + lwtuc + lwtrd + lwfir + lwser + lwmfg + lwfed +
lwsta + lwloc + lpctymle + lpctmin + region + smsa + factor(year)
| . - lprbarr - lpolpc + ltaxpc + lmix,
data = Crime, model = "random", inst.method = "baltagi")
crbvk <- update(crbalt, inst.method = "bvk")
crwth <- update(crbalt, model = "within")
screenreg(list(FE2SLS = crwth, EC2SLS = crbalt, G2SLS = crbvk),
single.row = TRUE, digits = 5, omit.coef = "(region)|(year)",
reorder.coef = c(1:16, 19, 18, 17))


The Hausman-Taylor model (@HAUS:TAYL:81) may be estimated with the plm function by setting argument random.method = "ht". The following example is from @BALT:2005, p. 130 and @BALT:13, p. 146.

data("Wages", package = "plm")
ht <- plm(lwage ~ wks + south + smsa + married + exp + I(exp^2) +
bluecol + ind + union + sex + black + ed |
bluecol + south + smsa + ind + sex + black |
wks + married + exp + I(exp^2) + union,
data = Wages, index = 595,
inst.method = "baltagi", model = "random",
random.method = "ht")

am <- update(ht, inst.method = "am")

screenreg(list("Hausman-Taylor" = ht, "Amemiya-MaCurdy" = am),
digits = 5, single.row = TRUE)


# Nested error component model

This section shows how the nested error component model as per @BALT:SONG:JUNG:01 can be estimated.

data("Produc", package = "plm")
swar <- plm(form <- log(gsp) ~ log(pc) + log(emp) + log(hwy) + log(water) + log(util) + unemp,
Produc, index = c("state", "year", "region"), effect = "nested", random.method = "swar")
walhus <- update(swar, random.method = "walhus")
amem <- update(swar, random.method = "amemiya")
screenreg(list("Swamy-Arora" = swar, "Wallace-Hussain" = walhus, "Amemiya" = amem), digits = 5)


# Bibliography

## Try the plm package in your browser

Any scripts or data that you put into this service are public.

plm documentation built on March 3, 2021, 1:12 a.m.