Hi Gustavo,

This used to be possible, and you could possibly use an older version of
diversitree to do what you want to do.  Things changed about a year, I
think.

Unfortunately, integrating time-varying functions efficiently is quite hard
when parameters vary as arbitrary R functions.  I've never been very happy
with the hacks and trade-offs to get that working (the issue is that the
ODE integrators are all written in C and calling R functions from C incurs
significant overhead over the usual R function calls plus you get no
vectorisation advantages).

I decided to weight the speed/flexibility trade-off in favour of speed and
settled on a simpler (and much faster) approach where there are a few
pre-built options that match some simple cases:
  https://github.com/richfitz/diversitree/blob/master/src/TimeMachine.cpp

If you need something extra, just add it in there (and in TimeMachine.h),
just modifying the general approach in (say) tm_fun_linear.  You'll need to
match the prototypes exactly, but you can pass in as many parameters as you
need.  Then add your function to the list in R/time-machine.R:

https://github.com/richfitz/diversitree/blob/master/R/time-machine.R#L45-L49
which will organise parameter names and things like that.  Then you just
reference the function by the name there and everything should work.

Once that's done, send me a pull request on github and I can incorporate it
into the package.  The functions that are currently there are just the
first things that seem reasonable and are obviously not a complete list.

I'm not actively working on diversitree at the moment, or I'd do this for
you.  But if you get into trouble let me know and I'll see if I can get it
going.

Cheers,
Rich



On 30 May 2014 05:10, Gustavo Burin Ferreira <[email protected]> wrote:

> Dear list,
>
> I am trying to create a likelihood function based on trees that were
> simulated with an exponential decay on speciation rates through time, and
> with constant extinction rates.
>
> I thought I could use make.bd.t from diversitree for this matter. However,
> it seems that this function doesn't accept exponential as a valid type of
> function (at least as far as I could dig into the code).
>
> Can you advise me on how should I proceed to implement this? I am still
> trying to get used to the way diversitree functions are coded, and couldn't
> figure this out.
>
> Thanks in advance for any help!
>
> Regards,
>
> *Gustavo Burin Ferreira, **Msc.*
> Instituto de Biociências
> Universidade de São Paulo
> Tel: (11) 98525-8948
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-phylo mailing list - [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/[email protected]/
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/

Reply via email to