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

Description Usage Arguments Value Examples

View source: R/tm.R

Description

Estimates the mutation rate using a maximum-likelihood approach.

Usage

1
2
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.hat

The maximum-likelihood estimate of the mutation rate

loglik

The log-likelihood value associated with the estimated mutation rate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# 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)

TimeMachine documentation built on Sept. 11, 2018, 5:03 p.m.