Treatment effect in Stata: RA: regression adjustment, IPW: inverse probability weighting, IPWRA, AIPW

Treatment effect in Stata: RA: regression adjustment, IPW: inverse probability weighting, IPWRA, AIPW

Original link: tecdat.cn/?p=10148

Original source: Tuoduan Data Tribe Official Account

 


 

Today's topic is the effect of treatment in Stata.

The treatment effect estimator estimates the causal relationship between the treatment and the result based on the observation data.

 We will discuss four treatment effect estimates:

  1. RA: regression adjustment
  2. IPW: Inverse probability weighting
  3. IPWRA: Inverse probability weighting with regression adjustment
  4. AIPW: Enhanced inverse probability weighting

 As with any regression analysis of observational data, the explanation of causality must be based on sound basic scientific principles.

Introduction

We will discuss treatment methods and results.

One treatment may be a new drug, the result of which is an increase in blood pressure or cholesterol levels. Treatment can be surgery or the outcome of patient activity. Treatment can be a vocational training program as well as employment or salary as a result. The treatment can even be an advertisement aimed at increasing product sales.

Consider whether the mother s smoking affects the baby s weight at birth. Only observational data can be used to answer such questions. 

The question of observing the data is whether the subject chooses to receive treatment. For example, the mother decides to smoke or not to smoke. It is said that these subjects have self-selected to enter the treatment group and the untreated group.

In an ideal world, we would design an experiment to test the relationship between causality and treatment outcome. We randomly assign subjects to treatment or untreated groups. Randomly assigning treatments ensures that treatments are independent of the outcome, which greatly simplifies the analysis.

Causal inference requires an unconditional estimate of the outcome of each treatment level. Regardless of whether the data is observational or experimental, we only observe the outcome of each subject conditioned on receiving treatment. For the experimental data, the random allocation of treatments ensures that the treatment is independent of the outcome. For the observation data, we model the treatment allocation process. If our model is correct, based on the covariates in our model, the treatment allocation process is considered as good as the random condition.

Let us consider an example. Figure 1 is a scatter plot similar to the observation data used by Cattaneo (2010). The treatment variable is the mother s smoking status during pregnancy, and the result is the baby s birth weight.

Red dots indicate mothers who smoked during pregnancy, while green dots indicate non-pregnant mothers. The mother chooses whether to smoke or not, which complicates the analysis.

We cannot estimate the effect of smoking on birth weight by comparing the average birth weight of smoking and non-smoking mothers. why not? Look at our chart again. Older mothers tend to be heavier, regardless of whether they smoked during pregnancy. In these data, older mothers are also more likely to smoke. Therefore, the age of the mother is related to the treatment status and outcome. So how should we proceed?

 

RA: Regression adjusted estimator

The RA estimator models the results to account for non-random treatment allocation.

We may ask: "If a smoking mother chooses not to smoke, how will the outcome change?" or "If a non-smoker mother chooses to smoke, how will the outcome change?". If we know the answers to these counterfactual questions, the analysis will be easy: we only need to subtract the observed results from the counterfactual results.

 We can construct metrics for these unobserved potential outcomes, and our data might look like this:

 

In Figure 2, solid dots are used to show the observed data, while hollow dots are used to show potential results that are not observed. The hollow red dots represent the potential consequences of a smoker not smoking. The hollow green dots represent the potential consequences of smoking for non-smokers.

We can estimate the unobserved potential results by fitting a separate linear regression model and the observed data (solid points) to the two treatment groups.

 

In Figure 3, we provide a regression line (green line) for non-smokers and a separate regression line (red line) for smokers.

Let us understand the meaning of these two lines:

 

 The green dots marked as " observed " on the left side of Figure 4 are observations of non-smokers. The point marked with E (y0) on the green regression line is the expected birth weight of a non-smoker taking into account the age of the mother. The point marked with E (y1) on the red regression line is the expected birth weight of the baby after smoking by the same mother.

The difference between these expectations estimates the covariate-specific treatment effect of untreated patients.

Now, let us look at another counterfactual question.

The red mark on the right side of Figure 4 as "  observed red" is the observation of mothers who smoked during pregnancy. The points on the green and red regression lines again represent the expected birth weight (potential outcome) of the mother and baby under the two treatment conditions.

