Hello everyone,
I have a question regarding the implementation of the "teffects ipw" command in combination with sample weights (pweights). Unfortunately my data is confidential so I can't post the actual data and results from Stata. I also tried to recreate the problem with made up data but didn't succed, so I will try to make the problem clear with an appropirate example. I use Stata 14 and make use of the inbuild teffects ipw command:
The data structure would look something like this:
Where id is the individual identifier, wage is the persons wage, t is a dummy indicating treatment (on the job training), sex is a dummy for gender, age is the age and sample_weight are the probability weights for an individual of being sampled.
I want to estimate the average treatment effect of the treatment t, controlling for different distributions of the covariates in treatment and control group. I use inverse probability weighting for this, so my code would look something like this:
If I run it like this, the IPW works fine and the covariates are very balanced between treatment and control group after reweighting through IPW.
However, older people and man (sex==1) have a lower probability of being sample, so I should use the probability weights stored in "sample_weights". pweights are allowed with teffects, so I tried just using them in my treatment effect estimation i.e. I used:
However, now IPW doesn't work that well anymore since the covariates are not balanced anymore after reweighting through IPW, i.e. tebalance summarize still gives substantial differences in the means of the covariates in treatment and control group after reweighting.
My question would be if anyone knows why this is and if there is a way to fix this?
I tried recreating the teffects ipw command by hand, which is not that complicated at least if one is only interested in the treatment effect and not its standard error. The "hand-build" IPW would look like this:
The coefficient on t is then the treatment effect estimated by teffects ipw. However, I was only able to recreate it for the unweighted case. I don't really know how the teffects ipw command deals with the additional pweights and couldn't find any documentation anywhere, e.g. if it uses them in the regression for the ipw_weights and the outcome regression or only in one of those. If anyone has an idea how to fix this, I would be very thankful. Thanks in advance. Sorry for the lohn post if anything remained unclear I happy to clarify,
Julian
I have a question regarding the implementation of the "teffects ipw" command in combination with sample weights (pweights). Unfortunately my data is confidential so I can't post the actual data and results from Stata. I also tried to recreate the problem with made up data but didn't succed, so I will try to make the problem clear with an appropirate example. I use Stata 14 and make use of the inbuild teffects ipw command:
The data structure would look something like this:
id | wage | t | sex | age | sample_weight |
1 | 100 | 1 | 0 | 23 | 100 |
2 | 40 | 0 | 1 | 38 | 500 |
3 | 60 | 0 | 0 | 45 | 250 |
4 | 80 | 1 | 1 | 25 | 180 |
I want to estimate the average treatment effect of the treatment t, controlling for different distributions of the covariates in treatment and control group. I use inverse probability weighting for this, so my code would look something like this:
Code:
teffects ipw (wage) (t sex age), ate tebalance summarize
If I run it like this, the IPW works fine and the covariates are very balanced between treatment and control group after reweighting through IPW.
However, older people and man (sex==1) have a lower probability of being sample, so I should use the probability weights stored in "sample_weights". pweights are allowed with teffects, so I tried just using them in my treatment effect estimation i.e. I used:
Code:
teffects ipw (wage) (t sex age) [pweight=sample_weight], ate tebalance summarize
My question would be if anyone knows why this is and if there is a way to fix this?
I tried recreating the teffects ipw command by hand, which is not that complicated at least if one is only interested in the treatment effect and not its standard error. The "hand-build" IPW would look like this:
Code:
*Create IPW weights . logit t sex age . predict ps . gen ipw_weight=1/ps if t==1 . replace ipw_weight=1/(1-ps) if t==0 *Normalize weights . sum ipw_weight . scalar ipw_weight=r(mean) . scalar n_sample=r(N) . gen ipw_weight_normalized=n_sample/(n_sample*ipw_weight) if t==1 . replace ipw_weight_normalized=(n_sample*ipw_weight)/((n_sample*ipw_weight)) if t==0 *Determine Treatment Wffect . reg wage t [pweight=ipw_weight_normalized]
Julian
Comment