IStatistics.TrimMean

Syntax

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

Parameters

Data. Array of averaged values;

Percent. Share of data points excluded from calculations. Valid values lie in 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

Sub Main;

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("Set interior mean: " + d0.ToString);

End Sub Main;

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

Module execution started

Set interior mean: 17.199999999999999

Module execution finished

See also:

IStatistics