sim_ser | R Documentation |
This function computes the switch error rate in the vector case only First, we find a match 0/1/-1 encoding between the prediction and truth genotypes. 0 = match, 1 | -1 = mismatch We then find all locations that are mismatch. For switch error rate, however, we only want to find standalone mismatches as well as the first mismatch in a stretch of mismatches. Therefore, we use the diff function to find the difference between adjacent elements in the match 0/1/-1 encoding We sum those for which the difference is not 1, suggesting that it is a new standalone, or start of a stretch, We also add one to this sum for the very first mismatch We finally divide by num_snps to find the switch error rate
sim_ser(truth, predicted, num_snps)
truth |
a vector of genotypes in 0/1 encoding, the truth |
predicted |
a vector of genotyptes in 0/1 encoding, predicted from rhapsodi |
num_snps |
an integer, the number of genotypes or the length of the haplotype |
to_return a numeric, the switch error rate
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.