richfitz / diversitree

diversitree: comparative phylogenetic analyses of diversification
http://www.zoology.ubc.ca/prog/diversitree
30 stars 9 forks source link

Problem with asr.stoch and irreversible model #10

Open sdwfrost opened 10 years ago

sdwfrost commented 10 years ago

Dear @richfitz

Nice job on diversitree - I've just started to play with it.

I'm trying to run stochastic mapping using the example of an irreversible mk2 model given here

The following code works fine with asr.joint and asr.marginal, but throws an error with asr.stoch

pars <- c(.1, .1, .03, .03, .03, .06)
set.seed(1)
phy <- trees(pars, "bisse", max.taxa=4, max.t=Inf, x0=0)[[1]]
h <- history.from.sim.discrete(phy, 0:1)
plot(h, phy, main="True history")
lik <- make.mk2(phy, phy$tip.state)
argnames(lik)
lik2<-constrain(lik, q10~0)
argnames(lik2)
fit2 = find.mle(lik2,c(.1))
st.s2 <- asr.stoch(lik2, fit2$par)

The above gives the following error:

Error in asr(lik(pars, pars.only = TRUE), ...) : 
  Exceeding maximum allowed history size

I don't get this for the unconstrained model when doing stochastic mapping. I've also tried calling make.asr.stoch.constrained explicitly, but I got the same error.