Open benthestatistician opened 2 years ago
(Xinhe and Josh, pls don't hesitate to update & add appropriate detail to issue statement.)
The 2 papers I shared w/ @jwasserman2 today, as sources about the econometric conventional wisdom regarding sandwich estimation of covariance after paired assignment of clusters:
@jwasserman2 and I had a brief discussion today of the implementation of logic deciding which flavor of design-based variance estimator should be applied in which strata. This post is a followup to that discussion.
It would be useful for this purpose to have abstracted a table from the Design tallying the numbers of assignment unit by block, e.g.
Condi | tion | |
---|---|---|
Block | C | T |
B1 | 1 | 3 |
B2 | 2 | 2 |
I promised I'd poke around for some related code elsewhere. Found it not to exist in the form that I had remembered. But I'll point out that flexida::treatment_table()
is doing something related and is perhaps adaptible to this purpose.
Edit: Nevermind I was completely misremembering how that function worked. I do agree that a more generic table'ing function could be useful.
I expanded treatment_table
into the new dtable()
function (alias'd to design_table()
for now but I'm considering removing that).
dtable(design, "treatment")
replicates the existing functionality of treatment_table()
, but now supports e.g. dtable(design, "t", "b")
to obtain the table you drew above.
> data(simdata)
> des <- rct_design(z ~ uoa(cid1, cid2) + block(bid), data = simdata)
> dtable(des, "tr", "bl")
treatment
blocks 0 1
1 3 1
2 2 1
3 1 2
(The 2nd and 3rd arguments, x
and optionally y
, match against the full names "treatment", "blocks", etc, so x = "tre"
for example is valid.)
Thoughts on some of the implementation here, specifically the "cluster level" dispatch, have been updated by #85
Please see list of outstanding to-do's for the vignette at top of thread for #179.