statsmodels.stats.robust_compare.trim_mean

statsmodels.stats.robust_compare.trim_mean(a, proportiontocut, axis=0)[source]

Return mean of array after trimming observations from both tails.

If proportiontocut = 0.1, slices off ‘leftmost’ and ‘rightmost’ 10% of scores. Slices off LESS if proportion results in a non-integer slice index (i.e., conservatively slices off proportiontocut ).

Parameters:
  • a (array_like) – Input array

  • proportiontocut (float) – Fraction to cut off at each tail of the sorted observations.

  • axis (int or None) – Axis along which the trimmed means are computed. The default is axis=0. If axis is None then the trimmed mean will be computed for the flattened array.

Returns:

trim_mean – Mean of trimmed array.

Return type:

ndarray