likelihood {paramlink}R Documentation

Pedigree likelihood

Description

Calculates various forms of pedigree likelihoods.

Usage

likelihood(x, ...)

## S3 method for class 'linkdat'
likelihood(
  x,
  locus1,
  locus2 = NULL,
  theta = NULL,
  startdata = NULL,
  eliminate = 0,
  logbase = NULL,
  loop_breakers = NULL,
  ...
)

## S3 method for class 'singleton'
likelihood(x, locus1, logbase = NULL, ...)

## S3 method for class 'list'
likelihood(x, locus1, locus2 = NULL, ..., returnprod = TRUE)

likelihood_LINKAGE(
  x,
  marker,
  theta = NULL,
  afreq = NULL,
  logbase = NULL,
  TR.MATR = NULL,
  initialCalc = NULL,
  singleNum.geno = NULL,
  loop_breakers = NULL
)

Arguments

x

a linkdat object, a singleton object, or a list of such objects. In likelihood_LINKAGE, x must be a linkdat object, with x$model different from NULL.

...

further arguments.

locus1

a marker object compatible with x. If x is a list, then locus1 must be a list of corresponding marker objects.

locus2

either NULL, the character 'disease', or a marker object compatible with x. See Details.

theta

the recombination rate between locus1 and locus2 (in likelihood_LINKAGE: between the marker and the disease locus). To make biological sense theta should be between 0 and 0.5.

startdata

for internal use.

eliminate

mostly for internal use: a non-negative integer indicating the number of iterations in the internal genotype-compatibility algorithm. Positive values can save time if partialmarker is non-empty and the number of alleles is large.

logbase

a numeric, or NULL. If numeric the log-likelihood is returned, with logbase as basis for the logarithm.

loop_breakers

a numeric containing IDs of individuals to be used as loop breakers. If NULL, automatic selection of loop breakers will be performed. See breakLoops.

returnprod

a logical; if TRUE, the product of the likelihoods is returned, otherwise a vector with the likelihoods for each pedigree in the list.

marker

an integer between 0 and x$nMark, indicating which marker to use in the calculation.

afreq

a numeric containing the marker allele frequencies.

TR.MATR, initialCalc, singleNum.geno

for internal use, speeding up linkage computations with few-allelic markers.

Details

All likelihoods are calculated using the Elston-Stewart algorithm.

If locus2 = NULL, the result is simply the likelihood of the genotypes observed at the marker in locus1.

If locus2 = 'disease', the result is the likelihood of the marker genotypes in locus1, given the affection statuses of the pedigree members, the disease model and the recombination rate theta between the marker and disease loci. The main use of this is for computation of LOD scores in parametric linkage analysis.

If locus2 is a marker object, the result is the likelihood of the genotypes at the two markers, given the recombination rate theta between them.

The function likelihood_LINKAGE is a fast version of likelihood.linkdat in the case where locus2 = 'disease' and the marker in locus1 has less than 5 alleles.

Value

The likelihood of the data. If the parameter logbase is a positive number, the output is log(likelihood, logbase).

See Also

lod

Examples


x = linkdat(toyped, model=1) #dominant model

lod1 = likelihood_LINKAGE(x, marker=1, theta=0, logbase=10) -
       likelihood_LINKAGE(x, marker=1, theta=0.5, logbase=10)
lod2 = lod(x, markers=1, theta=0)

# these should be the same:
stopifnot(identical(lod1, as.numeric(lod2)), round(lod1, 2)==0.3)

# likelihood of inbred pedigree (grandfather/granddaughter incest)
y = addOffspring(addDaughter(nuclearPed(1, sex=2), 3), father=1, mother=5, 1)
m = marker(y, 1, 1, 6, 1:2)
l1 = likelihood(y, m)
l2 = likelihood(y, m, loop_breaker=5) # manual specification of loop_breaker
stopifnot(l1==0.09375, l2==l1)


[Package paramlink version 1.1-5 Index]