Learn R Programming

TimeMachine (version 1.0)

mu.mle: Maximum-Likelihood Estimation of the Mutation Rate

Description

Estimates the mutation rate using a maximum-likelihood approach.

Usage

mu.mle(transitions, pi=NULL, population, n, mu.int, samples,
              threads=NULL, ...)

Arguments

transitions
Transition matrix between types
pi
Stationary distribution associated with the transition matrix, or NULL to compute it
population
Vector representing the initial population
n
Target population size
mu.int
Vector specifying the end-points of the interval to be searched for the optimal mutation rate
samples
Number of samples to simulate
threads
Number of threads used for simulations, or NULL to use the default OpenMP setting
...
Further arguments passed to optimize

Value

  • mu.hatThe maximum-likelihood estimate of the mutation rate
  • loglikThe log-likelihood value associated with the estimated mutation rate

Examples

Run this code
# Load example dataset
data(pdm)
transitions <- full.transitions(pdm$unitary.transitions, pdm$loci)
pi <- stationary.dist(transitions)

mu.int <- c(0.1, 10)
samples <- 10

# MLE of the mutation rate for a single target population size
n <- 10
mle.res <- mu.mle(transitions, pi, pdm$population, n, mu.int, samples)
print(mle.res)

# MLE of the mutation rate for 10 different target population sizes, including
# up to the MRCA (n = 1)
ns <- 1:10
mle.res <- sapply(ns, mu.mle, transitions=transitions, pi=pi,
                  population=pdm$population, mu.int=mu.int, samples=samples)
print(mle.res)

Run the code above in your browser using DataLab