econml.inference.EmpiricalInferenceResults

class econml.inference.EmpiricalInferenceResults(d_t, d_y, pred, pred_dist, inf_type, fname_transformer=None, feature_names=None, output_names=None, treatment_names=None)[source]

Bases: econml.inference._inference.InferenceResults

Results class for inference with an empirical set of samples.

Parameters
  • pred (array_like, shape (m, d_y, d_t) or (m, d_y)) – the point estimates of the metric using the full sample

  • pred_dist (array_like, shape (b, m, d_y, d_t) or (b, m, d_y)) – the raw predictions of the metric sampled b times. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions should be collapsed

  • d_t (int or None) – Number of treatments

  • d_y (int) – Number of outputs

  • inf_type (str) – The type of inference result. It could be either ‘effect’, ‘coefficient’ or ‘intercept’.

  • fname_transformer (None or predefined function) – The transform function to get the corresponding feature names from featurizer

__init__(d_t, d_y, pred, pred_dist, inf_type, fname_transformer=None, feature_names=None, output_names=None, treatment_names=None)[source]

Methods

__init__(d_t, d_y, pred, pred_dist, inf_type)

conf_int([alpha])

Get the confidence interval of the metric of each treatment on each outcome for each sample X[i].

population_summary([alpha, value, decimals, ...])

Output the object of population summary results.

pvalue([value])

Get the p value of the each treatment on each outcome for each sample X[i].

scale(factor)

Update the results in place by scaling by a factor.

summary_frame([alpha, value, decimals, ...])

Output the dataframe for all the inferences above.

translate(other)

Update the results in place by translating by an offset.

zstat([value])

Get the z statistic of the metric of each treatment on each outcome for each sample X[i].

Attributes

point_estimate

Get the point estimate of each treatment on each outcome for each sample X[i].

stderr

Get the standard error of the metric of each treatment on each outcome for each sample X[i].

var

Get the variance of the metric of each treatment on each outcome for each sample X[i].

conf_int(alpha=0.05)[source]

Get the confidence interval of the metric of each treatment on each outcome for each sample X[i].

Parameters

alpha (float in [0, 1], default 0.05) – The overall level of confidence of the reported interval. The alpha/2, 1-alpha/2 confidence interval is reported.

Returns

lower, upper – The lower and the upper bounds of the confidence interval for each quantity. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)

Return type

tuple of array, shape (m, d_y, d_t) or (m, d_y)

population_summary(alpha=0.05, value=0, decimals=3, tol=0.001, output_names=None, treatment_names=None)

Output the object of population summary results.

Parameters
  • alpha (float in [0, 1], default 0.05) – The overall level of confidence of the reported interval. The alpha/2, 1-alpha/2 confidence interval is reported.

  • value (float, default 0) – The mean value of the metric you’d like to test under null hypothesis.

  • decimals (int, default 3) – Number of decimal places to round each column to.

  • tol (float, default 0.001) – The stopping criterion. The iterations will stop when the outcome is less than tol

  • output_names (list of str, optional) – The names of the outputs

  • treatment_names (list of str, optional) – The names of the treatments

Returns

PopulationSummaryResults – The population summary results instance contains the different summary analysis of point estimate for sample X on each treatment and outcome.

Return type

object

pvalue(value=0)[source]

Get the p value of the each treatment on each outcome for each sample X[i].

Parameters

value (float, default 0) – The mean value of the metric you’d like to test under null hypothesis.

Returns

pvalue – The p value of of each treatment on each outcome for each sample X[i]. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)

Return type

array_like, shape (m, d_y, d_t) or (m, d_y)

scale(factor)[source]

Update the results in place by scaling by a factor.

Parameters

factor (array_like) – The factor by which to scale these results

summary_frame(alpha=0.05, value=0, decimals=3, feature_names=None, output_names=None, treatment_names=None)

Output the dataframe for all the inferences above.

Parameters
  • alpha (float in [0, 1], default 0.05) – The overall level of confidence of the reported interval. The alpha/2, 1-alpha/2 confidence interval is reported.

  • value (float, default 0) – The mean value of the metric you’d like to test under null hypothesis.

  • decimals (int, default 3) – Number of decimal places to round each column to.

  • feature_names (list of str, optional) – The names of the features X

  • output_names (list of str, optional) – The names of the outputs

  • treatment_names (list of str, optional) – The names of the treatments

Returns

output – The output dataframe includes point estimate, standard error, z score, p value and confidence intervals of the estimated metric of each treatment on each outcome for each sample X[i]

Return type

DataFrame

translate(other)[source]

Update the results in place by translating by an offset.

Parameters

offset (array_like) – The offset by which to translate these results

zstat(value=0)

Get the z statistic of the metric of each treatment on each outcome for each sample X[i].

Parameters

value (float, default 0) – The mean value of the metric you’d like to test under null hypothesis.

Returns

zstat – The z statistic of the metric of each treatment on each outcome for each sample X[i]. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)

Return type

array_like, shape (m, d_y, d_t) or (m, d_y)

property point_estimate

Get the point estimate of each treatment on each outcome for each sample X[i].

Returns

prediction – The point estimate of each treatment on each outcome for each sample X[i]. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)

Return type

array_like, shape (m, d_y, d_t) or (m, d_y)

property stderr

Get the standard error of the metric of each treatment on each outcome for each sample X[i].

Returns

stderr – The standard error of the metric of each treatment on each outcome for each sample X[i]. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)

Return type

array_like, shape (m, d_y, d_t) or (m, d_y)

property var

Get the variance of the metric of each treatment on each outcome for each sample X[i].

Returns

var – The variance of the metric of each treatment on each outcome for each sample X[i]. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions in the output will be collapsed (e.g. if both are vectors, then the output of this method will also be a vector)

Return type

array_like, shape (m, d_y, d_t) or (m, d_y)