# NOT RUN {
## generate data
set.seed(1)
n <- 100 # number of observations
p <- 5 # number of covariates
D <- rbinom(n, 1, 0.5) # random treatment assignment
Z <- matrix(runif(n*p), n, p) # design matrix
## estimate propensity scores via mean(D)...
propensity_score(Z, D, estimator = "constant")
## ... and via SVM with cache size 40
if(require("e1071")){
propensity_score(Z, D,
estimator = 'mlr3::lrn("svm", cachesize = 40)')
}
# }
Run the code above in your browser using DataLab