Learn R Programming

DNAprofiles (version 0.3.1)

ki.precompute: Pre-computes KIs for use with ki.db function

Description

Pre-computes KIs for use with ki.db function

Usage

ki.precompute(type, freqs, markers = names(freqs), theta = 0)

Arguments

type
A character string giving the type of KI. See ibdprobs.
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 all markers contained in freqs.
theta
numeric value specifying the amount of background relatedness.

Value

list A list of numeric vectors containing the KIs for all genotypic combinations at each locus.

Details

In large scale simulation studies, it is sometimes useful to precompute KIs to speedup computations.

See Also

ki.db

Examples

Run this code
## Not run: 
# data(freqsNLngm);
# n <- 1e6
# 
# targets <- sample.profiles(N = 1e2,freqs = freqsNLngm)
# db <- sample.profiles(N = 1e5,freqs = freqsNLngm)
# 
# precomp <- ki.precompute(type = "FS",freqs = freqsNLngm)
# 
# R1 <- ki.db(x = targets,db = db,hyp.1 = "FS")
# R2 <- ki.db(x = targets,db = db,precomputed.kis = precomp) # a little faster
# 
# all.equal(R1,R2)
# 
# ## End(Not run)

Run the code above in your browser using DataLab