Dew Stats Master .NET
MDScaleMetric Routine
Summary
Classical multidimensional scaling.

Unit
Statistics

Declaration
Procedure MDScaleMetric(D: TMtx; Y: TMtx; EigenValues: TVec; NumDim: Integer);

Description
Performs classical (metric) multidimensional scaling.
Categories
Multivariate analysis routines
 See Also 
MDScaleStress 

Example 1

Uses MtxExpr,Math387,Statistics; procedure Example; var D,Y,X,DHat: Matrix; Eigen: Vector; stress: TSample; 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 "MtxVecCpp.h" #include "Math387.hpp" #include "Statistics.hpp" void __fastcall Example() { Matrix X,Y,D,DHat; Vector eigen; X->SetIt(5,2,false,OPENARRAY(TSample,(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. }
using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Matrix X = new Matrix(0,0); Matrix Y = new Matrix(0,0); Matrix D = new Matrix(0,0); Matrix DHat = new Matrix(0,0); Vector eigen = new Vector(0); X.SetIt(5,2,false,new double[] {1,2,3,4,3,11,7,8,9,4}); // Use all dimensions i.e. 2 PairwiseDistance(X,D,2,TPWDistMethod.pwdistEuclidian); // Reduce to just one variable (1d subspace) MDScaleMetric(D,Y,eigen,1); // Calculate estimated distance matrix PairwiseDistance(Y,DHat,1,TPWDistMethod.pwdistEuclidian); // Calculate stress - measure of GOF double stress = MDScaleStress(D,DHat); // if stress > 0.2, the GOF is poor. } }

Copyright 2008 Dew Research
http://www.dewresearch.com