TMtx::ZScore Method

TMtx *ZScore(TMtx *Src);

Transforms matrix into matrix of standardized data.

#NameTypeDescription
1SrcTMtx *
Remarks:

The routine uses Data matrix and transforms it into ZScore matrix of standardized data (the so called Z Scores). The standardization of each column (variable) is made by subtracting its mean and dividing by its standard deviation:

Z(Column) = (Column - Mean(Column))/StdDev(Column)

Examples
#include "MtxVec.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    TMtx* Data;
    TMtx* Res;

    Data = new TMtx();
    Res = new TMtx();
    Data->SetIt(3, 3, false, DewArray<double>{1, 2, 3,
        4, 5, 6,
        7, 100, 12});
    Res->ZScore(Data);
    // result = (-1     -0,604  -0,873,
    //            0     -0,55   -0,218
    //            1      1,154   1,091)
    delete Data;
    delete Res;
}
Declared in Dew::Math::TMtx · Dew.Math/MtxVec.h · Cross-compiler