Hello,
I am doing a simple simulation with stata12 which contains one variable (x), an outcome y and a binary treatment indicator (d). If i generate x then all observations are part of the same distribution regardless of the distribution of the treatment and control group after the attribution to one of the groups. But is it possible to have different distributions of x for the treated and control observations? Because in reality you are often confronted with groups that differ in their initial distribution(s) of x (treated individuals might be older than controls for example, etc...). The thing is that you somehow have to set the distribution before the assignment to treatment or control group is conducted. I do not really like my solution so far, maybe someone comes up with a better idea:
set obs 200
generate x=rnormal()
replace x=rnormal(2,1) if _n>150
gen u = invnorm(uniform())
gen e = invnorm(uniform())
gen d=-0.5+1.5*x+u
replace d=(d>1)
gen y=10*x+d*100+e
The thing is that all observations >150 have a much higher chance to get treated. So I kind of created two "subpopulations", but still this is not exactly what I am looking for. I want to generate 200 observations with x, then comes the assignment to treatment and now I want to (somehow backwards) say: ok now change the initial distribution of x for treatment and controls. Later on I want to conduct propensity score matching using psmatch2.
I appreciate any help!!
I am doing a simple simulation with stata12 which contains one variable (x), an outcome y and a binary treatment indicator (d). If i generate x then all observations are part of the same distribution regardless of the distribution of the treatment and control group after the attribution to one of the groups. But is it possible to have different distributions of x for the treated and control observations? Because in reality you are often confronted with groups that differ in their initial distribution(s) of x (treated individuals might be older than controls for example, etc...). The thing is that you somehow have to set the distribution before the assignment to treatment or control group is conducted. I do not really like my solution so far, maybe someone comes up with a better idea:
set obs 200
generate x=rnormal()
replace x=rnormal(2,1) if _n>150
gen u = invnorm(uniform())
gen e = invnorm(uniform())
gen d=-0.5+1.5*x+u
replace d=(d>1)
gen y=10*x+d*100+e
The thing is that all observations >150 have a much higher chance to get treated. So I kind of created two "subpopulations", but still this is not exactly what I am looking for. I want to generate 200 observations with x, then comes the assignment to treatment and now I want to (somehow backwards) say: ok now change the initial distribution of x for treatment and controls. Later on I want to conduct propensity score matching using psmatch2.
I appreciate any help!!
Comment