Statistics::Moment Function

double Moment(TVec *X, double AMean, const int AOrder);

Moments.

#NameTypeDescription
1XTVec *Data. An exception is raised if X vector is complex.
2AMeandoubleA mean value of all X vector elements.
3AOrderconst intDefines the order of central moment.

Returns: the AOrder-th central moment of all X vector elements.

Examples
#include "MtxExpr.h"
#include "Units.Statistics.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Stats;
using namespace Dew::Stats::Units::Statistics;

void Example()
{
    Vector a(0);
    a.SetIt(false, DewArray<double>{1, 2, 7, 8});
    double amean = a.Mean();
    double m4 = Moment(a,amean,4);
    // m4 = 94.5625
}
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler