Skip to content

Commit

Permalink
add a short script to explore some diversitree functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdgamboa committed Sep 21, 2023
1 parent 119f9da commit cbb141b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions inst/scripts/diversitree.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
library(diversitree)

## It seems that is based on the same models
## as ape::ace (Pagel 1994)

## Check out this link:
## https://www.zoology.ubc.ca/~fitzjohn/diversitree.docs/asr-bisse.html

pars <- c(0.1, 0.2, 0.03, 0.06, 0.01, 0.02)
set.seed(3)
phy <- trees(pars, "bisse", max.taxa = 50, max.t = Inf, x0 = 0)[[1]]

lik <- make.bisse(phy, phy$tip.state)
fit <- find.mle(lik, pars, method = "subplex")
st <- asr.marginal(lik, coef(fit))
nodelabels(thermo = t(st), piecol = 1:2, cex = 0.5)

0 comments on commit cbb141b

Please sign in to comment.