# \donttest{
#let's say we want to get the unweighted DIM and the weighted DIM using weights from the kbal
#function with the lalonde data:
#load and clean data a bit
set.seed(123)
data("lalonde")
# Select a random subset of 500 rows
lalonde_sample <- sample(1:nrow(lalonde), 500, replace = FALSE)
lalonde <- lalonde[lalonde_sample, ]
xvars=c("age","black","educ","hisp","married","re74","re75","nodegr","u74","u75")
#get the kbal weights
kbalout= kbal(allx=lalonde[,xvars],
sampledinpop=FALSE,
treatment=lalonde$nsw)
#now use dimw to get the DIMs
dimw(X = lalonde[,xvars], w = kbalout$w, target = lalonde$nsw)# }
Run the code above in your browser using DataLab