You are here: Symbol Reference > StatTools Namespace > Classes > TMtxMDScaling Class
Stats Master VCL
ContentsIndex
PreviousUpNext
TMtxMDScaling Class

Performs multidimensional scaling.

StatTools_TMtxMDScalingStatTools_TMtxMDScaling
Pascal
TMtxMDScaling = class(TMtxComponent);

Use TMtxMDScaling component to perform multidimensional scaling on dataset. 

How to use TMtxMDScaling component? 

  1. Drop a TMtxMDScaling component on the form.
  2. Set DataFormat property to define how data will be interpreted. Data can be interpreted as dissimilarities matrix, similarities matrix or raw data matrix.
  3. Define Data, the matrix representing dissimilarities matrix, similarities matrix or raw data.
  4. Set Dimensions to define number of variables in reduced space.
  5. Set DistanceMethod to define how pairwise distance will be calculated.
  6. Set ScalingMethod to define scaling algorithm. Currently only metric (classical) multidimensional scaling algorithm is supported.
  7. Call the Recalc method to trigger calculation.

 

Results:

  1. Y : Point coordinates in reduced space.
  2. EigenValues : Eigenvalues in reduced space, sorted in descending order.
  3. DHat : Estimated dissimilarities matrix.
  4. Stress : Calculated stress factor.

The "beauty" of MDS is that we can analyze any kind of distance or similarity matrix. These similarities can represent people's ratings of similarities between objects, the percent agreement between judges, the number of times a subjects fails to discriminate between stimuli, etc. For example, MDS methods used to be very popular in psychological research on person perception where similarities between trait descriptors were analyzed to uncover the underlying dimensionality of people's perceptions of traits (see, for example Rosenberg, 1977). In this example 6x6 similarities (extracted directly from questionare correlation matrix) is used to perform classical MD scaling.

Uses StatTools, Statistics, MtxExpr;
procedure Example(mds: TMtxMDScaling);
begin
  // similarities matrix (symmetric with 1.0 on diagonal)ΕΎ
  mds.Data.SetIt(5,5,false,
      [ 1.00, 0.3, 0.2, 0.25, 0.33,
        0.30, 1.0, 0.11, 0.21, 0.8,
        0.20, 0.11, 1.0, 0.40, 0.5,
        0.25, 0.21, 1.0, 0.10, 0.05,
        0.33, 0.80, 0.5, 0.05, 1.00]);
  mds.DataFormat := mdFormatSimilarities;
  // use "standard" Euclidian metric
  mds.DistanceMethod := pwdistEuclidian;
  // define number of desired dimensions (1)
  mds.Dimensions := 1;
  // Do the math
  mds.Recalc;
  // check Stress, DHat, EigeValues to evaluate GOF if (1) dimension is used
end;
#include "Math387.hpp"
#include "StatTools.hpp"
#include "Statistics.hpp"
void __fastcall Example(TMtxMDScaling* mds)
{
    const int aDataLen = 25;
    double aData[aDataLen] = {1.00, 0.3, 0.2, 0.25, 0.33,
                0.30, 1.0, 0.11, 0.21, 0.8,
                0.20, 0.11, 1.0, 0.40, 0.5,
                0.25, 0.21, 1.0, 0.10, 0.05,
                0.33, 0.80, 0.5, 0.05, 1.00};

    // similarities matrix (symmetric with 1.0 on diagonal)
    mds->Data->SetIt(5,5,false, aData, aDataLen-1);

      mds->DataFormat = mdFormatSimilarities;
      // use "standard" Euclidian metric
      mds->DistanceMethod = pwdistEuclidian;
      // define number of desired dimensions (1)
      mds->Dimensions = 1;
      // Do the math
      mds->Recalc();
      // check Stress, DHat, EigeValues to evaluate GOF if (1) dimension is used
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!