The difference between these expectations estimates the covariate-specific treatment effect of the recipient.

Note that we estimate the average treatment effect (ATE) based on the covariate value of each variable. In addition, regardless of the actual treatment received, we estimate this effect for each subject. The average of these effects for all subjects in the data estimated ATE.

We can also use Figure 4 to stimulate predictions about the results that each subject will obtain at each level of treatment, regardless of the treatment received. The average of these predicted values for all subjects in the data estimates the potential outcome mean (POM) for each treatment level.

 The difference in the estimated POM is the same as the above-mentioned ATE estimation.

The ATE on the treated person (ATET) is similar to ATE, but only subjects observed in the treatment group are used. This method of calculating treatment effects is called regression adjustment (RA).

. webuse cattaneo2.dta, clear To estimate the POM in the two treatment groups, we enter . teffects ra (bweight mage) (mbsmoke), pomeans Copy code

We specify the outcome model in the first set of brackets, with the outcome variable and subsequent covariates. In this example, the result variable is bweight and the only covariate is mage .

We specify the processing model (only processing variables) in the second set of brackets. In this example, we only specify the processing variable mbsmoke . We will discuss covariates in the next section.

The result of typing the command is

Iteration 0: EE criterion = 7.878e-24 Iteration 1: EE criterion = 8.468e-26 Treatment-effects estimation Number of obs = 4642 Estimator: regression adjustment Outcome model: linear Treatment model: none -------------------------------------------------- ---------------------------- | Robust bweight | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+------------------------------------ ---------------------------- POmeans | mbsmoke | nonsmoker | 3409.435 9.294101 366.84 0.000 3391.219 3427.651 smoker | 3132.374 20.61936 151.91 0.000 3091.961 3172.787 -------------------------------------------------- ---------------------------- Copy code

The output report says that if all mothers smoke, the average birth weight will be 3132 grams, and if no mother smokes, the average birth weight will be 3409 grams.

We can estimate the ATE of smoking at birth weight by subtracting POM: 3132.374 3409.435 = -277.061. Get standard errors and confidence intervals:

Iteration 0: EE criterion = 7.878e-24 Iteration 1: EE criterion = 5.185e-26 Treatment-effects estimation Number of obs = 4642 Estimator: regression adjustment Outcome model: linear Treatment model: none -------------------------------------------------- ----------------------------- | Robust bweight | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------+----------------------------------- ----------------------------- ATE | mbsmoke | (smoker vs | nonsmoker) | -277.0611 22.62844 -12.24 0.000 -321.4121 -232.7102 --------------+----------------------------------- ----------------------------- POmean | mbsmoke | nonsmoker | 3409.435 9.294101 366.84 0.000 3391.219 3427.651 -------------------------------------------------- ----------------------------- Copy code

The output report is the same ATE we manually calculated: -277.061. ATE is the average of the difference between the birth weight when each mother smokes and the birth weight when no mother smokes.

 IPW: Inverse probability weighted estimator

The RA estimator models the results to account for non-random treatment allocation. Some researchers prefer to model the treatment allocation process instead of specifying a model for the outcome.

We know that in our data, smokers tend to be older than non-smokers. We also assume that the age of the mother directly affects birth weight. We observed this in Figure 1.

The graph shows that treatment allocation depends on the age of the mother. We hope there is a way to adjust this dependency. In particular, we want us to have more green dots at a higher age and red dots at a lower age. If this is done, the average birth weight of each group will change. We don't know how this will affect the mean difference, but we know it will be a better estimate of the difference.

To obtain similar results, we will weight smokers in the lower age group and non-smokers in the higher age group, and weight smokers in the higher age group and non-smokers in the lower age group.

We will adopt a probability model or logit model of the following form

Pr (woman smoking) = F (a + b * age)

Teffects uses logit by default, but we will specify the probit option for explanation.

Once we fit the model, we can obtain the predicted Pr (woman smoking) for each observation in the data. We call this p i . Then, when performing POM calculations (this is just an average calculation), we will use these probabilities to weight the observations. We weight the observed value of the smoker as 1/  pi so that the weight will be greater when the likelihood of becoming a smoker is less. We will weight the observations of non-smokers by 1/(1-  pi ) so that when the probability of non-smokers is small, the weight will be larger.

