Giter VIP home page Giter VIP logo

mbd's People

Contributors

giappo avatar rsetienne avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

mbd's Issues

Feature request: CITATION file

Hi @Giappo,

I wanted to use a reference to a manuscript that uses MDB (?razzo), so I looked for a CITATION file in the inst folder. There is none yet.

Therefore, I'd like to request a CITATION file (tip: peek at babette)

Would be great!

Sure I'll help ๐Ÿ‘

The integrator produces negative values

For some parameter choices (e.g. very high numbers, see test-mbd_ml:R147 (pars = c(60, 50, 100, 0.5)). The integration yields negative probabilities. This is best exposed considering the result of the conditioning probability, calculated with "calculate_conditional_prob".

Improve the starting value for the ml

There are several ways to do that:
1: Start multiple chains from different points and choose the ending results with the greatest likelihood;
2: Use a kind of simulated annealing to thermally move when a local maximum is reached;
3: ...

Bug: Assertion 'testit::assert(sum(time_intervals) == max(abs(brts)))' failed [WIP]

I put a sketch of a bug-report here, will improve later:

richel@sonic:~/data$ ./do_all 

razzo_project_20190815/
./scripts/10_create_n_mb_species_file.sh: line 20: module: command not found
Error: sum(time_intervals) == max(abs(brts)) is not TRUE
Execution halted

...

razzo_project_20190911_unfinished/
./scripts/10_create_n_mb_species_file.sh: line 20: module: command not found
Error: sum(time_intervals) == max(abs(brts)) is not TRUE
Execution halted

Verify the assert is in mbd:

richel@sonic:~/GitHubs$ egrep -R "sum.time_intervals. == max.abs.brts.." --include=*.R
mbd/R/mbd_loglik_utils.R:  testit::assert(sum(time_intervals) == max(abs(brts)))

I predict the assert is too strict and adding a little tolerance would fix this.

But again, this is just a (temporary) sketch

Cannot do ML estimation on BD trees

The maximum likelihood estimation of the MBD package fails on (Single)BD trees.

# Simulate a BD tree
set.seed(10)
lambda <- 0.3
mu <- 0.1
phylogeny <- mbd_sim_checked(
  mbd_params = create_mbd_params(lambda = lambda, mu = mu, nu = 0.0, q = 0.0),
  crown_age = 2,
  conditioned_on = "non_extinction"
)$tes

# Maximum likelihood of BD tree
ml_est <- mbd_calc_max_lik(
  branching_times = ape::branching.times(phylogeny),
  init_param_values = create_mbd_params(
    lambda = lambda,
    mu = mu,
    nu = 0.0,
    q = 0.0
  ),
  estimated_params = create_mbd_params_selector(lambda = TRUE, mu = TRUE),
  fixed_params = create_mbd_params_selector(nu = TRUE, q = TRUE),
  init_n_species = 2,
  n_missing_species = 0,
  conditioned_on = "non_extinction"
)
expect_true(ml_est$lambda >= 0)

Suggest package name: mbd

I suggest to rename the package to 'mbd' (from 'MBD') for multiple reasons: (1) it follows the Hadley Wickham standard (e.g. ggplot2, tidyr, etc), (2) @lintr-bot will love us for that,

@Giappo: agree?

If yes, I will do a replace all.

Improve a_operator

You can do it changing the method deSolve::ode uses to do that.
Methods that are worth a try are "ode45", "lsodes", ...

calculate_conditional_prob might yield prob > 1

calculate_conditional_prob yields prob > 1 for this setting:
prob <- calculate_conditional_prob(
brts = c(1, 0.5),
pars = c(0.359969011, 0.001163674, 2.051024209, 0.101152488) ,
cond = 1,
lx = 300,
n_0 = 2,
tips_interval = c(n_0 * (cond > 0), Inf),
methode = "lsodes",
abstol = 1e-16,
reltol = 1e-10
)
prob is 1.0022

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.