recode.freqs: Recode allelic frequencies with different levels

Description Usage Arguments Details Value Examples

Description

Recode allelic frequencies with different levels

Usage

1
recode.freqs(freqs, along.with)

Arguments

freqs

list with named numeric vectors x and fx, denoting respectively the events and probabilities of the discrete distribution.

along.with

second list of allelic frequencies from which the levels are taken

Details

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.

Value

list with named numeric vectors x and fx, denoting respectively the events and probabilities of the discrete distribution.

Examples

 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)

DNAprofiles documentation built on Jan. 15, 2017, 9:27 p.m.