setup_vcov: Setup function for 'vcov_control' arguments

View source: R/initializers.R

setup_vcovR Documentation

Setup function for vcov_control arguments

Description

Returns a list with two elements called estimator and arguments. The element estimator is a string specifying the covariance matrix estimator to be used in the linear regression regression of interest and needs to be a covariance estimator function in the "sandwich" package. The second element, arguments, is a list of arguments that shall be passed to the function specified in the first element, estimator.

Usage

setup_vcov(estimator = "vcovHC", arguments = list(type = "const"))

Arguments

estimator

Character specifying a covariance matrix estimator in the "sandwich" package. Default is "vcovHC". Supported estimators are "vcovBS", "vcovCL", "vcovHAC", and "vcovHC".

arguments

A list of arguments that are to be passed to the function in the "sandwich" package that is specified in estimator. Default is list(type = "const"), which specifies the homoskedastic ordinary least squares covariance matrix estimator.

Details

The output of this setup function is intended to be used as argument in the functions GenericML() and GenericML_single() (arguments vcov_BLP, vcov_GATES), as well as BLP() and GATES() (argument vcov_control).

Value

An object of class "setup_vcov", consisting of the following components:

estimator

A character equal to covariance estimation function names in the "sandwich" package.

arguments

A list of arguments that shall be passed to the function specified in the estimator argument.

See the description above for details.

References

Zeileis A. (2004). “Econometric Computing with HC and HAC Covariance Matrix Estimators.” Journal of Statistical Software, 11(10), 1–17. doi: 10.18637/jss.v011.i10

Zeileis A. (2006). “Object-Oriented Computation of Sandwich Estimators.” Journal of Statistical Software, 16(9), 1–16. doi: 10.18637/jss.v016.i09

See Also

GenericML(), GenericML_single(), BLP(), GATES(), setup_X1(), setup_diff()

Examples

# use standard homoskedastic OLS covariance matrix estimate
setup_vcov(estimator = "vcovHC", arguments = list(type = "const"))

# use White's heteroskedasticity-robust estimator
setup_vcov(estimator = "vcovHC", arguments = list(type = "HC0"))

if (require("sandwich")){

# use HAC-robust estimator with prewhitening and Andrews' (Econometrica, 1991) weights
# since weightsAndrews() is a function in 'sandwich', require this package
setup_vcov(estimator = "vcovHAC", arguments = list(prewhite = TRUE, weights = weightsAndrews))

}


GenericML documentation built on June 18, 2022, 9:09 a.m.