V(d) = E[Y(d_bar(H))] is the mean counterfactual outcome had
every subject been treated according to the rule d applied to
their own evolving history. It is estimated here by the
inverse-probability weighted (Hajek) form: C_i indicates that
the observed treatment history follows the rule at every time,
SW_i = prod_t P(D_it = d_it) / P(D_it = d_it | H_it) are
stabilised weights with the marginal treatment frequency in the
numerator and a pooled logistic fit on the history in the
denominator, and
V = sum_i C_i SW_i Y_i / sum_i C_i SW_i. When treatment is
independent of the history the propensity fit returns the marginal
frequency itself, every stabilised weight is exactly one, and V
reduces to the plain mean of Y over the subjects who follow the rule.
It is NOT true in general that the weights collapse merely because
everyone follows.
Arguments
- y
End-of-follow-up outcome, one entry per subject.
- D_history
Observed binary treatment, subjects by time points.
- H_history
Time-varying history, subjects by time points.
- regime_fn
The rule: a function applied elementwise to
H_history, or an n x T array of prescribed treatments, orNULLfor the threshold rule "treat once the history exceeds zero".
Value
List with estimate, value, n_follow,
sum_weights, mean_weight, max_weight,
ess, naive_mean, n_time, n.
References
Robins, J. M., Orellana, L. and Rotnitzky, A. (2008). Estimation and extrapolation of optimal treatment and testing strategies. Statistics in Medicine 27(23), 4678-4721. Petersen, M., Schwab, J., Gruber, S., Blaser, N., Schomaker, M. and van der Laan, M. (2014). Journal of Causal Inference 2(2), 147-185.
Examples
set.seed(7)
n <- 300; Tn <- 2
H <- matrix(rnorm(n * Tn), n, Tn)
D <- matrix(rbinom(n * Tn, 1, plogis(H)), n, Tn)
y <- rowSums(D * H) + rnorm(n)
Dyntmt(y, D, H, regime_fn = function(h) as.integer(h > 0))[c("estimate", "naive_mean", "ess")]
#> $estimate
#> [1] 0.8214663
#>
#> $naive_mean
#> [1] 0.4446377
#>
#> $ess
#> [1] 131.9383
#>
