Plot Clustering using Dimensionality Reduction by MDS
Plot Clustering using Dimensionality Reduction by MDS
This function uses a projection method to perform dimensionality reduction (DR) on order to visualize the data as 3D data points colored by a clustering.
ClusterPlotMDS(DataOrDistances, Cls, main ="Clustering",DistanceMethod ="euclidean", OutputDimension =3,PointSize=1,Plotter3D="rgl",Colorsequence,...)
Arguments
DataOrDistances: Either nonsymmetric [1:n,1:d] datamatrix of n cases and d features or symmetric [1:n,1:n] distance matrix
Cls: 1:n numerical vector of numbers defining the classification as the main output of the clustering algorithm for the n cases of data. It has k unique numbers representing the arbitrary labels of the clustering.
main: String, title of plot
DistanceMethod: Method to compute distances, default "euclidean"
OutputDimension: Either two or three depending on user choice
PointSize: Scalar defining the size of points
Plotter3D: In case of 3 dimensions, choose either "plotly" or "rgl",
Colorsequence: [1:k] character vector of colors, per default the colorsquence defined in the DataVisualizations is used
...: Please see Plot3D in DataVisualizations
Details
If dataset has more than 3 dimesions, mds is performed as defined in the smacof [De Leeuw/Mair, 2011]. If smacof package is not installed, classical metric MDS (see Def. in [Thrun, 2018]) is performed. In both cases, the first OutputDimension are visualized. Points are colored by the labels (Cls).
In the special case that the dataset has not more than 3 dimensions, all dimensions are visualized and no DR is performed.
Returns
The rgl or plotly plot handler depending on Plotter3D
References
[De Leeuw/Mair, 2011] De Leeuw, J., & Mair, P.: Multidimensional scaling using majorization: SMACOF in R, Journal of statistical Software, Vol. 31(3), pp. 1-30. 2011.
[Thrun, 2018] Thrun, M. C.: Projection Based Clustering through Self-Organization and Swarm Intelligence, doctoral dissertation 2017, Springer, ISBN: 978-3-658-20539-3, Heidelberg, 2018.
Author(s)
Michael Thrun
Note
If DataVisualizations is not installed a 2D plot using native plot function is shown.
If MASS is not installed, classicial metric MDS is used, see [Thrun, 2018] for definition.