Skip to contents

cluster_vcov() is deprecated and is not used by csdm() estimators. For an ordinary OLS model, use sandwich::vcovCL() instead. The function remains available temporarily so existing code can migrate.

Usage

cluster_vcov(X, u, cluster, df_correction = TRUE, type = c("oneway", "twoway"))

Arguments

X

Numeric design matrix (n x k) used in OLS.

u

Numeric residual vector (length n).

cluster

One of:

  • a vector (length n) of cluster ids for one-way clustering; or

  • a data.frame/list with two vectors (each length n) for two-way clustering.

df_correction

Logical; apply small-sample corrections. Default TRUE.

type

Character, one of "oneway" or "twoway".

Value

A k x k variance-covariance matrix.

Deprecation

This low-level matrix utility is not a covariance method for csdm_fit objects. Applying it to stacked CCE residuals does not produce the mean-group covariance reported by vcov().