Robust covariance matrix estimators a la White for panel models.

# 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.

Value

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

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 (White 1980, 1984; Arellano 1987) . 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) (see Greene 2003, Sec. 13.7.1-2, Greene 2012, Sec. 11.6.1-2 and Wooldridge 2002, Sec. 10.7.2) ; "arellano" (see ibid. and the original ref. Arellano 1987) 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 MacKinnon and White (1985) and Cribari–Neto (2004) (Zeileis 2004) . 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 (see also Zeileis 2004) , 4.1-2, and examples below.

A method for pgmm objects, vcovHC.pgmm, is also provided and gives the robust variance-covariances matrix, in case of a two-steps panel GMM model with the small-sample correction proposed by Windmeijer (2005) .

Note

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

References

Arellano M (1987). “Computing Robust Standard Errors for Within-groups Estimators.” Oxford bulletin of Economics and Statistics, 49(4), 431–434.

Cribari–Neto F (2004). “Asymptotic Inference Under Heteroskedasticity of Unknown Form.” Computational Statistics & Data Analysis, 45, 215–233.

Greene WH (2003). Econometric Analysis, 5th edition. Prentice Hall.

Greene WH (2012). Econometric Analysis, 7th edition. Prentice Hall.

MacKinnon JG, White H (1985). “Some Heteroskedasticity–Consistent Covariance Matrix Estimators With Improved Finite Sample Properties.” Journal of Econometrics, 29, 305–325.

Windmeijer F (2005). “A Finite Sample Correction for the Variance of Linear Efficient Two–Steps GMM Estimators.” Journal of Econometrics, 126, 25–51.

White H (1984). Asymptotic Theory for Econometricians. New York: Academic press. chap. 6

White H (1980). “A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity.” Econometrica, 48(4), 817–838.

Wooldridge JM (2002). Econometric Analysis of Cross–Section and Panel Data. MIT Press.

Zeileis A (2004). “Econometric Computing With HC and HAC Covariance Matrix Estimators.” Journal of Statistical Software, 11(10), 1–17. https://www.jstatsoft.org/article/view/v011i10.

See also

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

Author

Giovanni Millo & Yves Croissant

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)
#> Oneway (individual) effect Random Effect Model 
#>    (Swamy-Arora's transformation)
#> 
#> Note: Coefficient variance-covariance matrix supplied: vcovHC
#> 
#> Call:
#> plm(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, 
#>     data = Produc, model = "random")
#> 
#> Balanced Panel: n = 48, T = 17, N = 816
#> 
#> Effects:
#>                    var  std.dev share
#> idiosyncratic 0.001454 0.038137 0.175
#> individual    0.006838 0.082691 0.825
#> theta: 0.8888
#> 
#> Residuals:
#>       Min.    1st Qu.     Median    3rd Qu.       Max. 
#> -0.1067230 -0.0245520 -0.0023694  0.0217333  0.1996307 
#> 
#> Coefficients:
#>               Estimate Std. Error z-value  Pr(>|z|)    
#> (Intercept)  2.1354110  0.2386676  8.9472 < 2.2e-16 ***
#> log(pcap)    0.0044386  0.0545970  0.0813  0.935206    
#> log(pc)      0.3105484  0.0435922  7.1239 1.049e-12 ***
#> log(emp)     0.7296705  0.0699680 10.4286 < 2.2e-16 ***
#> unemp       -0.0061725  0.0023326 -2.6461  0.008141 ** 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Total Sum of Squares:    29.209
#> Residual Sum of Squares: 1.1879
#> R-Squared:      0.95933
#> Adj. R-Squared: 0.95913
#> Chisq: 4524.65 on 4 DF, p-value: < 2.22e-16
summary(zz, vcov = function(x) vcovHC(x, method="arellano", type="HC1"))
#> Oneway (individual) effect Random Effect Model 
#>    (Swamy-Arora's transformation)
#> 
#> Note: Coefficient variance-covariance matrix supplied: function(x) vcovHC(x, method = "arellano", type = "HC1")
#> 
#> Call:
#> plm(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, 
#>     data = Produc, model = "random")
#> 
#> Balanced Panel: n = 48, T = 17, N = 816
#> 
#> Effects:
#>                    var  std.dev share
#> idiosyncratic 0.001454 0.038137 0.175
#> individual    0.006838 0.082691 0.825
#> theta: 0.8888
#> 
#> Residuals:
#>       Min.    1st Qu.     Median    3rd Qu.       Max. 
#> -0.1067230 -0.0245520 -0.0023694  0.0217333  0.1996307 
#> 
#> Coefficients:
#>               Estimate Std. Error z-value  Pr(>|z|)    
#> (Intercept)  2.1354110  0.2394021  8.9198 < 2.2e-16 ***
#> log(pcap)    0.0044386  0.0547651  0.0810  0.935404    
#> log(pc)      0.3105484  0.0437264  7.1021 1.229e-12 ***
#> log(emp)     0.7296705  0.0701833 10.3966 < 2.2e-16 ***
#> unemp       -0.0061725  0.0023398 -2.6380  0.008339 ** 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Total Sum of Squares:    29.209
#> Residual Sum of Squares: 1.1879
#> R-Squared:      0.95933
#> Adj. R-Squared: 0.95913
#> Chisq: 4496.93 on 4 DF, p-value: < 2.22e-16

