-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finding the Value of a Mult-arm Policy Tree and Gain (HTE) of Each Node #175
Comments
Hi @shafayetShafee, yes you are right, that is one way to calculate an estimate of a gain defined as the policy value over assigning everyone the control: If you prefer the binary matrix representation of pi.mat <- model.matrix(~ as.factor(pi_hat) - 1)
pi.mat[, -1] # arm 2 and 3 (That gain is also the same as For calculating leaf statistics, you can call |
Thanks a lot @erikcs for responding. To answer the second question, I have tried the following as per your suggestion and from the last code chunk of this vignette Leaf Statisticslibrary(dplyr) node.id <- predict(opt.tree, X.test, type = "node.id")
gamma_node_df <- data.frame(
node_id = node.id,
Gamma.matrix[-train, ],
allocated_arm = pi_hat - 1
)
colnames(gamma_node_df) <- c("node.id", "dr_score_0", "dr_score_1", "dr_score_2", "allocated_arm")
dr_score_per_leaf <- gamma_node_df %>%
group_by(node.id, allocated_arm) %>%
summarise(
across(
.cols = everything(),
.fns = list(mean = mean)
),
.groups = "drop"
)
dr_score_per_leaf
Calculating Gain in each Leaf (i.e Node)dr_score_per_leaf %>%
dplyr::transmute(
node.id,
allocated_arm,
gain_01 = dr_score_1_mean - dr_score_0_mean,
gain_02 = dr_score_2_mean - dr_score_0_mean
)
dr_score_per_leaf %>%
dplyr::transmute(
node.id,
allocated_arm,
gain_01 = dr_score_1_mean - dr_score_0_mean,
gain_02 = dr_score_2_mean - dr_score_0_mean
) %>%
tidyr::pivot_longer(
cols = -c(node.id, allocated_arm), values_to = "gain", names_prefix = "gain_0"
) %>%
filter(allocated_arm == name | allocated_arm == 0) %>%
mutate(
gain = if_else(allocated_arm == 0, 0, gain)
# setting 0 gain for group who will get nothing (i.e. will be allocated as control)
) %>%
group_by(node.id, allocated_arm) %>%
summarise(
gain = mean(gain),
.groups = "drop"
)
Now my question is,
|
Hello, GRF labs team, thank you for building and maintaining ML tools for causal inference. I have recently started using the packages -
{grf}
,{policytree}
and{maq}
for a multi-arm treatment data. However, I need guidance on,How can I measure the benefit of a multi-arm policy tree, that is, what is the expected uplift if I allocate the treatments as suggested by the policy tree?
How can I calculate the HTE (or uplift) for each suggested leaf of the multi-arm policytree?
Consider the following reprex from the
{policytree}
docs,Get the policy for the held out data,
Determining the value of the Policy Tree
Following the eqn. (11) from this paper, value of the policy,$\widehat V(\pi) = \frac{1}{n} \sum_{i=1}^{n}\langle \hat \pi(X_i), \widehat \Gamma_i \rangle$ where the policy $\pi(X_i)$ is a $K$ -dimensional vector where the $k^{th}$ element is equal to 1 if arm $k$ is assigned, and 0 otherwise and $\widehat \Gamma_i$ is the estimated DR score (eqn. 13).
So can I say, “Expected benefit per subject of the above treatment allocation would be 0.52 units and total benefit would be 1000 * 0.52 = 520 units” ??
Am I on the right track to answering my first question?
Also, How can I reach the answer to my second question?
The text was updated successfully, but these errors were encountered: