Treatment Effects#

Treatment effect estimators.

class pyrake.estimation.treatment_effects.DoubleSamplingEstimand(estimand1, estimand2)[source]#

Bases: Estimand

Estimand combining two sampling mechanisms.

Parameters:
  • estimand1 (SimpleEstimand) – The two sampling-mechanism estimands whose weights multiply.

  • estimand2 (SimpleEstimand) – The two sampling-mechanism estimands whose weights multiply.

property weights#

Calculate weights based on propensity scores.

Returns:

weights – Elementwise product of the two mechanism weight vectors.

Return type:

(M,) npt.NDArray[np.float64]

sensitivity_region(gamma)[source]#

Calculate a sensitivity region around baseline weights.

Parameters:

gamma (float) – The Gamma factor. Must be >= 1.0.

Returns:

lower, upper – Elementwise products of the two mechanisms’ bound vectors.

Return type:

(M,) npt.NDArray[np.float64]

resample(bootstrap_indices)[source]#

Create a new Estimand object based on resampled indices.

Parameters:

bootstrap_indices ((B,) npt.NDArray[np.int64]) – Row positions to retain in the resampled estimand.

Returns:

estimand – New estimand built from the indexed rows of both mechanisms.

Return type:

DoubleSamplingEstimand

static normalizing_factor(sample_size, population_size)[source]#

Calculate normalizing factor.

Raises:

NotImplementedError – Always raised; double sampling has no single normalizing factor.

class pyrake.estimation.treatment_effects.TreatmentEffectEstimator(control_estimator, treated_estimator)[source]#

Bases: WeightingEstimator

Estimator for the difference between treated and control means.

Parameters:
  • control_estimator (MeanEstimator or RatioEstimator) – Estimators for the control- and treated-group quantities. The point estimate is their difference.

  • treated_estimator (MeanEstimator or RatioEstimator) – Estimators for the control- and treated-group quantities. The point estimate is their difference.

point_estimate()[source]#

Calculate a point estimate.

Returns:

estimate – Treated point estimate minus control point estimate.

Return type:

float

variance()[source]#

Calculate the variance.

Returns:

variance – Sum of the treated and control sampling variances.

Return type:

float

pvalue(null_value=0.0, alternative='two-sided')[source]#

Calculate a p-value.

Computes a p-value against the null hypothesis:

H0: TE = ``null_value``,

where TE is the treatment effect.

Parameters:
  • null_value (float) – The hypothesized treatment effect.

  • alternative (["two-sided", "less", "greater"], optional) –

    What kind of test:

    • ”two-sided”: H0: TE = null_value vs Halt: TE <> null_value.

    • ”greater”: H0: TE <= null_value vs Halt: TE > null_value.

    • ”less”: H0: TE >= null_value vs Halt: TE < null_value.

    For example, specifying alternative = “greater” returns a p-value that quantifies the strength of evidence against the null hypothesis that the treatment effect is less than null_value, in favor of the alternative hypothesis that the treatment effect is actually greater than null_value. Defaults to “two-sided”.

Returns:

p – P-value.

Return type:

float

Raises:

ValueError – If alternative is not recognized (propagated from pvalue).

adjusted_pvalue(null_value=0.0, gamma=6.0, alternative='two-sided', bootstrap=True, B=1000, seed=None)[source]#

Calculate a p-value adjusted for hidden bias.

See WeightingEstimator.adjusted_pvalue for full documentation.

Parameters:
  • null_value (float, optional) – The hypothesized treatment effect. Defaults to 0.0.

  • gamma (float, optional) – The Gamma factor. Must be >= 1.0. Defaults to 6.

  • alternative (["two-sided", "less", "greater"], optional) – Defaults to “two-sided”.

  • bootstrap (bool, optional) – If True (default), use the percentile bootstrap. If False, use the normal approximation (no resampling).

  • B (int, optional) – Number of bootstrap replications. Ignored when bootstrap=False. Defaults to 1_000.

  • seed (int, list_like, etc) – A seed for numpy.random.default_rng. Ignored when bootstrap=False.

Returns:

p – Adjusted p-value.

Return type:

float

Raises:

ValueError – If gamma < 1 or alternative is not recognized (propagated from WeightingEstimator.adjusted_pvalue).

confidence_interval(alpha=0.1, alternative='two-sided')[source]#

Calculate confidence interval on the treatment effect.

Parameters:
  • alpha (float, optional) – P-value threshold, e.g. specify alpha=0.05 for a 95% confidence interval. Defaults to 0.10, corresponding to a 90% confidence interval.

  • alternative (["two-sided", "less", "greater"], optional) –

    What kind of test:

    • ”two-sided”: H0: TE = null_value vs Halt: TE <> null_value.

    • ”greater”: H0: TE <= null_value vs Halt: TE > null_value.

    • ”less”: H0: TE >= null_value vs Halt: TE < null_value.

    Defaults to “two-sided”.

Returns:

lb, ub – Lower and upper bounds on the confidence interval. For one-sided intervals, only one of these will be finite:

  • ”two-sided”: lb and ub both finite

  • ”greater”: lb finite, ub = np.inf

  • ”less”: lb = -np.inf, ub finite

Return type:

float

Raises:

ValueError – If alternative is not recognized (propagated from confidence_interval).

sensitivity_analysis(gamma=6.0, outcome_proxies=None, proxy_mean=None, alpha=0.1, *, control_outcome_proxies=None, treated_outcome_proxies=None, **kwargs)[source]#

Perform a sensitivity analysis.

Calculate a range of point estimates implied by the Gamma factor.

Parameters:
  • gamma (float, optional) – The Gamma factor. Must be >= 1.0, with 1.0 indicating perfect propensity scores. Defaults to 6. See Notes.

  • outcome_proxies (array_like, optional) – Accepted for override compatibility with WeightingEstimator; must be None. Use control_outcome_proxies and treated_outcome_proxies instead.

  • proxy_mean (float, optional) – Known population mean of the outcome proxy. Required when either control_outcome_proxies or treated_outcome_proxies is supplied.

  • alpha (float, optional) – Significance level for the proxy tolerance. Defaults to 0.10.

  • control_outcome_proxies (array_like, optional) – A proxy for the outcome observed for every control-group unit, with a known population mean given by proxy_mean. When supplied (together with treated_outcome_proxies and proxy_mean), a constraint is added to the control-arm sensitivity region requiring the weighted proxy estimate to be within the estimator’s confidence-interval half-width of proxy_mean. Must have the same length as the control-group outcomes. All three of control_outcome_proxies, treated_outcome_proxies, and proxy_mean must be provided together.

  • treated_outcome_proxies (array_like, optional) – A proxy for the outcome observed for every treated-group unit. See control_outcome_proxies for details.

  • kwargs (dict, optional) – Accepted for override compatibility with WeightingEstimator; must be empty.

Returns:

lb, ub – Lower and upper bounds on the point estimate.

Return type:

float

Raises:
  • TypeError – If outcome_proxies or unexpected keyword arguments are supplied.

  • ValueError – If proxies are supplied without proxy_mean, if proxy_mean is supplied without proxies, or if gamma < 1 (propagated from the arm-level sensitivity_analysis calls).

Notes

The underlying sensitivity analysis is separable in the control vs treated individuals, so we perform two separate sensitivity analyses and combine the results.

resample(B, seed=None)[source]#

Yield a sequence of resampled estimators.

Parameters:
  • B (int) – Number of bootstrap replications to run.

  • seed (int, list_like, etc) – A seed for numpy.random.default_rng. See that documentation for details.

Yields:

estimator (TreatmentEffectEstimator) – Bootstrap-resampled estimator.

plot_sensitivity(gamma_lower=1.0, gamma_upper=6.0, num_points=50, alpha=0.1, alternative='two-sided', bootstrap=True, B=1000, null_value=0.0, title=None, ylabel='Sensitivity Interval', ytick_format='.0%', axis_label_size=None, tick_label_size=None, legend_label_size=None, legend_placement=None, ax=None)[source]#

Plot like WeightingEstimator.plot_sensitivity with null_value 0.

class pyrake.estimation.treatment_effects.SimpleDifferenceEstimator(control_outcomes, treated_outcomes, control_sampling_propensity_scores=None, treated_sampling_propensity_scores=None, sampling_estimand_class='PopulationMean', control_denominator_outcomes=None, treated_denominator_outcomes=None, **kwargs)[source]#

Bases: TreatmentEffectEstimator

Simple difference in means.

Parameters:
  • control_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp.

  • treated_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp.

  • control_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the control group. See Notes.

  • treated_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the treated group. See Notes.

  • sampling_estimand_class (str, optional) – One of “PopulationMean”, “NonRespondentMean”, or “SampleMean”. Population for which to estimate the average treatment effect. Used only when sampling propensity scores are specified. Defaults to “PopulationMean” in that case. See Notes.

  • control_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes in ATEEstimator for details.

  • treated_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes in ATEEstimator for details.

  • kwargs (dict, optional) – Extra arguments forwarded to the estimator constructor.

