benbhansen-stats / propertee

Prognostic Regression Offsets with Propagation of ERrors, for Treatment Effect Estimation (IES R305D210029).
https://benbhansen-stats.github.io/propertee/
Other
2 stars 0 forks source link

Clustering for small blocks #154 #161

Closed jwasserman2 closed 8 months ago

jwasserman2 commented 8 months ago

Example using simdata:

> des <- rct_design(z ~ cluster(cid1, cid2) + block(bid), simdata)
> design_table(des, "t", "b")
      treatment
blocks 0 1
     1 3 1
     2 2 1
     3 1 2
> mod <- lmitt(y ~ 1, design = des, data = simdata)
The Design object contains block-level information, but it is not used in this model. Block information is used when weights are defined via `ate()` or `ett()` or if the `absorb=TRUE` argument is passed.
> .make_uoa_ids(mod, "MB")
bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1 bid1
bid1 bid1 bid1 bid1 bid1 bid2 bid2 bid2 bid2 bid2 bid2 bid2 bid2 bid2 bid2
bid2 bid2 bid2 bid2 bid3 bid3 bid3 bid3 bid3 bid3 bid3 bid3 bid3 bid3 bid3
bid3 bid3 bid3 bid3 bid3
Levels: bid1 bid2 bid3
> .make_uoa_ids(mod, "DB")
 [1] 1_1 1_1 1_1 1_1 1_2 1_2 1_2 1_2 1_2 1_2 2_1 2_1 2_1 2_1 2_2 2_2 2_2 2_2 2_2
[20] 2_2 3_1 3_1 3_1 3_1 3_2 3_2 3_2 3_2 3_2 3_2 4_1 4_1 4_1 4_1 4_2 4_2 4_2 4_2
[39] 4_2 4_2 5_1 5_1 5_1 5_1 5_2 5_2 5_2 5_2 5_2 5_2
Levels: 1_1 1_2 2_1 2_2 3_1 3_2 4_1 4_2 5_1 5_2

The replaced ID's have bid in front of them to distinguish them from units at the assignment level labeled "1", "2", or "3"

benthestatistician commented 8 months ago

Nice work. How about changing the Roxygen title for identify_small_blocks() to use "fine strata", e.g.

##' @title Identify fine strata (blocks with one treated or one control unit of assignment)

instead of

##' @title Identify "small" blocks (one treated or one control unit of assignment)

? (I know, momentous suggestion.)