ki.db: Computes KIs for case profile(s) with all database profiles

Description Usage Arguments Examples

Description

Computes KIs for case profile(s) with all database profiles

Usage

1
2
3
ki.db(x, db, hyp.1, hyp.2 = "UN", freqs = get.freqs(x),
  markers = intersect(get.markers(x), get.markers(db)), theta = 0,
  ret.per.marker = FALSE, precomputed.kis)

Arguments

x

An integer matrix specifying either a single profile or a number of profiles. Alternatively an integer vector containing a single profile, e.g. obtained when a row is selected from a matrix of profiles.

db

An integer matrix which is the database of profiles.

hyp.1

A character string giving the hypothesis in the numerator of the KI. Should be one of ibdprobs, e.g. "FS" (full sibling) or "PO" (parent/offspring) or "UN" (unrelated).

hyp.2

A character string giving the hypothesis in the denominator of the KI. Should be one of ibdprobs, e.g. "FS" (full sibling) or "PO" (parent/offspring) or "UN" (unrelated). Defaults to "UN".

freqs

A list specifying the allelic frequencies. Should contain a vector of allelic frequencies for each locus, named after that locus.

markers

Character vector stating the markers to use in the KI computation. Defaults to the intersection of the markers of x1 and x2.

theta

Numeric value specifying the amount of background relatedness.

ret.per.marker

Logical. If TRUE, return a matrix of KIs, where the columns correspond to markers.

precomputed.kis

(optionally) a list of precomputed KIs, returned by ki.precompute. This speeds up the computation when multiple profiles are run against the db (i.e. x has more than one row).

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
26
27
data(freqsNLsgmplus)
fr <- freqsNLsgmplus

# sample a profile, a database and compute the Sibling Index (SI) with all database members
x <- sample.profiles(N=1,fr)
db <- sample.profiles(N=10^4,fr)
si <- ki.db(x,db=db,"FS")

# estimate the exceedance probabilities of an SI-threshold
t <- 1 # choose threshold SI=1
x <- sample.profiles(N=1,fr)
sibs <- sample.relatives(x,N=10^4,type="FS")
unrelated <- sample.profiles(N=10^4,fr)
mean(ki.db(x,db=sibs,"FS")>=t) # the vast majority of true siblings has an SI>=1
mean(ki.db(x,db=unrelated,"FS")>=t) # a few percent of unrelated persons have SI >= 1

# estimate distribution of SI for true siblings and unrelated persons
x <- sample.profiles(N=1,fr) #sample profile
sibs <- sample.relatives(x,N=10^4,type="FS") #sample sibs
unrelated <- sample.profiles(N=10^4,fr) #sample unrelated persons

sibs.si <- ki.db(x,db=sibs,"FS") #compute SI for true siblings
unrelated.si <- ki.db(x,db=unrelated,"FS") #compute SI for unrelated persons
#plot density estimates of SI
plot(density(log10(unrelated.si)),xlim=c(-10,10),lty="dashed",
    xlab=expression(log[10](SI)),main="SI for true sibs and unrelated profiles")
lines(density(log10(sibs.si)))

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