void MDScaleMetric(TMtx D, TMtx Y, TVec EigenValues, Int32 NumDim)
Classical multidimensional scaling.
| # | Name | Description |
|---|---|---|
| 1 | D | Distance matrix. |
| 2 | Y | Returns the coordinates of object in reduced space.> |
| 3 | EigenValues | |
| 4 | NumDim | Defines number of dimensions/variables to use in classical MD scaling algorithm. |
Result: stored in self (calling object)
Examples
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
Statistics.PairwiseDistance(X,D,2,TPWDistMethod.pwdistEuclidian);
// Reduce to just one variable (1d subspace)
Statistics.MDScaleMetric(D,Y,eigen,1);
// Calculate estimated distance matrix
Statistics.PairwiseDistance(Y,DHat,1,TPWDistMethod.pwdistEuclidian);
// Calculate stress - measure of GOF
double stress = Statistics.MDScaleStress(D,DHat);
// if stress > 0.2, the GOF is poor.
}
}
See Also: Statistics.MDScaleStress