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