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

Note to self: sim_island always returns an uninteresting result? #24

Closed
richelbilderbeek opened this issue Nov 25, 2021 · 1 comment
Closed

Comments

@richelbilderbeek
Copy link
Collaborator

Will continue on this tomorrow...

test_that("use", {
  set.seed(
    1,
    kind = "Mersenne-Twister",
    normal.kind = "Inversion",
    sample.kind = "Rejection"
  )
  mainland <- DAISIEmainland:::sim_mainland(
    total_time = 1,
    m = 10,
    mainland_ex = 2)
  plot_mainland(mainland = mainland)

  count_extant_mainland_species <- function(mainland) {
    purrr::map_dbl(mainland, function(x) { return(sum(x$spec_ex_t == 1.0)) } )
  }
  clade_with_most_species <- which(
    count_extant_mainland_species(mainland) ==
      max(count_extant_mainland_species(mainland))
  )

  mainland_clade <- mainland[[clade_with_most_species]]
  cladogenesis_rate <- 100.0
  extinction_rate <- 100.0
  carrying_capacity <- 100.0
  immigration_rate <- 100.0
  anagenesis_rate <- 100.0

  island_pars <- c(
    cladogenesis_rate,
    extinction_rate,
    carrying_capacity,
    immigration_rate,
    anagenesis_rate
  )
  mainland_sample_type <- "unsampled"
  mainland_sample_type <- "undiscovered"
  mainland_sample_type <- "complete"
  testit::assert(mainland_sample_type == "unsampled" ||
                   mainland_sample_type == "undiscovered" ||
                   mainland_sample_type == "complete")

  island <- sim_island(
    total_time = 100,
    island_pars = island_pars,
    mainland_clade = mainland_clade,
    mainland_sample_prob = 1,
    mainland_sample_type = mainland_sample_type)
  island
  plot_island(island)
})
@richelbilderbeek
Copy link
Collaborator Author

Nope, see test-plot_ideal_island.R for plenty of interesting results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant