Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extinction event increase for species with negative values after some time #22

Open
TGuillerme opened this issue Nov 20, 2023 · 0 comments
Labels
simulation template Share your simulation template

Comments

@TGuillerme
Copy link
Owner

TGuillerme commented Nov 20, 2023

Extinction event increase for species with negative values after some time

Simulating a 1D BM trait (default) for a some time with a default birth-death process. Then changing this process where the extinction is more likely for species with negative values.

What does it do?

What function does it uses? yes/no comments
Uses make.bd.params
Uses make.traits default
Uses make.modifications
Uses make.events

bd.params

A speciation rate of 1 and an extinction rate of 0.1 (10%)

my_bd_params <- make.bd.params(speciation = 1, extinction = 0.1)

modifier

The default modifier (normal birth-death rules)

## birth-death rules (default)
default_modifiers <- make.modifiers()

events

An event that modifies the normal modifier and increases the extinction rate by 1 if the trait value if negative (after time 3).

## New condition and new modifier (increasing speciation if trait is negative)
negative.trait.condition <- function(trait.values, lineage) {
    return(parent.traits(trait.values, lineage) < 0)
}
increase.extinction.1 <- function(x, trait.values, lineage) {
  return(x + 1)
}

## Update the modifier
change.speciation <- make.events(
    condition    = age.condition(3),
    target       = "modifiers",
    modification = modifiers.update(speciation = speciation,
                                    condition  = negative.trait.condition,
                                    modify     = increase.extinction.1))

A running example

## My favorite seed
set.seed(42)

## Some stopping rules
my_stop.rule <- list(max.time = 5)

## The simulation
my_simulation <- treats(stop.rule = my_stop.rule,
                        bd.params = my_bd_params,
                        traits    = make.traits(),
                        modifiers = default_modifiers,
                        events    = change.speciation)

plot(my_simulation)

Reference

If you use this template in a publication, please cite:

  • treats
  • R
@TGuillerme TGuillerme added the simulation template Share your simulation template label Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
simulation template Share your simulation template
Projects
None yet
Development

No branches or pull requests

1 participant