bartCause icon indicating copy to clipboard operation
bartCause copied to clipboard

Access to `icate` and `ite`

Open bonStats opened this issue 1 year ago • 1 comments

I'm not sure how to access to icate and ite...

As far as I can tell extract(model, type = "icate") and extract(model, type = "ite") don't return the individual treatment effects, they are constant across individuals in this MWE:

library(bartCause)
source(system.file("common", "friedmanData.R", package = "bartCause"))
testData <- generateFriedmanData(100, ranef = TRUE, causal = TRUE)
test.df <- with(testData, data.frame(x, y, z, g.1))
fit_sd <- bartc(y, z, X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 + X10,
                parametric = (1 | g.1), data = test.df,
                verbose = FALSE, seed = 5,
                commonSup.rule = "sd", commonSup.cut = 1, bart_args = list(keepTrees = TRUE))
refit_sd <- refit(fit_sd, commonSup.rule = "sd", commonSup.cut = 0.5)

extract(fit_sd, type = "icate")

Is the above code working as intended? And why?

If so, summary.bartcFit should produce the icate or ite for the CIs, is it possible to optionally output these as part of this function?

bonStats avatar Apr 27 '23 05:04 bonStats

Well, that was a silly omission on my part. z wasn't being added to the non-parametric formula for stan4bart models, so that the treatment was constant. Since that's probably a large reason to use the package, I've added it and (when applicable) the propensity score to the non-parametric component. They remain in the linear component. Should yield different results as of f84a1d1. I'll work on pushing that to CRAN in the near future.

vdorie avatar Apr 27 '23 15:04 vdorie