The result is that the following figure replaces Figure 1:

 

In Figure 5, larger circles indicate larger weights.

Use this IPW estimator to estimate POM

The results are

Iteration 0: EE criterion = 3.615e-15 Iteration 1: EE criterion = 4.381e-25 Treatment-effects estimation Number of obs = 4642 Estimator: inverse-probability weights Outcome model: weighted mean Treatment model: probit -------------------------------------------------- ---------------------------- | Robust bweight | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+------------------------------------ ---------------------------- POmeans | mbsmoke | nonsmoker | 3408.979 9.307838 366.25 0.000 3390.736 3427.222 smoker | 3133.479 20.66762 151.61 0.000 3092.971 3173.986 -------------------------------------------------- ---------------------------- Copy code

Our output report says that if all mothers smoke, the average birth weight will be 3133 grams, and if no mother smokes, the average birth weight will be 3409 grams.

This time, ATE is -275.5, if we type

(Output omitted) Copy code

We will learn that the standard error is 22.68 and the 95% confidence interval is [-319.9,231.0].

 

IPWRA: IPW with regression adjusted estimator

The RA estimator models the results to account for non-random treatment allocation. The IPW estimator models the treatment to account for non-random treatment allocation. The IPWRA estimator models results and treatment methods to illustrate non-random treatment options.

IPWRA uses IPW weights to estimate the corrected regression coefficients, which are then used to perform regression adjustments.

The covariates in the outcome model and the treatment model do not have to be the same. They are often not because the variables that affect the subject's choice of treatment group are usually different from the variables associated with the outcome. The IPWRA estimator is doubly robust, which means that if the treatment model or the outcome model (but not both) is specified by mistake, the effect estimate will remain consistent.

Let us consider a situation with more complex results and treatment models, but still using our low weight data.

The resulting model will include

  1. ****Mother's age
  2. **** Indices of prenatal examination in the first trimester
  3. ****Indicator of mother's marital status
  4. ****Indices for the first child

The treatment model will include

  1. All covariates of the resulting model
  2. Mother's age ^ 2
  3. Number of years of maternal education

We will also specify the aequations option, report the results and the coefficients of the treatment model.

Iteration 0: EE criterion = 1.001e-20 Iteration 1: EE criterion = 1.134e-25 Treatment-effects estimation Number of obs = 4642 Estimator: IPW regression adjustment Outcome model: linear Treatment model: probit -------------------------------------------------- ----------------------------- | Robust bweight | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------+----------------------------------- ----------------------------- POmeans | mbsmoke | nonsmoker | 3403.336 9.57126 355.58 0.000 3384.576 3422.095 smoker | 3173.369 24.86997 127.60 0.000 3124.624 3222.113 --------------+----------------------------------- ----------------------------- OME0 | mage | 2.893051 2.134788 1.36 0.175 -1.291056 7.077158 prenatal1 | 67.98549 28.78428 2.36 0.018 11.56933 124.4017 mmarried | 155.5893 26.46903 5.88 0.000 103.711 207.4677 fbaby | -71.9215 20.39317 -3.53 0.000 -111.8914 -31.95162 _cons | 3194.808 55.04911 58.04 0.000 3086.913 3302.702 --------------+----------------------------------- ----------------------------- OME1 | mage | -5.068833 5.954425 -0.85 0.395 -16.73929 6.601626 prenatal1 | 34.76923 43.18534 0.81 0.421 -49.87248 119.4109 mmarried | 124.0941 40.29775 3.08 0.002 45.11193 203.0762 fbaby | 39.89692 56.82072 0.70 0.483 -71.46966 151.2635 _cons | 3175.551 153.8312 20.64 0.000 2874.047 3477.054 --------------+----------------------------------- ----------------------------- TME1 | mmarried | -.6484821 .0554173 -11.70 0.000 -.757098 -.5398663 mage | .1744327 .0363718 4.80 0.000 .1031452 .2457202 | c.mage#c.mage | -.0032559 .0006678 -4.88 0.000 -.0045647 -.0019471 | fbaby | -.2175962 .0495604 -4.39 0.000 -.3147328 -.1204595 medu | -.0863631 .0100148 -8.62 0.000 -.1059917 -.0667345 _cons | -1.558255 .4639691 -3.36 0.001 -2.467618 -.6488926 -------------------------------------------------- ----------------------------- Copy code

