vcovHC.plm: Robust Covariance Matrix Estimators

View source: R/tool_vcovG.R

vcovHC.plmR Documentation

Robust Covariance Matrix Estimators

Description

Robust covariance matrix estimators a la White for panel models.

Usage

## S3 method for class 'plm'
vcovHC(
  x,
  method = c("arellano", "white1", "white2"),
  type = c("HC0", "sss", "HC1", "HC2", "HC3", "HC4"),
  cluster = c("group", "time"),
  ...
)

## S3 method for class 'pcce'
vcovHC(
  x,
  method = c("arellano", "white1", "white2"),
  type = c("HC0", "sss", "HC1", "HC2", "HC3", "HC4"),
  cluster = c("group", "time"),
  ...
)

## S3 method for class 'pgmm'
vcovHC(x, ...)

Arguments

x

an object of class "plm" which should be the result of a random effects or a within model or a model of class "pgmm" or an object of class "pcce",

method

one of "arellano", "white1", "white2",

type

the weighting scheme used, one of "HC0", "sss", "HC1", "HC2", "HC3", "HC4", see Details,

cluster

one of "group", "time",

...

further arguments.

Details

vcovHC is a function for estimating a robust covariance matrix of parameters for a fixed effects or random effects panel model according to the White method \insertCiteWHIT:80,WHIT:84b,AREL:87plm. Observations may be clustered by "group" ("time") to account for serial (cross-sectional) correlation.

All types assume no intragroup (serial) correlation between errors and allow for heteroskedasticity across groups (time periods). As for the error covariance matrix of every single group of observations, "white1" allows for general heteroskedasticity but no serial (cross–sectional) correlation; "white2" is "white1" restricted to a common variance inside every group (time period) \insertCite@see @GREE:03, Sec. 13.7.1-2, @GREE:12, Sec. 11.6.1-2 and @WOOL:02, Sec. 10.7.2plm; "arellano" \insertCite@see ibid. and the original ref. @AREL:87plm allows a fully general structure w.r.t. heteroskedasticity and serial (cross–sectional) correlation.

Weighting schemes specified by type are analogous to those in sandwich::vcovHC() in package sandwich and are justified theoretically (although in the context of the standard linear model) by \insertCiteMACK:WHIT:85;textualplm and \insertCiteCRIB:04;textualplm \insertCiteZEIL:04plm. type = "sss" employs the small sample correction as used by Stata.

The main use of vcovHC (and the other variance-covariance estimators provided in the package vcovBK, vcovNW, vcovDC, vcovSCC) is to pass it to plm's own functions like summary, pwaldtest, and phtest or together with testing functions from the lmtest and car packages. All of these typically allow passing the vcov or vcov. parameter either as a matrix or as a function, e.g., for Wald–type testing: argument vcov. to coeftest(), argument vcov to waldtest() and other methods in the lmtest package; and argument vcov. to linearHypothesis() in the car package (see the examples), see \insertCite@see also @ZEIL:04plm, 4.1-2, and examples below.

A special procedure for pgmm objects, proposed by \insertCiteWIND:05;textualplm, is also provided.

Value

An object of class "matrix" containing the estimate of the asymptotic covariance matrix of coefficients.

Note

The function pvcovHC is deprecated. Use vcovHC for the same functionality.

Author(s)

Giovanni Millo & Yves Croissant

References

\insertRef

AREL:87plm

\insertRef

CRIB:04plm

\insertRef

GREE:03plm

\insertRef

GREE:12plm

\insertRef

MACK:WHIT:85plm

\insertRef

WIND:05plm

\insertRef

WHIT:84bplm chap. 6

\insertRef

WHIT:80plm

\insertRef

WOOL:02plm

\insertRef

ZEIL:04plm

See Also

sandwich::vcovHC() from the sandwich package for weighting schemes (type argument).

Examples


data("Produc", package = "plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
          data = Produc, model = "random")
## as function input to plm's summary method (with and without additional arguments):
summary(zz, vcov = vcovHC)
summary(zz, vcov = function(x) vcovHC(x, method="arellano", type="HC1"))

## standard coefficient significance test
library(lmtest)
coeftest(zz)
## robust significance test, cluster by group
## (robust vs. serial correlation)
coeftest(zz, vcov.=vcovHC)
## idem with parameters, pass vcov as a function argument
coeftest(zz, vcov.=function(x) vcovHC(x, method="arellano", type="HC1"))
## idem, cluster by time period
## (robust vs. cross-sectional correlation)
coeftest(zz, vcov.=function(x) vcovHC(x, method="arellano",
 type="HC1", cluster="group"))
## idem with parameters, pass vcov as a matrix argument
coeftest(zz, vcov.=vcovHC(zz, method="arellano", type="HC1"))
## joint restriction test
waldtest(zz, update(zz, .~.-log(emp)-unemp), vcov=vcovHC)
## Not run: 
## test of hyp.: 2*log(pc)=log(emp)
library(car)
linearHypothesis(zz, "2*log(pc)=log(emp)", vcov.=vcovHC)

## End(Not run)
## Robust inference for CCE models
data("Produc", package = "plm")
ccepmod <- pcce(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, model="p")
summary(ccepmod, vcov = vcovHC)

## Robust inference for GMM models
data("EmplUK", package="plm")
ar <- pgmm(log(emp) ~ lag(log(emp), 1:2) + lag(log(wage), 0:1)
           + log(capital) + lag(log(capital), 2) + log(output)
           + lag(log(output),2) | lag(log(emp), 2:99),
            data = EmplUK, effect = "twoways", model = "twosteps")
rv <- vcovHC(ar)
mtest(ar, order = 2, vcov = rv)

plm documentation built on April 9, 2023, 5:06 p.m.