Learn R Programming

DNAprofiles (version 0.3.1)

ibs.pairwise.db.exp: Compute expected number of profiles pairs in a database that match fully and partially at each number of loci

Description

For a database comparison exercise, this function computes the expected number of pairs that match fully or partially at each number of loci in a heterogeneous database.

Usage

ibs.pairwise.db.exp(subpops, fractions = rep(1/length(subpops), length(subpops)), N = 2L, ks = c("UN", "FS", "PO"), alpha.w = c(1, 0, 0))

Arguments

subpops
List with allele frequencies in each subpopulation.
fractions
Numeric
N
Total size of database.
ks
IBD-probabilities for the relations that occur within subpopulations (with probabilities alpha.w) and between (with probabilities alpha.b). Passed on to ibdprobs.
alpha.w
Numeric with same length as ks. The i'th element denotes the probability that a pair of profiles within a subpopulation is related as described by the i'th element of ks.

Value

Matrix with the expected number of full/partial matches on 0,1,2,... loci in the database.

Details

When all profiles in the database are compared pairwise, one can count the number of profiles that match fully/partially for each number of loci. Such a procedure is implemented as ibs.pairwise.db. The current function computes the expected value of this matrix. The database can be heterogeneous (consisting of subpopulations with different allele frequencies) and within-subpopulation inbreeding is supported.

See Also

as.dbcompare

Examples

Run this code
data(freqsNLsgmplus)

# sample small db, make all pairwise comparisons and compute the expected number

N <- 1e3
db <- sample.profiles(N=N,freqs=freqsNLsgmplus)

O <- ibs.pairwise.db(db)
E <- ibs.pairwise.db.exp(subpops = list(freqsNLsgmplus),N = N)

O # observed
E # expected

Run the code above in your browser using DataLab