# naginterfaces.library.univar.robust_​1var_​trimmed¶

naginterfaces.library.univar.robust_1var_trimmed(x, alpha)[source]

robust_1var_trimmed calculates the trimmed and Winsorized means of a sample and estimates of the variances of the two means.

For full information please refer to the NAG Library document for g07dd

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/g07/g07ddf.html

Parameters
xfloat, array-like, shape

The sample observations, , for .

alphafloat

, the proportion of observations to be trimmed at each end of the sorted sample.

Returns
tmeanfloat

The -trimmed mean, .

wmeanfloat

The -Winsorized mean, .

tvarfloat

Contains an estimate of the variance of the trimmed mean.

wvarfloat

Contains an estimate of the variance of the Winsorized mean.

kint

Contains the number of observations trimmed at each end, .

sxfloat, ndarray, shape

Contains the sample observations sorted into ascending order.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Notes

robust_1var_trimmed calculates the -trimmed mean and -Winsorized mean for a given , as described below.

Let , for represent the sample observations sorted into ascending order. Let where represents the integer nearest to ; if then is reduced by .

Then the trimmed mean is defined as:

and the Winsorized mean is defined as:

robust_1var_trimmed then calculates the Winsorized variance about the trimmed and Winsorized means respectively and divides by to obtain estimates of the variances of the above two means.

Thus we have;

and

References

Hampel, F R, Ronchetti, E M, Rousseeuw, P J and Stahel, W A, 1986, Robust Statistics. The Approach Based on Influence Functions, Wiley

Huber, P J, 1981, Robust Statistics, Wiley