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://support.nag.com/numeric/nl/nagdoc_30.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
In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.
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