# ibs.pairwise.db.exp: Compute expected number of profiles pairs in a database that... In DNAprofiles: DNA Profiling Evidence Analysis

## 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

 ```1 2 3``` ```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`.

## 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.

## Value

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

`as.dbcompare`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```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 ```