*! version 1.0.0 January 28, 2024

Title

ccv -- The Causal Cluster Variance Estimator

Syntax

ccv depvar treatment groupvar [if] [in], qk(#) pk(#) [options]

qk(#) proportion of clusters from population which are sampled in data.

pk(#) proportion of individuals from population which are sampled in data.

fe indicates that a fixed effects model is desired.

seed(#) set random-number seed to #.

reps(#) the number of sample split repetitions to increase precision of variance calculation.

Description

ccv implements the Causal Cluster Variance (CCV) an analytic variance estimator
proposed by Abadie et al. (2023) for models where average treatment
effects are desired, and where standard error estimates wish to account for clustering.
The CCV is a variance estimate which considers both the standard sampling component
which induces variance in estimated regression coefficients, but also incorporates
a design-based component, accounting for variability in estimates owing to treatment
assignment mechanisms (treatment variation between clusters). This design-based
component implies that the variance estimate is made with respects to the finite
population which a researcher is interested in studying, rather than infinite
data generating processes (DGPs) of this population. When the data which is used to estimate
treatment effects includes an important proportion of clusters in the full population,
standard cluster-robust standard errors conceptualized for infinite realizations of
DGPs can be substantially larger than CCV versions of these standard errors, which explicitly
account for clustered treatment assignment and treatment effect variation across clusters.

Following the details laid out fully in Abadie et al. (2023), the CCV is
suitable for OLS regressions of an outcome on a single (binary) treatment variable, or
for OLS regressions of an outcome variable on a single (binary) treatment variable, as
well as unit fixed effects. The estimation of the variance requires estimating various
sub-components, including both residuals and between-cluster variation in
treatment effects, and if these are estimated on the full sample, correlations between
estimation errors of sub-components generates biases. As such, sample splits are
conducted on data, and these separate variance components are estimaed in different samples.

ccv generates standard errors based on the CCV estimator for OLS or fixed
effect models, and for comparison reports (standard) robust and cluster-robust
standard errors. The ccv command allows for cases where all clusters are
observed, or where only some proportion of clusters are observed. Sampling
information about the proportion of clusters observed, as well as the proportion
of individuals sampled from the full population needs to be provided by the user.

The ccv command is closely related to the tscb (Two-Stage Cluster
Bootstrap) command. tscb (if installed) implements a bootstrap-version of the cluster
variance formula of Abadie et al. (2023), and shares quite a
similar syntax and logic. ccv requires the user-written moremata command,
and this should be installed from the SSC prior to running ccv.

Some further details related to this command can be found on an accompanying github page located at https://github.com/Daniel-Pailanir/TSCB-CCV.

Options

Main

qk(#) Indicates the proportion of clusters from the population which are
sampled in the data. This value should be strictly greater than 0, and less than
or equal to 1. Values of 1 imply that all clusters are observed in the data,
whereas values less than 1 imply that only this proportion of clusters were sampled.
This is required.

pk(#) Indicates the proportion of population from a given cluster
which is sampled. This value should be strictly greater than 0, and less than
or equal to 1. For example, if a 10% sample from a microdata census is used
as the estimation sample, this value should be indicated as 0.1. This is a
required option.

fe Indicates that the underlying estimator desired is a fixed effects estimator
where the dependent variable is regressed on treatment exposure as well as groupvar
fixed effects. In this case, the CCV estimator defined in Abadie et al. (2023)
section V will be implemented. If not specified, OLS regressions are implemented.

seed(#) seed define for pseudo-random numbers. This ensures that variance
estimates can be replicated exactly, despite the fact that certain components are
estimated off of (random) splits to the sample.

reps(#) The number of sample splits to be conducted to estimate variance components (refer to Abadie et al. (2023, section IV.A) for details). Default is 4.

Stored results

ccv stores the following in e():

Scalars

e(ATE) Average Treatment Effect

e(se_ccv) Causal Cluster Variance (CCV) standard error

e(se_robust) Heteroskedasticity robust standard error

e(se_cluster) Cluster robust standard error

e(reps) Number of sample splits

e(N_clust) Number of units (groups) observed in the original panel

Macros

e(cmd) Returns command name (ccv)

e(cmdline) Returns command as typed

e(depvar) Lists name of dependent variable

e(clustvar) Provides the name of the unit (group) variable

Examples

Load data from 1% extract from 2000 US Census (20-50 years old) Abadie et al. (2023).

. webuse set www.damianclarke.net/stata/

. webuse "census2000_1pc.dta", clear

Run regression without FE.

. ccv ln_earnings college state, pk(0.01) qk(1)

Using FE at state level.

. ccv ln_earnings college state, fe pk(0.01) qk(1)

Over another dependent variable.

. ccv hours college state, pk(0.01) qk(1)

Using FE at state level.

. ccv hours college state, fe pk(0.01) qk(1)

Using a bigger sample at 5 percent.

. webuse "census2000_5pc.dta", clear

. ccv ln_earnings college state, pk(0.05) qk(1)

. ccv ln_earnings college state, fe pk(0.05) qk(1)

References

Alberto Abadie, Susan Athey, Guido W Imbens, Jeffrey M Wooldridge (2023).
When Should You Adjust Standard Errors for Clustering?. The Quarterly Journal of Economics, 138(1):1-35.

Author

Damian Clarke, Universidad de Chile.
Email dclarke@fen.uchile.cl
Website http://www.damianclarke.net/

Daniel Pailañir, Universidad de Chile.
Email dpailanir@fen.uchile.cl
Website https://daniel-pailanir.github.io/

Website

ccv is maintained at https://github.com/Daniel-Pailanir/TSCB-CCV