sandwich (version 2.4-0)

vcovBS: (Clustered) Bootstrap Covariance Matrix Estimation

Description

Estimation of basic bootstrap covariances, using a simple (clustered) case-based resampling. covariance matrices using an object-oriented approach.

Usage

vcovBS(x, …)

# S3 method for default vcovBS(x, cluster = NULL, R = 250, start = FALSE, …)

Arguments

x

a fitted model object.

cluster

a variable indicating the clustering of observations. By default each observation is its own cluster.

R

integer. Number of bootstrap replications.

start

logical. Should coef(x) be passed as start to the update(x, subset = ...) call? In case the model x is computed by some numeric iteration, this may speed up the bootstrapping.

arguments passed to methods (to update in case of the default method).

Value

A matrix containing the covariance matrix estimate.

Details

Basic (clustered) bootstrap covariance matrix estimation is provided by vcovBS. The default method samples clusters (where each observation is its own cluster by default), i.e. case-based resampling. For obtaining a covariance matrix estimate it is assumed that an update of the model with the resampled subset can be obtained, the coef extracted, and finally the covariance computed with cov.

Note: The update model is evaluated in the environment(terms(x)).

See Also

vcovCL

Examples

Run this code
# NOT RUN {
## Petersen's data
data("PetersenCL", package = "sandwich")
m <- lm(y ~ x, data = PetersenCL)

## comparison of different standard errors
set.seed(1)
cbind(
  "classical" = sqrt(diag(vcov(m))),
  "HC-cluster" = sqrt(diag(vcovCL(m, cluster = PetersenCL$firm))),
  "BS-cluster" = sqrt(diag(vcovBS(m, cluster = PetersenCL$firm)))
)
# }

Run the code above in your browser using DataLab