## MDS and inverse MDS on kinship data subset
D <- as.matrix(kinshipdelta)[1:6, 1:6]
fit <- mds(D) ## MDS D --> conf
ifit <- inverseMDS(fit$conf) ## inverse MDS conf --> D
## MDS fit on dissimilarity matrix obtained by inverse MDS
op <- par(mfrow = c(3,3))
plot(fit, main = "Original MDS")
for (i in 1:length(ifit)) {
fit.i <- mds(ifit[[i]])
plot(fit.i, main = paste0("Inverse MDS (",i, ")"))
}
par(op)
Run the code above in your browser using DataLab