jc69.2s: The JC69 model on a pairwise sequence alignment

Description Usage Arguments Details Value Author(s) References Examples

Description

The JC69 model on a pairwise sequence alignment

Usage

1
2
3
4
5
jc69.2smle(x, n)

jc69.2slnL(d, x, n)

jc69.2slnP(d, x, n, shape, rate, C = 1)

Arguments

x

numeric, the number of differences in the alignment

n

numeric, the number of sites in the alignment

d

numeric, the molecular distance

shape

numeric, the shape of the gamma prior on d

rate

numeric, the rate of the gamma prior on d

C

numeric, a scaling constant

Details

jc692s.mle calulates the MLE of d. jc69.2slnL computes the log-likelihood and jc69.2slnP computes the log-posterior assuming a gamma prior on d.

Value

jc69.2slnL and jc69.2slnP return vectors of log-likelihood and log-posterior values respectively.

Author(s)

Mario dos Reis

References

Yang Z (2014) Molecular evolution: A Statistical approach, Oxford University Press.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(humanorang)

par(mfrow=c(1,2))
# Plot the likelihood:
curve(exp(jc69.2slnL(x, x=humanorang$x, n=humanorang$n)),
  n=5e2, from=0, to=0.2, ylab="Likelihood", xlab="Molecular distance (d)")
abline(v=jc69.2smle(x=humanorang$x, n=humanorang$n), col="red", lty=2)

# Plot the posterior:
curve(exp(jc69.2slnP(x, x=humanorang$x, n=humanorang$n, shape=1, rate=5)),
  n=5e2, from=0, to=0.2, ylab="Posterior", xlab="Molecular distance (d)")

# Does not integrate to one:
integrate(function(x) exp(jc69.2slnP(x, x=humanorang$x, n=humanorang$n,
  shape=1, rate=5)), lower=0, upper=Inf, abs.tol=0)

# Integrates to one:
integrate(function(x) exp(jc69.2slnP(x, x=humanorang$x, n=humanorang$n,
  shape=1, rate=5, C=1/5.167762e-131)), lower=0, upper=Inf, abs.tol=0)

dosreislab/simplephy documentation built on May 11, 2019, 7:27 p.m.