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 lower and upper 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:
aarray_like

Input array

proportiontocutfloat

Fraction to cut off of both tails of the observations

axisint 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_meanndarray

Mean of trimmed array.