I have 4 dimensional data in a matrix, group1, that looks like the following:
cost quality safety time
[1,] 13 6 3 4
[2,] 10 4 5 10
[3,] 8 9 3 9
[4,] 7 8 9 9
[5,] 4 4 4 2
I have another matrix, group2, that has a single row and four columns representing the same four variables:
cost quality safety time
[1,] 2 2 7 11
To identify the distance between group1 and group2 I have calculated the Mahalanobis distance using the mahalanobis function:
mat1 <- matrix(group1, ncol=ncol(group1), dimnames=NULL)
mat2 <- matrix(group2, ncol=ncol(group2), dimnames=NULL)
mahalanobis(mat2, colMeans(mat1), cov(mat1))
The function calculates the distance from group1 to group2 as 13.74883.
How Can I show 4 dimensions of group 1 and group 2 in a graph?
How can I draw the distance of group2 from group1 using Mahalanobis distance?
I also looked at drawMahal
function from the chemometrics
package ,but this function doesn't support more than 2 dimensions.