grf-labs/policytree

Can policy_tree handle missing values in covariate space (X)?

Opened this issue · 1 comments

I am using policytree, version 1.2.0, and I am specifically trying to implement policy learning on the doubly robust reward estimates derived from an honest causal forest (GRF package). While I believe that the GRF package can handle missing covariates (X), see info at link here, it appears that policy_tree cannot handle missing values, is that correct?

When I try running the following code, I get the error, "Covariate matrix X contains missing values". However, I did not get any error when running the causal forest on the same dataset. Please assist - thanks!

Compute doubly robust reward estimates from causal forest

Gamma.matrix <- double_robust_scores(causalf)
head(Gamma.matrix)

Fit a depth 2 tree on a random training subset of my sample

N = as.numeric(length(Y))
train <- sample(1:N, 3000)
opt.tree <- policy_tree(X[train, ], Gamma.matrix[train, ], depth = 2) This is where the error arose
opt.tree

Hi @njawadekar,
Sorry, policy_tree currently does not support missing X's. You could fit it using the non-missing units.

subset <- complete.cases(X)
tree <- policy_tree(X[subset, ], Gamma.matrix[subset, ])