Bio-Phylo
view release on metacpan or search on metacpan
lib/Bio/Phylo/EvolutionaryModels.pm view on Meta::CPAN
$options{model_options}->{birth_rate},
$options{model_options}->{death_rate},
$options{tree_size}
);
my @sample;
#Loop for sampling each tree
while ( scalar @sample < $options{sample_size} ) {
my @nodes;
#Compute the random tree age from the inverse CDF (different formulas for
#birth rate == death rate and otherwise)
my $tree_age;
#The uniform random variable
my $r = rand;
if ( $br == $dr ) {
$tree_age = 1 / ( $br * ( $r**( -1 / $n ) - 1 ) );
}
else {
$tree_age =
( run in 0.635 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )