IStatistics.TrimMean

Syntax

TrimMean(Data: Array; Percent: Double): Double;

Parameters

Data. Array of averaged values.

Percent. Share of data points excluded from calculations. Available values are taken from the range [0, 1].

Description

The TrimMean method returns the data set interior mean.

Comments

The function calculates the mean excluding the specified percent of data with extreme values. You can use this function to exclude outliers from the analysis.

The function rounds down the number of extreme data points up to the nearest integer divisible by 2. If the percentage is 0.1, 10 % of 30 data points is 3 points, but the TrimMean function excludes one value from the set beginning and one value from the set end to make the data array symmetric.

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    st: Statistics;
    d0: Double;
    y: Array Of Double;
Begin
    y := New Double[10];
    y[00] := 6;
    y[01] := 17;
    y[02] := 9;
    y[03] := 15;
    y[04] := 21;
    y[05] := 24;
    y[06] := 20;
    y[07] := 21;
    y[08] := 14;
    y[09] := 25;
    st := New Statistics.Create;
    d0 := st.TrimMean(y,0.2);
    Debug.WriteLine("Data set interior mean: " + d0.ToString);
End Sub UserProc;

After you have executed this example the console window displays the mean of data set interior with 20 % of data excluded from the calculations:

Unit execution started

Data set interior mean: 17.2

Unit execution finished

See also:

IStatistics