pml {phangorn} | R Documentation |
optim.pml
computes the likelihood of a phylogenetic tree
given a sequence alignment and a model. optim.pml
optimizes the
different model parameters.
pml(tree, data, bf=rep(1/length(levels),length(levels)), shape=1, k=1, Q=rep(1,length(levels)*(length(levels)-1)/2), levels=attr(data,"levels"), inv=0, g=NULL, w=NULL, eig=NULL, INV=NULL, ll.0=NULL, ...) optim.pml(object, optNni=FALSE, optBf=FALSE, optQ=FALSE, optInv=FALSE, optGamma=FALSE, optEdge=TRUE, control = list(maxit=10, eps=0.001))
tree |
A phylogenetic tree , object of class phylo . |
data |
The (DNA) alignment. |
bf |
Base frequencies. |
shape |
Shape parameter of the gamma distribution. |
k |
Number of intervalls of the discrete gamma distribution. |
Q |
A vector containing the lower triangular part of the rate matrix. |
levels |
Factor levels of the data. |
inv |
Proportion of invariable sites. |
g |
Rate. |
w |
Weight of the mixture. |
eig |
The eigenvalues and eigenvectors of the transition matrix. . |
INV |
For internal use. |
object |
An object of class pml . |
optNni |
Logical value indicating whether toplogy gets optimized (NNI). |
optBf |
Logical value indicating whether base frequencies gets optimized. |
optQ |
Logical value indicating whether rate matrix gets optimized. For dna this means: FALSE=Jukes-Cantor, TRUE=GTR |
optInv |
Logical value indicating whether proportion of variable size gets optimized. |
optGamma |
Logical value indicating whether gamma rate parameter gets optimized. |
optEdge |
Logical value indicating the edge lengths gets optimized. |
control |
A list of parameters for controlling the fitting process. |
ll.0 |
For internal use |
... |
Further arguments passed to or from other methods. |
The input variables w, g, eig, INV are used to speed up computation,
especially during the optimising used in optim.pml
,
but are not intended to be used by the enduser. The toppology search
uses a nearest neighbour interchange (NNI) and is similar to phyML.
Returns a list of class ll.phylo
logLik |
Log likelihood of the tree. |
siteLik |
Site log likelihoods. |
root |
likelihood in the root node. |
weight |
Weight of the site patterns. |
For small trees the likelihood seems to be similar to Paup* or PhyML.
Klaus Schliep K.P.Schliep@massey.ac.nz
Felsenstein, J. (1981) Evolutionary trees from DNA sequences: a maxumum likelihood approach. Journal of Molecular Evolution, 17, 368–376.
Felsenstein, J. (2004). Inferring Phylogenies. Sinauer Associates, Sunderland.
Yang, Z. (2006). Computational Molecular evolution. Oxford University Press, Oxford.
For a different implementation see mlphylo
.
example(NJ) # Jukes-Cantor + Gamma + I fitJC <- pml(tree, Laurasiatherian, k=4, inv=.25) summary(fitJC) # just optimise edge length parameter fitJC <- optim.pml(fitJC) summary(fitJC) plot(fitJC$tree) ## Not run: # optimise parameter fitJC <- optim.pml(fitJC, optNni=TRUE, optGamma=TRUE, optInv=TRUE) summary(fitJC) # F81 + Gamma + I - model fitF81 <- optim.pml(fitJC, optNni=TRUE, optGamma=TRUE, optInv=TRUE, optBf=TRUE) summary(fitF81) # GTR + Gamma + I - model fitGTR <- optim.pml(fitF81, optNni=TRUE, optGamma=TRUE, optInv=TRUE, optBf=TRUE, optQ=TRUE) summary(fitGTR) ## End(Not run) # 2-state data (RY-coded) dat <- as.character(Laurasiatherian) # RY-coding dat[dat=="a"] <- "r" dat[dat=="g"] <- "r" dat[dat=="c"] <- "y" dat[dat=="t"] <- "y" dat <- phyDat(dat, levels=c("r","y")) fit2ST <- pml(tree, dat, k=4, inv=.25) fit2ST <- optim.pml(fit2ST,optNni=TRUE, optGamma=TRUE, optInv=TRUE) methods(class="pml")