GradedInterventionTimeSeries.effect#
- GradedInterventionTimeSeries.effect(window, channels=None, scale=0.0)[source]#
Estimate the causal effect of scaling treatment channels in a time window.
This method computes a counterfactual scenario by scaling the specified treatment channels in the given window, reapplying all transforms with the same parameters, and comparing to the observed outcome.
For Bayesian models, returns posterior distributions of effects with credible intervals. For OLS models, returns point estimates.
- Parameters:
- Returns:
result – Dictionary containing: - “effect_df”: DataFrame with observed, counterfactual, effect, cumulative effect - “total_effect”: Total effect in window (mean for Bayesian) - “mean_effect”: Mean effect per period in window For Bayesian models, also includes HDI bounds for counterfactual and effect.
- Return type:
Dict
Examples
# Estimate effect of removing treatment completely effect = result.effect( window=(df.index[0], df.index[-1]), channels=["comm_intensity"], scale=0.0, ) print(f"Total effect: {effect['total_effect']:.2f}")