You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using randtreat to assign treatment in RCTs (thanks!) and have a question on how randtreat handles observations that have missings in some of the variables listed in strata().
I bumped into this conundrum: if one of the stratifying variables has some missings, randtreat assigns treatment to those observations (it looks like it pools all observations that have a missing in any of the stratifying variables in one strata and randomizes within). The problem is, although I stratified by sex, I end up getting a strata of missings that contains both women and men. In other words, it assigned treatment to observations that had missing in some of the stratifying variables.
A minimal working example:
//The problem is, although I stratified by sex, I have a strata that contains both women and men.
sysuse bpwide, clear
//In this example, I want to create agegrp-sex strata. I force some observations to have missing in the agregrp or sex.
* I set missing observations in the two stratifying variables
replace agegrp = . if agegrp == 1 & bp_before < 152
replace sex = . if bp_before == 149
*assign treatment
randtreat, generate(treatment) replace strata(sex agegrp)
*create a strata variable so I can tabulate the stratifying variables against the groups
egen strata = group(sex agegrp)
tab sex treatment if strata == .
*I observe that the missing strata contains and has assigned treatment to both men and women
Any insight is highly appreciated! Pumi.
The text was updated successfully, but these errors were encountered:
I have been using randtreat to assign treatment in RCTs (thanks!) and have a question on how randtreat handles observations that have missings in some of the variables listed in strata().
I bumped into this conundrum: if one of the stratifying variables has some missings, randtreat assigns treatment to those observations (it looks like it pools all observations that have a missing in any of the stratifying variables in one strata and randomizes within). The problem is, although I stratified by sex, I end up getting a strata of missings that contains both women and men. In other words, it assigned treatment to observations that had missing in some of the stratifying variables.
A minimal working example:
Any insight is highly appreciated! Pumi.
The text was updated successfully, but these errors were encountered: