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

Calculate the fourth moment (related to Kurtosis)

Uses MtxExpr, Statistics, Math387;
procedure Example;
var a: Vector;
  AMean,
  M4 : double;
begin
  a.SetIt(false,[1, 2, 7, 8]);
  AMean := a.Mean;
  M4 := Moment(a,AMean,4); // M4 = 94.5625
end;
#include "MtxExpr.hpp"
#include "Statistics.hpp"
void __fastcall Example()
{
  sVector a;
  a.SetIt(false, OPENARRAY(double,(1, 2, 7, 8)));
  double amean = a.Mean();
  double m4 = Moment(a,amean,4);
  // m4 = 94.5625
}
Copyright (c) 1999-2025 by Dew Research. All rights reserved.