You are here: Symbol Reference > Statistics Namespace > Functions > Statistics.MeanT Function
Stats Master VCL
ContentsIndex
PreviousUpNext
Statistics.MeanT Function

Trimmed mean.

Pascal
function MeanT(const Data: TVec; Alpha: double = 0.05): double;
Parameters 
Description 
Data 
Data. An exception is raised if Data vector is complex. 
Alpha 
Defines the percent of value excluded from mean calculation. If Alpha parameter is omitted, the default value 0.05 is used (meaning highest 2.5% and lowest 2.5% of data will be excluded). Alpha paramater must lie on the interval [0,1) otherwise an exception is raised. 

the mean of all Data vector elements, excluding highest and lowest 100*Alpha/2 percents of value.

Calculate mean for given values, excluding top and bottom 25% i.e 50%.

Uses MtxExpr, Statistics, Math387;
procedure Example;
var a: Vector;
  MT : double;
begin
  a.SetIt(false,[1, 2, 97, 98, 99, 100, 190]);
  MT := MeanT(a,0.5); // MT = 79.2
end;
#include "MtxExpr.hpp"
#include "Statistics.hpp"
void __fastcall Example()
{
  sVector a;
  a.SetIt(false, OPENARRAY(double,(1, 2, 97, 98, 99, 100, 190)));
  double MT = MeanT(a,0.5);
  // MT = 79.2
}
Examples on GitHub
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!