Calculates various forms of pedigree likelihoods.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
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)
``` |

`x` |
a |

`locus1` |
a |

`locus2` |
either NULL, the character "disease", or a |

`theta` |
the recombination rate between locus1 and locus2 (in |

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

`logbase` |
a numeric, or NULL. If numeric the log-likelihood is returned, with |

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

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

`afreq` |
a numeric containing the marker allele frequencies. |

`startdata` |
for internal use. |

`TR.MATR, initialCalc, singleNum.geno` |
for internal use, speeding up linkage computations with few-allelic markers. |

`...` |
further arguments. Not used. |

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.

The likelihood of the data. If the parameter `logbase`

is a positive number, the output is `log(likelihood, logbase)`

.

Magnus Dehli Vigeland

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.