You are here: Symbol Reference > Statistics Namespace > Functions > Statistics.MDScaleMetric Function
Stats Master VCL
ContentsIndex
Example
Uses MtxExpr,Math387,Statistics;
procedure Example;
var D,Y,X,DHat: Matrix;
  Eigen: Vector;
  stress: double;
begin
  X.SetIt(5,2,false,[1,2,3,4,3,11,7,8,9,4]);
  // Use all dimensions i.e. 2
  PairwiseDistance(X,D,2);
  // Reduce to just one variable (1d subspace)
  MDScaleMetric(D,Y,Eigen,1);
  // Calculate estimated distance matrix
  PairwiseDistance(Y,DHat,1);
  // Calculate stress - measure of GOF
  stress := MDScaleStress(D,DHat);
  // if stress > 0.2, the GOF is poor.
end;
#include "MtxExpr.hpp"
#include "Math387.hpp"
#include "Statistics.hpp"
void __fastcall Example()
{
    sMatrix X,Y,D,DHat;
    sVector eigen;
    X.SetIt(5,2,false,OPENARRAY(double,(1,2,3,4,3,11,7,8,9,4)));
    // Use all dimensions i.e. 2
    PairwiseDistance(X,D,2);
    // Reduce to just one variable (1d subspace)
    MDScaleMetric(D,Y,eigen,1);
    // Calculate estimated distance matrix
    PairwiseDistance(Y,DHat,1);
    // Calculate stress - measure of GOF
    double stress = MDScaleStress(D,DHat);
    // if stress > 0.2, the GOF is poor.
}
Copyright (c) 1999-2025 by Dew Research. All rights reserved.