data(c401k)
# Choose the first 500 units for a small example
c401k <- c401k[1:500,]
Y <- c401k$pira
X <- as.matrix(c401k[c("inc", "incsq", "marr", "male", "age", "agesq", "fsize" )])
D <- c401k$p401k
Z <- c401k$e401k
# high-level interface
est <- larf(Y~X, D, Z)
# make prediction based on new treatment status
D <- sample(D, 500, replace = TRUE)
prediction <- predict(est, cbind(1,X), D)Run the code above in your browser using DataLab