Also implements checks to ensure that all clusters are entirely treated or not treated.
Arguments
- data
Dataframe with 'clusterID' and 'Z' as columns. 'blockID' optional column. This is data in the "canonical form".
- formula
Notation for Y ~ Z | clusterID | blockID. If NULL, `data` is assumed to already be in canonical form.
- control_formula
What variables to control for, in the form of "~ X1 + X2". These will be averaged (or dummy-expanded and averaged, for categorical covariates) to the cluster level.