Recode allelic frequencies with different levels

1 | ```
recode.freqs(freqs, along.with)
``` |

`freqs` |
list with named numeric vectors |

`along.with` |
second list of allelic frequencies from which the levels are taken |

Profiles are stored with integers corresponding to the corresponding index of the names attribute of the allelic frequencies. This funciton recodes a set of frequencies to include all names of a larger set of allelic frequencies.

list with named numeric vectors `x`

and `fx`

, denoting respectively the events and probabilities of the discrete distribution.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
# The following example demonstrates the effect on LRs of uncertainty from a small reference db
# We sample a small reference db and compute LRs with estimated frequencies
data(freqsNLsgmplus)
fr.true <- freqsNLsgmplus
# sample a small db
n <- 1e2
x <- sample.profiles(n,fr.true)
x.char <- profiles.to.chars(x,two.cols.per.locus = TRUE)
# estimate frequencies
fr.hat <- list()
for (L in names(fr.true)){
f0.tab <- table(x.char[,paste(L,c(".1",".2"),sep = "")])
fr.hat[[L]] <- setNames(as.vector(f0.tab)/(2*n),names(f0.tab))
}
# not all alleles are seen in the sample, so the ladders don't line up
# rmp(x,fr.hat) # reallly wrong!
fr.hat <- recode.freqs(freqs = fr.hat,along.with = fr.true) # fix
plot(log10(rmp(x)),log10(rmp(x,freqs = fr.hat)))
abline(a=0,b=1)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.