% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tool_vcovG.R
\name{vcovG}
\alias{vcovG}
\alias{vcovG.plm}
\alias{vcovG.pcce}
\title{Generic Lego building block for Robust Covariance Matrix Estimators}
\usage{
vcovG(x, ...)

\method{vcovG}{plm}(
  x,
  type = c("HC0", "sss", "HC1", "HC2", "HC3", "HC4"),
  cluster = c("group", "time"),
  l = 0,
  inner = c("cluster", "white", "diagavg"),
  ...
)

\method{vcovG}{pcce}(
  x,
  type = c("HC0", "sss", "HC1", "HC2", "HC3", "HC4"),
  cluster = c("group", "time"),
  l = 0,
  inner = c("cluster", "white", "diagavg"),
  ...
)
}
\arguments{
\item{x}{an object of class \code{"plm"} or \code{"pcce"}}

\item{\dots}{further arguments}

\item{type}{the weighting scheme used, one of \code{"HC0"},
\code{"sss"}, \code{"HC1"}, \code{"HC2"}, \code{"HC3"},
\code{"HC4"},}

\item{cluster}{one of \code{"group"}, \code{"time"},}

\item{l}{lagging order, defaulting to zero}

\item{inner}{the function to be applied to the residuals inside the
sandwich: one of \code{"cluster"} or \code{"white"} or
\code{"diagavg"},}
}
\value{
An object of class \code{"matrix"} containing the estimate
of the covariance matrix of coefficients.
}
\description{
Generic Lego building block for robust covariance matrix estimators
of the vcovXX kind for panel models.
}
\details{
\code{vcovG} is the generic building block for use by higher--level
wrappers \code{\link[=vcovHC]{vcovHC()}}, \code{\link[=vcovSCC]{vcovSCC()}}, \code{\link[=vcovDC]{vcovDC()}}, and \code{\link[=vcovNW]{vcovNW()}}. The
main use of \code{vcovG} is to be used internally by the former, but it
is made available in the user space for use in non--standard
combinations. For more documentation, see see wrapper functions
mentioned.
}
\examples{

data("Produc", package="plm")
zz <- plm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp, data=Produc,
model="pooling")
## reproduce Arellano's covariance matrix
vcovG(zz, cluster="group", inner="cluster", l=0)
## define custom covariance function
## (in this example, same as vcovHC)
myvcov <- function(x) vcovG(x, cluster="group", inner="cluster", l=0)
summary(zz, vcov = myvcov)
## use in coefficient significance test
library(lmtest)
## robust significance test
coeftest(zz, vcov. = myvcov)

}
\references{
\insertRef{mil17b}{plm}
}
\seealso{
\code{\link[=vcovHC]{vcovHC()}}, \code{\link[=vcovSCC]{vcovSCC()}},
\code{\link[=vcovDC]{vcovDC()}}, \code{\link[=vcovNW]{vcovNW()}}, and
\code{\link[=vcovBK]{vcovBK()}} albeit the latter does not make use of
vcovG.
}
\author{
Giovanni Millo
}
\keyword{regression}
