likelihood {pedprobr} | R Documentation |
Pedigree likelihood
Description
The likelihood()
and likelihood2()
functions constitute the heart of
pedprobr. The former computes the pedigree likelihood for each indicated
marker. The latter computes the likelihood for a pair of linked markers
separated by a given recombination rate.
Usage
likelihood(x, ...)
## S3 method for class 'ped'
likelihood(
x,
markers = NULL,
peelOrder = NULL,
lump = TRUE,
eliminate = 0,
logbase = NULL,
loopBreakers = NULL,
allX = NULL,
verbose = FALSE,
theta = 0,
...
)
## S3 method for class 'list'
likelihood(x, markers = NULL, logbase = NULL, ...)
likelihood2(x, ...)
## S3 method for class 'ped'
likelihood2(
x,
marker1,
marker2,
rho = NULL,
peelOrder = NULL,
eliminate = 0,
logbase = NULL,
loopBreakers = NULL,
verbose = FALSE,
...
)
## S3 method for class 'list'
likelihood2(x, marker1, marker2, logbase = NULL, ...)
Arguments
x |
A |
... |
Further arguments. |
markers |
One or several markers compatible with
|
peelOrder |
For internal use. |
lump |
Activate allele lumping, i.e., merging unobserved alleles. This is an important time saver, and should be applied in nearly all cases. (The parameter exists mainly for debugging purposes.) The lumping algorithm will detect (and complain) if any markers use a non-lumpable mutation model. Default: TRUE. |
eliminate |
Deprecated, not used. |
logbase |
Either NULL (default) or a positive number indicating the
basis for logarithmic output. Typical values are |
loopBreakers |
A vector of ID labels indicating loop breakers. If NULL
(default), automatic selection of loop breakers will be performed. See
|
allX |
For internal use; set to TRUE if all markers are X-chromosomal. |
verbose |
A logical. |
theta |
Theta correction. |
marker1 , marker2 |
Single markers compatible with |
rho |
The recombination rate between |
Details
The implementation is based on the peeling algorithm of Elston and Stewart (1971). A variety of situations are covered; see the Examples section for some demonstrations.
autosomal and X-linked markers
1 marker or 2 linked markers
complex inbred pedigrees
markers with mutation models
pedigrees with inbred founders
For more than two linked markers, see likelihoodMerlin()
.
Value
A numeric with the same length as the number of markers indicated by
markers
. If logbase
is a positive number, the output is
log(likelihood, logbase)
.
Author(s)
Magnus Dehli Vigeland
References
Elston and Stewart (1971). A General Model for the Genetic Analysis of Pedigree Data. doi:10.1159/000152448
See Also
likelihoodMerlin()
, for likelihoods involving more than 2 linked markers.
Examples
### Simple likelihood ###
p = 0.1
q = 1 - p
afr = c("1" = p, "2" = q)
# Singleton
s = singleton() |> addMarker(geno = "1/2", afreq = afr)
stopifnot(all.equal(likelihood(s), 2*p*q))
# Trio
trio = nuclearPed() |>
addMarker(geno = c("1/1", "1/2", "1/1"), afreq = afr)
stopifnot(all.equal(likelihood(trio), p^2 * 2*p*q * 0.5))
### Example of calculation with inbred founders ###
### Case 1: Trio with inbred father
x = cousinPed(0, child = TRUE)
x = addSon(x, 5)
x = relabel(x, old = 5:7, new = c("father", "mother", "child"))
# Add equifrequent SNP; father homozygous, child heterozygous
x = addMarker(x, father = "1/1", child = "1/2")
# Plot with genotypes
plot(x, marker = 1)
# Compute the likelihood
lik1 = likelihood(x, markers = 1)
### Case 2: Using founder inbreeding
# Remove ancestry of father
y = subset(x, c("father", "mother", "child"))
# Indicate that the father has inbreeding coefficient 1/4
founderInbreeding(y, "father") = 1/4
# Plot (notice the inbreeding coefficient)
plot(y, marker = 1)
# Likelihood should be the same as above
lik2 = likelihood(y, markers = 1)
stopifnot(all.equal(lik1, lik2))