if (FALSE) {
# Example with simulated data
n=4000 # sample size
u=rnorm(n) # time constant unobservable
x=rnorm(n) # covariate
d=1*(x+0.5*u+rnorm(n)>0) # treatment
m=x+0.5*d+rnorm(n) # mediator
y0=u+rnorm(n) # outcome in the pre-treatment period
y1=x+1+d+m+u+rnorm(n) # outcome in the post-treatment period
# true NDET is equal to 1; true NIET is equal to 0.5; true ATET is equal to 1.5
didmedDMLpanel(y0=y0,y1=y1, d=d, m=m, x=x)
}
Run the code above in your browser using DataLab