# Proper use of MDS and PCA

Assume I have a 20*85 matrix. Here is my code

``````    M = fit(PCA, matrix; maxoutdim=2)
Yte = predict(M, matrix)
M1 = fit(MDS, matrix; maxoutdim=2, distances=false)
Yte1 = predict(M1)
``````

My Yte and Yte1 are identically same. Did I use PCA and MDS properly?

From the documentation:

Compute an embedding of `X` points by classical multidimensional scaling (MDS). There are two calling options, specified via the required keyword argument `distances`:

``````mds = fit(MDS, X; distances=false, maxoutdim=size(X,1)-1)
``````

where `X` is the data matrix. Distances between pairs of columns of `X` are computed using the Euclidean norm. This is equivalent to performing PCA on `X`.

``````M1 = fit(MDS, pairwise(Euclidean(), matrix); maxoutdim=2, distances=true)
As I understand it, doing `distance=false` makes it use Euclidean distance, while `distance=true` makes it use a distance metric you provide. Here you provided Euclidean, so results are exactly the same.