psychopy_ext.stats.classical_mds

psychopy_ext.stats.classical_mds(d, ndim=2)[source]

Metric Unweighted Classical Multidimensional Scaling

Based on Forrest W. Young’s notes on Torgerson’s (1952) algorithm as presented in http://forrest.psych.unc.edu/teaching/p230/Torgerson.pdf: Step 0: Make data matrix symmetric with zeros on the diagonal Step 1: Double center the data matrix (d) to obtain B by removing row and column means and adding the grand mean of the squared data Step 2: Solve B = U * L * U.T for U and L Step 3: Calculate X = U * L**(-.5)

Args:
  • d: numpy.ndarray

    A symmetric dissimilarity matrix

  • ndim (int, default: 2)

    The number of dimensions to project to

Kwargs:
X[:, :ndim]: numpy.ndarray

The projection of d into ndim dimensions

Returns:

A numpy.array with ndim columns representing the multidimensionally scaled data.