## standard coefficient significance test
library(lmtest)
coeftest(zz)
#> 
#> t test of coefficients:
#> 
#>                Estimate  Std. Error t value  Pr(>|t|)    
#> (Intercept)  2.13541100  0.13346149 16.0002 < 2.2e-16 ***
#> log(pcap)    0.00443859  0.02341732  0.1895    0.8497    
#> log(pc)      0.31054843  0.01980475 15.6805 < 2.2e-16 ***
#> log(emp)     0.72967053  0.02492022 29.2803 < 2.2e-16 ***
#> unemp       -0.00617247  0.00090728 -6.8033 1.986e-11 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
## robust significance test, cluster by group
## (robust vs. serial correlation)
coeftest(zz, vcov.=vcovHC)
#> 
#> t test of coefficients:
#> 
#>               Estimate Std. Error t value  Pr(>|t|)    
#> (Intercept)  2.1354110  0.2386676  8.9472 < 2.2e-16 ***
#> log(pcap)    0.0044386  0.0545970  0.0813  0.935226    
#> log(pc)      0.3105484  0.0435922  7.1239 2.317e-12 ***
#> log(emp)     0.7296705  0.0699680 10.4286 < 2.2e-16 ***
#> unemp       -0.0061725  0.0023326 -2.6461  0.008299 ** 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
## idem with parameters, pass vcov as a function argument
coeftest(zz, vcov.=function(x) vcovHC(x, method="arellano", type="HC1"))
#> 
#> t test of coefficients:
#> 
#>               Estimate Std. Error t value  Pr(>|t|)    
#> (Intercept)  2.1354110  0.2394021  8.9198 < 2.2e-16 ***
#> log(pcap)    0.0044386  0.0547651  0.0810  0.935424    
#> log(pc)      0.3105484  0.0437264  7.1021 2.689e-12 ***
#> log(emp)     0.7296705  0.0701833 10.3966 < 2.2e-16 ***
#> unemp       -0.0061725  0.0023398 -2.6380  0.008499 ** 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
## idem, cluster by time period
## (robust vs. cross-sectional correlation)
coeftest(zz, vcov.=function(x) vcovHC(x, method="arellano",
 type="HC1", cluster="group"))
#> 
#> t test of coefficients:
#> 
#>               Estimate Std. Error t value  Pr(>|t|)    
#> (Intercept)  2.1354110  0.2394021  8.9198 < 2.2e-16 ***
#> log(pcap)    0.0044386  0.0547651  0.0810  0.935424    
#> log(pc)      0.3105484  0.0437264  7.1021 2.689e-12 ***
#> log(emp)     0.7296705  0.0701833 10.3966 < 2.2e-16 ***
#> unemp       -0.0061725  0.0023398 -2.6380  0.008499 ** 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
## idem with parameters, pass vcov as a matrix argument
coeftest(zz, vcov.=vcovHC(zz, method="arellano", type="HC1"))
#> 
#> t test of coefficients:
#> 
#>               Estimate Std. Error t value  Pr(>|t|)    
#> (Intercept)  2.1354110  0.2394021  8.9198 < 2.2e-16 ***
#> log(pcap)    0.0044386  0.0547651  0.0810  0.935424    
#> log(pc)      0.3105484  0.0437264  7.1021 2.689e-12 ***
#> log(emp)     0.7296705  0.0701833 10.3966 < 2.2e-16 ***
#> unemp       -0.0061725  0.0023398 -2.6380  0.008499 ** 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
## joint restriction test
waldtest(zz, update(zz, .~.-log(emp)-unemp), vcov=vcovHC)
#> Wald test
#> 
#> Model 1: log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
#> Model 2: log(gsp) ~ log(pcap) + log(pc)
#>   Res.Df Df  Chisq Pr(>Chisq)    
#> 1    811                         
#> 2    813 -2 404.16  < 2.2e-16 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
if (FALSE) { # \dontrun{
## test of hyp.: 2*log(pc)=log(emp)
library(car)
linearHypothesis(zz, "2*log(pc)=log(emp)", vcov.=vcovHC)
} # }
## 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)
#> Common Correlated Effects Pooled model
#> 
#> Note: Coefficient variance-covariance matrix supplied: vcovHC
#> 
#> Call:
#> pcce(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, 
#>     data = Produc, model = "p")
#> 
#> Balanced Panel: n = 48, T = 17, N = 816
#> 
#> Residuals:
#>          Min.       1st Qu.        Median       3rd Qu.          Max. 
#> -0.0918842485 -0.0060964495  0.0005035279  0.0059795739  0.0682325143 
#> 
#> Coefficients:
#>             Estimate Std. Error z-value  Pr(>|z|)    
#> log(pcap)  0.0432376  0.0972332  0.4447    0.6566    
#> log(pc)    0.0363922  0.0322477  1.1285    0.2591    
#> log(emp)   0.8209632  0.1104438  7.4333 1.059e-13 ***
#> unemp     -0.0020925  0.0013959 -1.4990    0.1339    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> Total Sum of Squares: 849.81
#> Residual Sum of Squares: 0.11927
#> HPY R-squared: 0.99077

## 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)
#> 
#> 	Arellano-Bond autocorrelation test of degree 2, vcov: rv
#> 
#> data:  log(emp) ~ lag(log(emp), 1:2) + lag(log(wage), 0:1) + log(capital) +  ...
#> normal = -0.1165, p-value = 0.9073
#> alternative hypothesis: autocorrelation present
#>