I have a set of nodes in a system with imprecise distances between them. Each node sits at a unique point in a grid setting.
When I apply the smacof-MDS algorithm on my dataset I can "visually" identify the original grid, however I want to script it to identify if the mds output matches the original grid.
The MDS output: download "mds_coordinates.Rdata"
# mds_node_coordinates <- smacofSym(distance_matrix,ndim=2, type="ratio")
load("mds_coordinates.Rdata") # load the output of above smacofSym call
plot(mds_node_coordinates)
Output Image: MDS plot
What I want to match it to is:
orgGrid <- data.frame(D1=c(2,4,6,8,10,2,4,6,8,10,2,4,6,8,10,2,4,6,8,10), D2=rev(c(rep(12,5),rep(9,5), rep(6,5),rep(3,5) )))
row.names(orgGrid) <- 0:19
library(ggplot2);
ggplot(orgGrid, aes(x=D1, y=D2)) + geom_text(label=row.names(orgGrid),vjust=-1) + geom_point() +
scale_x_discrete(breaks=seq(0,11,2), limits=c(0:12)) + scale_y_discrete(breaks=seq(0,13,3), limits=c(0:13)) +
theme_update(panel.grid.major=element_blank(),panel.grid.minor=element_blank(), panel.background=element_rect(color="white")) + theme_bw()
Output Image: [Original grid, to which MDS output should be snapped (link in the comment)]
As a quick and dirty solution, I could scale the MDS output to my grid size and snap the MDS points to the closest points in the grid.
I am wondering if there is a more elegant solution to tell that these two grids are identical.
Thanks