Calculates various forms of pedigree likelihoods.
likelihood(x, ...)# S3 method for linkdat
likelihood(
x,
locus1,
locus2 = NULL,
theta = NULL,
startdata = NULL,
eliminate = 0,
logbase = NULL,
loop_breakers = NULL,
...
)
# S3 method for singleton
likelihood(x, locus1, logbase = NULL, ...)
# S3 method for 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
)
further arguments.
a marker
object compatible with x
. If
x
is a list, then locus1
must be a list of corresponding
marker
objects.
either NULL, the character 'disease', or a marker
object compatible with x
. See Details.
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.
for internal use.
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.
a numeric, or NULL. If numeric the log-likelihood is returned,
with logbase
as basis for the logarithm.
a numeric containing IDs of individuals to be used as
loop breakers. If NULL, automatic selection of loop breakers will be
performed. See breakLoops
.
a logical; if TRUE, the product of the likelihoods is returned, otherwise a vector with the likelihoods for each pedigree in the list.
an integer between 0 and x$nMark
, indicating which
marker to use in the calculation.
a numeric containing the marker allele frequencies.
for internal use, speeding up linkage computations with few-allelic markers.
The likelihood of the data. If the parameter logbase
is a
positive number, the output is log(likelihood, logbase)
.
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.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab