# A little example with simulated data (2000 observations)
if (FALSE) {
n=2000 # sample size
p=100 # number of covariates
s=2 # number of covariates that are confounders
x=matrix(rnorm(n*p),ncol=p) # covariate matrix
beta=c(rep(0.25,s), rep(0,p-s)) # coefficients determining degree of confounding
d=(x%*%beta+rnorm(n)>0)*1 # treatment equation
y=x%*%beta+0.5*d+rnorm(n) # outcome equation
# The true ATE is equal to 0.5
output=treatDML(y,d,x)
cat("ATE: ",round(c(output$effect),3),", standard error: ",
round(c(output$se),3), ", p-value: ",round(c(output$pval),3))
output$ntrimmed}
Run the code above in your browser using DataLab