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 (string) – 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]

Initialize self. See help(type(self)) for accurate signature.

Methods

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

Initialize self.

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.1)[source]

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

Parameters

alpha (optional float in [0, 1] (Default=0.1)) – 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 arrays, shape (m, d_y, d_t) or (m, d_y)

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

Output the object of population summary results.

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

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

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

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

  • output_names (optional list of strings or None (default is None)) – The names of the outputs

  • treatment_names (optional list of strings or None (default is None)) – 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 (optinal 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.1, value=0, decimals=3, feature_names=None, output_names=None, treatment_names=None)

Output the dataframe for all the inferences above.

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

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

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

  • feature_names (optional list of strings or None (default is None)) – The names of the features X

  • output_names (optional list of strings or None (default is None)) – The names of the outputs

  • treatment_names (optional list of strings or None (default is None)) – 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

pandas 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 (optinal 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)