Skip to contents

Compute robust sandwich variance estimates with optional covariance adjustment

Usage

vcov_tee(x, type = "CR0", cluster = NULL, ...)

.vcov_DB0(x, ...)

Arguments

x

a fitted teeMod model

type

a string indicating the desired variance estimator. See Details for supported variance estimators

cluster

a string or character vector of column names indicating columns to cluster standard errors by. With prior covariance adjustment, columns must appear in both the covariance adjustment and direct adjustment samples. Default is NULL, which uses unit of assignment columns in the StudySpecification slot of the teeMod model.

...

arguments to be passed to the internal variance estimation function.

Value

A \(2\times 2\) matrix corresponding to an intercept and the treatment variable in the direct adjustment model

Details

Supported type include:

  • "MB0", "HC0", and "CR0" for model-based HC0 standard errors

  • "MB1", "HC1", and "CR1" for model-based standard errors with HC1 corrections based on the direct adjustment estimate i.e., \(n/(n - 2)\) for "MB1" and "HC1", and for "CR1", \(g\cdot(n-1)/((g-1)\cdot(n-2))\), where \(g\) is the number of clusters in the direct adjustment sample.

  • "DB0" for specification-based HC0 variance estimates

To create your own type, simply define a function .vcov_XXX. type = "XXX" will now use your method. Your method should return a matrix of appropriate dimension, with attribute type = "XXX".

The specification-based variance estimates can be calculated for teeMod models satisfying the following requirements:

  • The model uses rct_spec as StudySpecification

  • The model only estimates a main treatment effect

  • Inverse probability weighting is incorporated