Notes

When called without sampling propensity scores, this class computes the average response in treatment, minus the average response in control. No weights, just straight averages. This may be helpful to see how different the adjusted estimator is from the simplest comparison of treatment and control, to see how biased this simple estimator is.

In situations where the treatment is randomly assigned in the population (but potentially not in the sample), this estimator can also be used to generalize estimated treatment effects from the sample to the population (Tipton and Hartman, 2023). The basic strategy here is to use the control responses to estimate the average potential outcome Y(0) in the population, and the treated responses to estimate the average Y(1). Since treatment is randomly assigned in the population, the population average treatment effect is just the difference in these means.

References

  • Tipton, Elizabeth and Erin Hartman. 2023. “Generalizability and Transportability.” In Handbook of Matching and Weighting Adjustments for Causal Inference, , pg. 39–59. Chapman and Hall/CRC.

class pyrake.estimation.treatment_effects.ATEEstimator(control_propensity_scores, control_outcomes, treated_propensity_scores, treated_outcomes, estimator_class='SIPW', control_estimator_class=None, treated_estimator_class=None, control_sampling_propensity_scores=None, treated_sampling_propensity_scores=None, sampling_estimand_class='PopulationMean', control_denominator_outcomes=None, treated_denominator_outcomes=None, control_kwargs=None, treated_kwargs=None, **kwargs)[source]#

Bases: TreatmentEffectEstimator

Estimator for the average treatment effect.

Parameters:
  • control_propensity_scores (list_like) – Propensity scores for control and treatment groups, resp.

  • treated_propensity_scores (list_like) – Propensity scores for control and treatment groups, resp.

  • control_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp. Should have the same lengths as the corresponding propensity_scores.

  • treated_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp. Should have the same lengths as the corresponding propensity_scores.

  • estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – What kind of estimator to use. Defaults to “SIPW”.

  • control_estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – Estimator class for the control arm. Defaults to estimator_class.

  • treated_estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – Estimator class for the treated arm. Defaults to estimator_class.

  • control_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the control group. See Notes.

  • treated_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the treated group. See Notes.

  • sampling_estimand_class (str, optional) – One of “PopulationMean”, “NonRespondentMean”, or “SampleMean”. Population for which to estimate the average treatment effect. Used only when sampling propensity scores are specified. Defaults to “PopulationMean” in that case. See Notes.

  • control_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes.

  • treated_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes.

  • control_kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

  • treated_kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

  • kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

Notes

Weighting estimators for the average treatment effect tend to look like:

ÂTE = Σ_{i∈T} wᵢyᵢ/Σ_{i∈T} wᵢ − Σ_{i∈C} wᵢyᵢ/Σ_{i∈C} wᵢ,

where sums run over treated (T) and control (C) units, wᵢ = 1/πᵢ for the treated group, and 1/(1 − πᵢ) for the control group, and πᵢ is the propensity score. This is really just the difference between two MeanEstimator objects, which makes calculations (including sensitivity analysis) straightforward.

When the units in the study are sampled from a population, and the sample is not a simple random sample, we may wish to estimate treatment effects in the population, which involves elements of both observational causal inference and survey non-response. If sampling propensity scores are available, in additional to treatment assignment propensity scores, we can adjust for both non-response bias and treatment selection bias.

Sometimes we are interested in a treatment effect in a subpopulation that is identifiable only in the sample. For example, people may self-identify as belonging to that population in the sample. We can estimate the population mean among the sub-population as a ratio of two MeanEstimator objects as follows. Let tᵢ be 1 if person i belongs to the sub-population, and 0 otherwise. We observe tᵢ only for respondents. Let yᵢ be the metric of interest. Then the average value of the metric among the sub-population is (sums run over i = 1, …, N):

Σᵢ tᵢyᵢ/Σᵢ tᵢ = (1/N) Σᵢ tᵢyᵢ/(1/N) Σᵢ tᵢ,

which is the ratio of the population means of tᵢ × yᵢ and tᵢ. Inference (including sensitivity analysis) for such ratios is provided by RatioEstimator.

We may wish to estimate the impact of a treatment on an outcome in a subpopulation identifiable only in the sample. Let (y0ᵢ, y1ᵢ) be potential outcomes, and assume subpopulation membership is not influenced by treatment, so that tᵢ does not have associated potential outcomes. The quantity of interest is (sums run over i = 1, …, N):

