Permalink
Browse files

remove expm & replace with internal function

  • Loading branch information...
liamrevell committed Nov 17, 2017
1 parent d7cc1c8 commit 0f58982c423dcbbce39d5814803178aa2278250c
Showing with 19 additions and 38 deletions.
  1. +7 −7 DESCRIPTION
  2. +2 −2 NAMESPACE
  3. +9 −1 R/fitMk.R
  4. +1 −1 R/make.simmap.R
  5. +0 −7 R/utilities.R
  6. +0 −20 man/expm.Rd
View
@@ -1,18 +1,18 @@
Package: phytools
Version: 0.6-44
Date: 2017-11-11
Version: 0.6-45
Date: 2017-11-17
Title: Phylogenetic Tools for Comparative Biology (and Other Things)
Author: Liam J. Revell
Maintainer: Liam J. Revell <liam.revell@umb.edu>
Depends: R (>= 3.2.0), ape (>= 4.0), maps
Imports: animation, clusterGeneration, coda, combinat, graphics, grDevices,
MASS, methods, mnormt, msm, nlme, numDeriv, phangorn (>= 2.3.1), plotrix,
scatterplot3d, stats, utils
Imports: animation, clusterGeneration, coda, combinat, expm, graphics,
grDevices, MASS, methods, mnormt, nlme, numDeriv, phangorn (>= 2.3.1),
plotrix, scatterplot3d, stats, utils
Suggests: geiger, rgl
ZipData: no
Description: A wide range of functions for phylogenetic analysis. Functionality is concentrated in phylogenetic comparative biology, but also includes a diverse array of methods for visualizing, manipulating, reading or writing, and even inferring phylogenetic trees and data. Included among the functions in phylogenetic comparative biology are various for ancestral state reconstruction, model-fitting, simulation of phylogenies and data, and multivariate analysis. There are a broad range of plotting methods for phylogenies and comparative data which include, but are not restricted to, methods for mapping trait evolution on trees, for projecting trees into phenotypic space or a geographic map, and for visualizing correlated speciation between trees. Finally, there are a number of functions for reading, writing, analyzing, inferring, simulating, and manipulating phylogenetic trees and comparative data not covered by other packages. For instance, there are functions for randomly or non-randomly attaching species or clades to a phylogeny, for estimating supertrees or consensus phylogenies from a set, for simulating trees and phylogenetic data under a range of models, and for a wide variety of other manipulations and analyses that phylogenetic biologists might find useful in their research.
License: GPL (>= 2)
URL: http://github.com/liamrevell/phytools
Packaged: 2017-11-11 12:00:00 EST
Packaged: 2017-11-17 12:00:00 EST
Repository:
Date/Publication: 2017-11-11 12:00:00 EST
Date/Publication: 2017-11-17 12:00:00 EST
View
@@ -6,7 +6,7 @@ export(compute.mr, cospeciation)
export(density.multiSimmap, densityMap, densityTree, describe.simmap, di2multi.simmap, dot.legend, dotTree, drop.clade, drop.leaves)
export(drop.tip.contMap, drop.tip.densityMap, drop.tip.simmap, drop.tip.singleton)
export(edgelabels.cophylo, edgeProbs, errorbar.contMap, estDiversity, evol.rate.mcmc, evol.vcv, evolvcv.lite, exhaustiveMP)
export(expand.clade, expm, export.as.xml, extract.clade.simmap, extract.strahlerNumber)
export(expand.clade, export.as.xml, extract.clade.simmap, extract.strahlerNumber)
export(fancyTree, fastAnc, fastBM, fastDist, fastHeight, fastMRCA, findMRCA, fit.bd, fit.yule, fitBayes, fitMk, fitDiversityModel, fitPagel)
export(force.ultrametric)
export(gammatest, genus.to.species.tree, genSeq, geo.legend, get.treepos, getCladesofSize, getDescendants, getExtant, getExtinct, getnode)
@@ -141,7 +141,6 @@ importFrom(ape, unroot, vcv, vcv.phylo, write.tree)
importFrom(clusterGeneration, genPositiveDefMat)
importFrom(maps, map)
importFrom(mnormt, dmnorm, pd.solve)
importFrom(msm, MatrixExp)
importFrom(numDeriv, hessian)
importFrom(phangorn, allTrees, Ancestors, as.phyDat, dist.hamming, midpoint, NJ, nni, nnls.tree, optim.parsimony, parsimony, phyDat, pratchet, treedist, RF.dist, KF.dist, path.dist, SPR.dist, Children, Descendants, threshStateC)
importFrom(plotrix, arctext, draw.arc, draw.circle, draw.ellipse, textbox)
@@ -156,3 +155,4 @@ importFrom(combinat, permn)
importFrom(coda, HPDinterval)
importFrom(nlme, gls, varFixed)
importFrom(MASS, ginv)
importFrom(expm, expm)
View
@@ -84,7 +84,7 @@ fitMk<-function(tree,x,model="SYM",fixedQ=NULL,...){
el<-pw$edge.length[ii]
v<-vector(length=length(desc),mode="list")
for(j in 1:length(v))
v[[j]]<-expm(Q*el[j])%*%liks[desc[j],]
v[[j]]<-EXPM(Q*el[j])%*%liks[desc[j],]
vv<-if(anc==root) Reduce('*',v)[,1]*pi else Reduce('*',v)[,1]
comp[anc]<-sum(vv)
liks[anc,]<-vv/comp[anc]
@@ -250,3 +250,11 @@ plot.gfit<-function(x,...){
plot(obj,...)
}
}
## wraps around expm
## written by Liam Revell 2011, 2017
EXPM<-function(Y,...){
eY<-if(isSymmetric) matexpo(Y) else expm(Y,...)
dimnames(eY)<-dimnames(Y)
eY
}
View
@@ -238,7 +238,7 @@ smap<-function(tree,x,N,m,root,L,Q,pi,logL){
NN[which(tree$edge[,1]==root),1]<-rstate(L[as.character(root),]*pi/sum(L[as.character(root),]*pi)) # assign root
for(j in 1:nrow(tree$edge)){
# conditioned on the start value, assign end value of node (if internal)
p<-expm(Q*tree$edge.length[j])[NN[j,1],]*L[as.character(tree$edge[j,2]),]
p<-EXPM(Q*tree$edge.length[j])[NN[j,1],]*L[as.character(tree$edge[j,2]),]
NN[j,2]<-rstate(p/sum(p))
NN[which(tree$edge[,1]==tree$edge[j,2]),1]<-NN[j,2]
# now simulate on the branches
View
@@ -1941,13 +1941,6 @@ matchType<-function(type,types){
type=types[i]
return(type)
}
# wraps around MatrixExp
# written by Liam Revell 2011
expm<-function(Y){
Z<-MatrixExp(Y); dimnames(Z)<-dimnames(Y)
return(Z)
}
# function 'untangles' (or attempts to untangle) a tree with crossing branches
# written by Liam J. Revell 2013, 2015
View

This file was deleted.

Oops, something went wrong.

0 comments on commit 0f58982

Please sign in to comment.