lik2: Pairwise likelihood with mutation

View source: R/lik2.R

lik2R Documentation

Pairwise likelihood with mutation

Description

Reversibility is assumed for the mutation model and the likelihood is calculated for a pair of non-inbred individuals.

Usage

lik2(g1, g2, n, p, M, kappa, alpha, theta = 0)

Arguments

g1

Genotype, two integers giving the alleles for individual 1.

g2

Genotype, two integers giving the alleles for individual 2.

n

Integer vector of length 4 giving the distance between paternal-paternal, paternal-maternal, maternal-paternal and maternal-maternal alleles.

p

Vector of real numbers. Allele frequency vector.

M

Matrix of real numbers. Mutation matrix.

kappa

Vector of real numbers describing relationship. IBD parameters for 0,1,2 IBD alleles.

alpha

Four probabilities, summing to 1, giving the probability, in the case IBD = 1, that the alleles are paternal-paternal, paternal-maternal, maternal-paternal, and maternal-maternal.

theta

Real in '[0,1]'. Kinship coefficient.

Details

There are two non-inbred individuals A and B, with genotypes a/b and c/d, where the alleles may or may not differ. We calculate the likelihood assuming a relationship described by kappa.

Value

Likelihood.

Author(s)

Thore Egeland <Thore.Egeland@nmbu.no>

References

Egeland, Pinto and Amorim, FSI:Genetics (2017), \Sexpr[results=rd]{tools:::Rd_expr_doi("http://dx.doi.org/10.1016/j.fsigen.2017.04.018")}.

Examples

# Example 1 Parent offspring relationship
p = c("1" = 0.2, "2" = 0.8)
M = mutationMatrix("proportional", afreq = p, rate = 0.01)
n = c(0, 1, 1, 0)
kappa =  c(0, 1, 0)
alpha =  c(0, 0.5, 0.5, 0)
l1 = lik2(c(1,1), c(2,2), n, p, M, kappa, alpha)
# Calculated using formula
gamma = mut2::expectedMutationRate(M, p)
K = gamma/(1- sum(p^2))
l1.formula = p[1]^2*K*p[2]^2
l1 - l1.formula

# Example 2 Double first cousins
n = c(0, 4, 4, 0) 
kappa = c(9,6,1)/16
alpha = c(0, 0.5,0.5, 0)
g1 = c(1,1); g2 = c(2,2)
lik1 = lik2(g1, g2, n, p, M, kappa, alpha)
lik0 = lik2(g1, g2, n = rep(0,4), p, M, 
            kappa = c(1,0,0), alpha = rep(0,4))
LR = lik1/lik0
# Formula
LR.formula = kappa[1] + 
           kappa[2]*(1-(1-K)^4)+ 
           kappa[3]*(1-(1-K)^4) * (1-(1-K)^4)
LR - LR.formula            

thoree/mut2 documentation built on May 16, 2023, 7:56 p.m.