econml.inference.NormalInferenceResults

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

Bases: econml.inference._inference.InferenceResults

Results class for inference assuming a normal distribution.

Parameters
  • d_t (int or None) – Number of treatments

  • d_y (int) – Number of outputs

  • pred (array-like, shape (m, d_y, d_t) or (m, d_y)) – The prediction of the metric for each sample X[i]. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions should be collapsed (e.g. if both are vectors, then the input of this argument will also be a vector)

  • pred_stderr (array-like, shape (m, d_y, d_t) or (m, d_y)) – The prediction standard error of the metric for each sample X[i]. Note that when Y or T is a vector rather than a 2-dimensional array, the corresponding singleton dimensions should be collapsed (e.g. if both are vectors, then the input of this argument will also be a vector)

  • mean_pred_stderr (None or array-like or scaler, shape (d_y, d_t) or (d_y,)) – The standard error of the mean point estimate, this is derived from coefficient stderr when final stage is linear model, otherwise it’s None. This is the exact standard error of the mean, which is not conservative.

  • 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_stderr, mean_pred_stderr, 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_stderr, …[, …])

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 z test of each treatment on each outcome for each sample X[i].

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

Output the dataframe for all the inferences above.

translate(offset)

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

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 z test 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

pvalue – The p value of the z test 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)

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(offset)

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)