The POmeans part of the output shows the POM of the two treatment groups. ATE is now calculated as 3173.369-3403.336 = -229.967.

The OME0 and OME1 sections show the RA coefficients of the untreated group and the treated group, respectively.

The TME1 part of the output shows the coefficients of the probabilistic processing model.

As in the first two cases, if we want ATE to have standard errors, etc., we will specify the ate option. If we need ATET, we can specify the atet option.

AIPW: Enhanced IPW Estimator

The IPWRA estimator models results and treatment methods to illustrate non-random treatment options. The same is true for the AIPW estimator.

The AIPW estimator adds a bias correction term to the IPW estimator. If the processing model is correctly specified, the deviation correction term is 0, and the model is simplified to an IPW estimator. If the treatment model is specified incorrectly, but the result model is specified correctly, the bias correction term corrects the estimator. Therefore, the bias correction term makes the AIPW estimator have the same double robustness as the IPWRA estimator.

The syntax and output of the AIPW estimator are almost the same as those of the IPWRA estimator.

Iteration 0: EE criterion = 4.632e-21 Iteration 1: EE criterion = 5.810e-26 Treatment-effects estimation Number of obs = 4642 Estimator: augmented IPW Outcome model: linear by ML Treatment model: probit -------------------------------------------------- ----------------------------- | Robust bweight | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------+----------------------------------- ----------------------------- POmeans | mbsmoke | nonsmoker | 3403.355 9.568472 355.68 0.000 3384.601 3422.109 smoker | 3172.366 24.42456 129.88 0.000 3124.495 3220.237 --------------+----------------------------------- ----------------------------- OME0 | mage | 2.546828 2.084324 1.22 0.222 -1.538373 6.632028 prenatal1 | 64.40859 27.52699 2.34 0.019 10.45669 118.3605 mmarried | 160.9513 26.6162 6.05 0.000 108.7845 213.1181 fbaby | -71.3286 19.64701 -3.63 0.000 -109.836 -32.82117 _cons | 3202.746 54.01082 59.30 0.000 3096.886 3308.605 --------------+----------------------------------- ----------------------------- OME1 | mage | -7.370881 4.21817 -1.75 0.081 -15.63834 .8965804 prenatal1 | 25.11133 40.37541 0.62 0.534 -54.02302 104.2457 mmarried | 133.6617 40.86443 3.27 0.001 53.5689 213.7545 fbaby | 41.43991 39.70712 1.04 0.297 -36.38461 119.2644 _cons | 3227.169 104.4059 30.91 0.000 3022.537 3431.801 --------------+----------------------------------- ----------------------------- TME1 | mmarried | -.6484821 .0554173 -11.70 0.000 -.757098 -.5398663 mage | .1744327 .0363718 4.80 0.000 .1031452 .2457202 | c.mage#c.mage | -.0032559 .0006678 -4.88 0.000 -.0045647 -.0019471 | fbaby | -.2175962 .0495604 -4.39 0.000 -.3147328 -.1204595 medu | -.0863631 .0100148 -8.62 0.000 -.1059917 -.0667345 _cons | -1.558255 .4639691 -3.36 0.001 -2.467618 -.6488926 -------------------------------------------------- ----------------------------- Copy code

The ATE is 3172.366 3403.355 = -230.989.

At last

The example above uses a continuous result: birth weight. teffects can also be used for binary, counting and non-negative continuous results.

The estimate also allows multiple treatment categories.


references:

[1] Cattaneo, MD 2010. Efficient semiparametric estimation of multi-valued treatment effects under ignorability.  Journal of Econometrics  155: 138 154.


Most popular insights

1. R language multivariate logistic logistic regression application case

2. Implementation of panel smooth transfer regression (PSTR) analysis case

3. Partial least squares regression (PLSR) and principal component regression (PCR) in matlab

4. R language Poisson regression model analysis case

5. Hosmer-Lemeshow goodness-of-fit test in R language regression

6. Implementation of LASSO regression, Ridge regression and Elastic Net model in r language

7. Realize Logistic regression in R language

8. Python uses linear regression to predict stock prices

9. How does R language calculate IDI and NRI indicators in survival analysis and Cox regression