I need a help on how to find a treatment effects using Heckman two steps method (Heckit), I need to find ATE (Average treatment Effects), TT (Treatment on treated) and MTE. I tried to do a simulation in R as you can see below but now I'm lost because I don't have a good background in econometrics or statistics. I took IMR direct and plug it in the Heckman formula, I don't know if I'm correct or not. I need your help to correct this.


n <- 500
rho <- 0.8
x1 <- rnorm(n)
x2 <- rnorm(n)
x3 <- rnorm(n)
sm <- diag(2); sm[1,2] <- sm[2,1] <- rho
err <- rmvnorm(n=n, mean=c(0,0), sigma=sm)
y <- as.numeric((0.25 * x1 - 0.25 * x2 + 0.25 * x3 - 0.25 + err[,1]) > 0)
y1 <- as.numeric((0.67 * x1 + 1.25 * x2 + 0.25 + err[,2]))
y0 <- as.numeric((0.50 * x1 + 0.38 * x2 + 0.50 + err[,2]))
simdata <- data.frame(y, y1, y0, x1, x2, x3)

**# Heckman two-step estimations with y as selection equation, y0 & y1 as outcomes**
Heckman1 <- heckit( y ~ x1 + x2 + x3, y1 ~ x1 + x2, data = simdata)
Heckman0 <- heckit(y ~ x1 + x2 + x3, y0 ~ x1 + x2, data = simdata)

summary(Heckman1) # print summary


XS <- data.frame(x1,x2) #Covariates from outcome equation
XS <- as.matrix(XS)

Average treatment effects, #From `ATE(x) =x'(B1 - B0)


#From the above information we can obtain the conditional means.
Ey1 <- as.numeric(mean(XS%*%coef(Heckman1)[6:7]) + Heckman1$rho*Heckman1$sigma*Heckman1$coefficients[8])
Ey0 <- as.numeric(mean(XS%*%coef(Heckman0)[6:7]) - Heckman0$rho*Heckman0$sigma*Heckman0$coefficients[8])

Effects of treatment on treated, TT = x'(B1-B0) + (ρ1σ1-ρ0σ0)IMR

TT <- as.numeric(ATE + (Heckman1$rho*Heckman1$sigma - Heckman0$rho*Heckman0$sigma)*Heckman1$coefficients[8])
  • $\begingroup$ Could you write IMR and MTE as non-abbreviations, thx. I would like to answer this question, when I find the time (hopefully during weekend). $\endgroup$ – Jesper for President Mar 1 '19 at 7:39
  • $\begingroup$ Hi Jesper, IMR is inverse mills ratio. MTE is Marginal Treatment Effects. I really appreciates your help on this. $\endgroup$ – Edwin Gasso Mar 2 '19 at 9:35
  • $\begingroup$ Is it supposed to be a Tobit-5/Switching regression model? I think something is wrong in your simulation. It seems to me you are assuming two underlying structural processes $y_0$ and $y_1$ but you then put these into a data.frame and do heckit-estimation - however these processes are not assumed observed. What is observed is determined by the selectionproces $y$. But maybe I'm misunderstanding which model it is you are trying to simulate? do you have a reference? $\endgroup$ – Jesper for President Mar 2 '19 at 10:49
  • $\begingroup$ You can check on this Heckman paper, I want to do like what he did in R nber.org/papers/w7950 Simple Estimators for Treatment Parameters in a Latent Variable Framework. This is my email h17edwga@du.se I will appreciate if I will get yours. $\endgroup$ – Edwin Gasso Mar 2 '19 at 16:04
  • $\begingroup$ I responded by mail $\endgroup$ – Jesper for President Mar 3 '19 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.