metacausal.aggregation.dr_pseudo_outcome

metacausal.aggregation.dr_pseudo_outcome(Y, T, nuisance)[source]

Compute the DR/AIPW pseudo-outcome for each observation.

Gamma_i = (mu1_hat - mu0_hat)
          + T * (Y - mu1_hat) / e_hat
          - (1 - T) * (Y - mu0_hat) / (1 - e_hat)

This is doubly robust: unbiased for tau*(X) whenever either the propensity model or the outcome models are correctly specified. With oracle nuisance, E[Gamma_i | X_i] = tau*(X_i).

Parameters:
  • Y (array of shape (n,))

  • T (array of shape (n,)) – Binary treatment assignment.

  • nuisance (NuisanceEstimates) – Must have e_hat already trimmed (no division by zero).

Returns:

Array of shape (n,).

Return type:

ndarray