Σᵢ tᵢ(y1ᵢ − y0ᵢ)/Σᵢ tᵢ
   = (1/N) Σᵢ tᵢy1ᵢ/(1/N) Σᵢ tᵢ − (1/N) Σᵢ tᵢy0ᵢ/(1/N) Σᵢ tᵢ.

By specifying tᵢ × yᵢ as the control_outcomes and treated_outcomes (the numerator), and tᵢ as the control_denominator_outcomes and treated_denominator_outcomes, inference (including sensitivity analysis) for this use case is supported.

class pyrake.estimation.treatment_effects.ATTEstimator(control_propensity_scores, control_outcomes, treated_outcomes, estimator_class='SIPW', control_estimator_class=None, treated_estimator_class=None, control_sampling_propensity_scores=None, treated_sampling_propensity_scores=None, sampling_estimand_class='PopulationMean', control_denominator_outcomes=None, treated_denominator_outcomes=None, control_kwargs=None, treated_kwargs=None, **kwargs)[source]#

Bases: TreatmentEffectEstimator

Estimator for the average effect of treatment on the treated (ATT).

Parameters:
  • control_propensity_scores (list_like) – Propensity scores for control group.

  • control_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp. Should have the same lengths as the corresponding propensity_scores.

  • treated_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp. Should have the same lengths as the corresponding propensity_scores.

  • estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – What kind of estimator to use. Defaults to “SIPW”.

  • control_estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – Estimator class for the control arm. Defaults to estimator_class.

  • treated_estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – Estimator class for the treated arm. Defaults to estimator_class.

  • control_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the control group. See Notes.

  • treated_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the treated group. See Notes.

  • sampling_estimand_class (str, optional) – One of “PopulationMean”, “NonRespondentMean”, or “SampleMean”. Population for which to estimate the average treatment effect. Used only when sampling propensity scores are specified. Defaults to “PopulationMean” in that case. See Notes.

  • control_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes in ATEEstimator for details.

  • treated_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes in ATEEstimator for details.

  • control_kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

  • treated_kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

  • kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

Notes

Weighting estimators for the average treatment effect tend to look like:

ÂTT = Σ_{i∈T} yᵢ/nT − Σ_{i∈C} wᵢyᵢ/Σ_{i∈C} wᵢ,

where sums run over treated (T) and control (C) units, nT is the number of treated units, wᵢ = πᵢ/(1 − πᵢ), and πᵢ is the propensity score. This is really just the difference between two MeanEstimator objects, which makes calculations (including sensitivity analysis) straightforward.

class pyrake.estimation.treatment_effects.ATCEstimator(control_outcomes, treated_propensity_scores, treated_outcomes, estimator_class='SIPW', control_estimator_class=None, treated_estimator_class=None, control_sampling_propensity_scores=None, treated_sampling_propensity_scores=None, sampling_estimand_class='PopulationMean', control_denominator_outcomes=None, treated_denominator_outcomes=None, control_kwargs=None, treated_kwargs=None, **kwargs)[source]#

Bases: TreatmentEffectEstimator

Estimator for the average effect of treatment on the control units (ATC).

Parameters:
  • treated_propensity_scores (list_like) – Propensity scores for the treatment group.

  • control_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp. Should have the same lengths as the corresponding propensity_scores.

  • treated_outcomes (list_like) – Outcomes or responses for control and treatment groups, resp. Should have the same lengths as the corresponding propensity_scores.

  • estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – What kind of estimator to use. Defaults to “SIPW”.

  • control_estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – Estimator class for the control arm. Defaults to estimator_class.

  • treated_estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – Estimator class for the treated arm. Defaults to estimator_class.

  • control_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the control group. See Notes.

  • treated_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the treated group. See Notes.

  • sampling_estimand_class (str, optional) – One of “PopulationMean”, “NonRespondentMean”, or “SampleMean”. Population for which to estimate the average treatment effect. Used only when sampling propensity scores are specified. Defaults to “PopulationMean” in that case. See Notes.

  • control_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes in ATEEstimator for details.

  • treated_denominator_outcomes (list_like, optional) – If specified, the metric of interest is considered a ratio (with control_outcomes and treated_outcomes treated as the numerators), and interest is in the effect of treatment on that ratio. See Notes in ATEEstimator for details.

  • control_kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

  • treated_kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

  • kwargs (dict_like) – Extra kwargs to pass to the estimators. kwargs are passed to both estimators, while control_kwargs is only passed to the control estimator and treated_kwargs is only passed to the treated estimator.

