procedure MDScaleMetric(const D: TMtx; const Y: TMtx; const EigenValues: TVec; const NumDim: Integer);
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
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;
See Also: Statistics.MDScaleStress