sim2dis | R Documentation |
Converts a similarity matrix (e.g. a kinship matrix) into a dissimilarity matrix.
sim2dis(f, a=4.0, baseF=0.03, method=1)
f |
Similarity matrix. |
a |
Exponent |
baseF |
Old inbreeding not measured by |
method |
Either |
This function converts a similarity matrix f
with values between 0 and 1 (e.g. a kinship matrix) into a dissimilarity matrix.
At first, the similarity is adjusted as
f <- baseF + (1-baseF)*f
.
Then, for Method 1, the dissimilarity between individuals i
and j
is computed as
Dij = (-log(fij))^a
,
whereas for Method 2, the dissimilarity is computed as
Dij = sqrt((fii+fjj)/2-fij)^a
.
Although Method 2 may provide lower stress values in some cases, Method 1 has the advantage that the area reflects the diversity of a population more reasonable.
Dissimilarity matrix D.
Robin Wellmann
data(map)
dir <- system.file("extdata", package = "optiSel")
files <- file.path(dir, paste("Chr", unique(map$Chr), ".phased", sep=""))
f <- segIBD(files, map, minSNP=15, minL=1.0)
D <- sim2dis(f, 4)
## Multidimensional scaling of animals:
data(Cattle)
library("smacof")
color <- c(Angler="red", Rotbunt="green", Fleckvieh="blue", Holstein="black")
col <- color[as.character(Cattle$Breed)]
Res <- smacofSym(D, itmax = 5000, eps = 1e-08)
plot(Res$conf, pch=18, col=col, main="Multidimensional Scaling", cex=0.5)
mtext(paste("segIBD Stress1 = ", round(Res$stress,3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.