2
$\begingroup$

I'm analyzing a survey experiment data with a factorial design with $2 \times 2$, where each factor is randomly assigned with equal probability.

I'd also like to know the heterogeneous effect of the causal interaction effect of two treatment factors. $$ \tau(x) = E[T_1=1, T_2 =1|X_i = x]-E[T_1=1, T_2 = 0|X_i = x] - (E[T_1 = 0, T_2 = 1|X_i = x] -E[T_1 = 0, T_2 = 0|X_i = x]) $$ To do so, I'm using the causal forest proposed by Athey and Wagner (2018) ran through R package grf.

However, so far, It appears to me grf package cannot be run unless the dataset has only one treatment factor. I haven't found a way to examine the heterogeneous effect of a combination of two treatment factors. (i.e., how treatment factor A affects the effect of treatment factor B. )

Is there a way to perform this sort of analysis using grf, or any other software or package?

The closest case I've found is the application of causal forest on difference-in-difference setting: The Effect of Medicaid Expansion on Wait Time in the Emergency Department The authors seek to find the heterogeneous effect of Medicaid expansion in a setting of DID, and they first calculate the outcome differences between pre- and post-expansion periods and then run a causal forest to estimate HTE.

May 16 update

I've followed the advice of @dimitry. However, I came to know what I calculated was--the column pred_diff in the pred_m_z1z2, in the last code-- was indeed $E(T_1) - E(T_2)$. And this is not equivalent to my quantity of interest that captures how $T_1$ influences the impact of $T_2$.

## creating causal forest models for each treatment variable, z1 and z2
X <-model.matrix(~0 + ., data = d3[, c("X1", "X2")])
m_z1<-causal_forest(X = X, 
                    Y = Y, 
                    W = W1_21, 
                    W.hat = 0.5,
                    clusters = d3$ResponseId_n, num.trees = 2000, seed = 0503)
m_z2<-causal_forest(X = X, 
                Y = Y, 
                W = W2_21, 
                W.hat = 0.5,
                clusters = d3$ResponseId_n, num.trees = 2000, seed = 0503)

## creating data matrix needed to calculate predicted effects for combination values of covariates, X1 and X2
n<-crossing(d3$X1, d3$X2)
xtest <- matrix(0, nrow(n), ncol(X))
xtest[,1] <- n[,1] %>% pull()
xtest[,2] <- n[,2] %>% pull()
colnames(xtest)<-colnames(X)

# and providing predicted treatment effect 
pred_m_z1<-predict(m_z1, 
                   newdata = xtest_21_pri_prty,
                   estimate.variance = T) %>%
  as.data.frame() %>% 
  mutate(X1 = xtest[,1],
         X2 = xtest[,2])

pred_m_z2<-predict(m_z2, 
                   newdata = xtest_21_pri_prty,
                   estimate.variance = T) %>%
  as.data.frame() %>% 
  mutate(X1 = xtest_21[,1],
         X2 = xtest_21[,2])

# substracting predicted values
pred_m_z1z2 <-pred_m_z1 %>%
  mutate(predictions_z1 = predictions, variance.estimates_z1 = variance.estimates) %>%
  select(-predictions, -X1, -X2, -variance.estimates) %>% #
  cbind(pred_m_z2) %>%
  mutate(pred_diff = predictions_z1 - predictions) #E(Z1) - E(Z2) for combination values of covariates

Update May 18

I came to know there is model-based causal forests, model4you, that has a very similar functioning to the grf package. Paper 1, Paper 2

And the main difference is the one that identifies subgroups having similar model parameters rather than similar treatment effects.

In this package, I can examine heterogeneous treatment effects using the OLS model with coefficient terms for T1, T2 and their interaction.

$ Y = \alpha + \beta_1 \times T_1 + \beta_2 \times T_2 + \beta_3 \times T_1 \times T_2 $

m1 <- lm(dv~Z1*Z2)
pm1 <- pmforest(m1)

However, since the model-based will find subgroups having similar levels of all four terms, $\alpha, \beta_1, \beta_2, \beta_3$, I believe this might not split subgroups based only on the $b3$ coefficient, which is somewhat different from what I've wanted.

I'd like to know am I correct on this. And it would be grateful if you let me know how to split subgroups based on a combination of treatment effects, $\beta_3$.

Thanks.

$\endgroup$
10
  • $\begingroup$ You should clearly state what your question is. An explanation or a link pointing to this idea "by Athey and Wager", (which I believe to be a paper?) would help those unacquainted with it. Finally, when referring to a package/library/module, state from which language/software it is, and also put it in the tag (will help your question reach the relevant audience). $\endgroup$ Commented May 5 at 19:05
  • 1
    $\begingroup$ Sorry about that, @LucasFarias . I have made some revisions to my post to make my question clearer. $\endgroup$
    – Jin
    Commented May 6 at 5:28
  • $\begingroup$ Have you considered pairwise CFs? $\endgroup$
    – dimitriy
    Commented May 6 at 5:48
  • $\begingroup$ @dimitriy Thanks for your comment! Could you provide more information? I am not familiar with pairwise CFs... $\endgroup$
    – Jin
    Commented May 6 at 5:57
  • 1
    $\begingroup$ Not sure if this is exactly what you're looking for but Modified Causal Forests extends the Athey/Wagner theoretical contributions to the case of multiple treatments. There's a implementation in Python here. See links at the bottom of the page for the theoretical papers: mcfpy.github.io/mcf/#id1 $\endgroup$
    – num_39
    Commented May 18 at 13:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.