statsmodels.regression.linear_model.OLSResults.outlier_test

OLSResults.outlier_test(method='bonf', alpha=0.05, labels=None, order=False, cutoff=None)[source]

Test observations for outliers according to method.

Parameters:
methodstr

The method to use in the outlier test. Must be one of:

  • bonferroni : one-step correction

  • sidak : one-step correction

  • holm-sidak :

  • holm :

  • simes-hochberg :

  • hommel :

  • fdr_bh : Benjamini/Hochberg

  • fdr_by : Benjamini/Yekutieli

See statsmodels.stats.multitest.multipletests for details.

alphafloat

The familywise error rate (FWER).

labelsNone or array_like

If labels is not None, then it will be used as index to the returned pandas DataFrame. See also Returns below.

orderbool

Whether or not to order the results by the absolute value of the studentized residuals. If labels are provided they will also be sorted.

cutoffNone or float in [0, 1]

If cutoff is not None, then the return only includes observations with multiple testing corrected p-values strictly below the cutoff. The returned array or dataframe can be empty if t.

Returns:
array_like

Returns either an ndarray or a DataFrame if labels is not None. Will attempt to get labels from model_results if available. The columns are the Studentized residuals, the unadjusted p-value, and the corrected p-value according to method.

Notes

The unadjusted p-value is stats.t.sf(abs(resid), df) where df = df_resid - 1.


Last update: Oct 29, 2024