Notes

Weighting estimators for the average treatment effect tend to look like:

ÂTC = Σ_{i∈T} wᵢyᵢ/Σ_{i∈T} wᵢ − Σ_{i∈C} yᵢ/nC,

where sums run over treated (T) and control (C) units, nC is the number of control units, wᵢ = (1 − πᵢ)/πᵢ, and πᵢ is the propensity score. This is really just the difference between two MeanEstimator objects, which makes calculations (including sensitivity analysis) straightforward.

class pyrake.estimation.treatment_effects.TreatmentEffectRatioEstimator(control_propensity_scores, treated_propensity_scores, numerator_control_outcomes, numerator_treated_outcomes, denominator_control_outcomes, denominator_treated_outcomes, mean_estimator_class='SIPW', treatment_effect_estimator_class='ATE', control_sampling_propensity_scores=None, treated_sampling_propensity_scores=None, sampling_estimand_class='PopulationMean', numerator_control_kwargs=None, numerator_treated_kwargs=None, denominator_control_kwargs=None, denominator_treated_kwargs=None)[source]#

Bases: WeightingEstimator

Estimate the ratio of two treatment effects in some population.

Parameters:
  • control_propensity_scores (list_like) – Propensity scores for control and treatment groups, respectively.

  • treated_propensity_scores (list_like) – Propensity scores for control and treatment groups, respectively.

  • numerator_control_outcomes (list_like) – Numerator outcomes for control and treated groups.

  • numerator_treated_outcomes (list_like) – Numerator outcomes for control and treated groups.

  • denominator_control_outcomes (list_like) – Denominator outcomes for control and treated groups.

  • denominator_treated_outcomes (list_like) – Denominator outcomes for control and treated groups.

  • mean_estimator_class (["IPW", "AIPW", "SIPW", "SAIPW"], optional) – Estimator class to use for all sub-estimators. Defaults to “SIPW”.

  • treatment_effect_estimator_class ([SimpleDifference, ATE, ATT, ATC], optional) – Estimator class for treatment effects. Defaults to “ATE”.

  • control_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the control group. See Notes.

  • treated_sampling_propensity_scores (list_like, optional) – Propensity scores for the sampling mechanism for the treated group. See Notes.

  • sampling_estimand_class (str, optional) – One of “PopulationMean”, “NonRespondentMean”, or “SampleMean”. Population for which to estimate the average treatment effect. Used only when sampling propensity scores are specified. Defaults to “PopulationMean” in that case. See Notes.

  • numerator_control_kwargs (dict, optional) – Extra kwargs to pass to the numerator control and treated estimators.

  • numerator_treated_kwargs (dict, optional) – Extra kwargs to pass to the numerator control and treated estimators.

  • denominator_control_kwargs (dict, optional) – Extra kwargs to pass to the denominator control and treated estimators.

  • denominator_treated_kwargs (dict, optional) – Extra kwargs to pass to the denominator control and treated estimators.

Notes

Sensitivity analysis and expanded confidence intervals are not implemented because the ratio of differences of linear-fractional problems is not quasilinear and cannot be transformed to a linear program easily.

point_estimate()[source]#

Calculate a point estimate.

Returns:

estimate – Ratio of the numerator and denominator treatment-effect estimates.

Return type:

float

variance()[source]#

Calculate the variance of the ratio estimator using the delta method.

Returns:

variance – Estimated sampling variance of the ratio estimate.

Return type:

float

Raises:

ValueError – If any sub-estimator is itself a RatioEstimator.

sensitivity_analysis(gamma=6.0, outcome_proxies=None, proxy_mean=None, alpha=0.1)[source]#

Raise NotImplementedError (sensitivity analysis is unsupported).

Raises:

NotImplementedError – Always raised; the ratio of differences of linear-fractional problems is not quasilinear.

resample(B, seed=None)[source]#

Raise NotImplementedError (resampling is unsupported).

Raises:

NotImplementedError – Always raised; resampling is not implemented for TreatmentEffectRatioEstimator.

expanded_confidence_interval(alpha=0.1, gamma=6.0, alternative='two-sided', bootstrap=True, B=1000, seed=None)[source]#

Raise NotImplementedError (expanded confidence intervals unsupported).

Raises:

NotImplementedError – Always raised; expanded confidence intervals are not implemented for TreatmentEffectRatioEstimator.