knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(DAISIE)
Here I create params:
n_mainland_species <- 500 island_age <- 4 n_replicates <- 50 clado_rate <- 2 # cladogenesis rate ext_rate <- 2 # extinction rate island_wide_cap <- 20 # clade-level carrying capacity imm_rate <- 0.01 # immigration rate ana_rate <- 1 # anagenesis rate ## set various level of rate difference between two states pars1 = c(clado_rate, ext_rate, island_wide_cap, imm_rate * 0.1, ana_rate) ## great difference pars2 = c(clado_rate, ext_rate, island_wide_cap, imm_rate * 0.8, ana_rate) ## slight difference pars3 = c(clado_rate, ext_rate, island_wide_cap, imm_rate, ana_rate) ## same rates Tpars1 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate * 1.9, ext_rate2 = ext_rate, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species ) Tpars2 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate * 1.2, ext_rate2 = ext_rate, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species) Tpars3 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species)
Here I test if using different immigration rates for two trait states will influence sinmulation results
set.seed(42) DAISIE<- DAISIE_sim( time = island_age, M = n_mainland_species * 2, pars = pars3, replicates = n_replicates, Tpars = NULL, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE1 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars1, replicates = n_replicates, Tpars = Tpars1, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE2 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars2, replicates = n_replicates, Tpars = Tpars2, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE3<- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars3, replicates = n_replicates, Tpars = Tpars3, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 )
DAISIE_plot_sims(island_replicates = DAISIE,Tpars = NULL, use_dev_new = FALSE)
DAISIE_plot_sims(island_replicates = TRASIE1,Tpars = Tpars1, use_dev_new = FALSE)
DAISIE_plot_sims(island_replicates = TRASIE2,Tpars = Tpars2, use_dev_new = FALSE)
DAISIE_plot_sims(island_replicates = TRASIE3,Tpars = Tpars3, use_dev_new = FALSE)
compare = compare_diff(DAISIE_output = DAISIE, TRASIE_output1 = TRASIE1, TRASIE_output2 = TRASIE2, TRASIE_output3 = TRASIE3, Tpars1 = Tpars1, Tpars2 = Tpars2, Tpars3 = Tpars3)
compare = compare_diff2(DAISIE_output = DAISIE, TRASIE_output1 = TRASIE1, TRASIE_output2 = TRASIE2, TRASIE_output3 = TRASIE3, Tpars1 = Tpars1, Tpars2 = Tpars2, Tpars3 = Tpars3)
n_mainland_species <- 500 island_age <- 4 n_replicates <- 50 clado_rate <- 2 # cladogenesis rate ext_rate <- 2 # extinction rate island_wide_cap <- 20 # clade-level carrying capacity imm_rate <- 1 # immigration rate ana_rate <- 1 # anagenesis rate ## set various level of rate difference between two states pars1 = c(clado_rate * 0.1, ext_rate, island_wide_cap, imm_rate, ana_rate) ## great difference pars2 = c(clado_rate * 0.4, ext_rate, island_wide_cap, imm_rate, ana_rate) ## slight difference pars3 = c(clado_rate * 0.5, ext_rate, island_wide_cap, imm_rate, ana_rate) ## same rates Tpars1 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate, ana_rate2 = ana_rate, clado_rate2 = clado_rate * 0.9, trans_rate2 = 0, M2 = n_mainland_species ) Tpars2 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate, ana_rate2 = ana_rate, clado_rate2 = clado_rate * 0.6, trans_rate2 = 0, M2 = n_mainland_species) Tpars3 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate, ana_rate2 = ana_rate, clado_rate2 = clado_rate * 0.5, trans_rate2 = 0, M2 = n_mainland_species)
set.seed(42) DAISIE<- DAISIE_sim( time = island_age, M = n_mainland_species * 2, pars = pars3, replicates = n_replicates, Tpars = NULL, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE1 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars1, replicates = n_replicates, Tpars = Tpars1, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE2 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars2, replicates = n_replicates, Tpars = Tpars2, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE3<- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars3, replicates = n_replicates, Tpars = Tpars3, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 )
DAISIE_plot_sims(island_replicates = TRASIE3,Tpars = Tpars3, use_dev_new = FALSE)
compare = compare_diff(DAISIE_output = DAISIE, TRASIE_output1 = TRASIE1, TRASIE_output2 = TRASIE2, TRASIE_output3 = TRASIE3, Tpars1 = Tpars1, Tpars2 = Tpars2, Tpars3 = Tpars3)
compare = compare_diff2(DAISIE_output = DAISIE, TRASIE_output1 = TRASIE1, TRASIE_output2 = TRASIE2, TRASIE_output3 = TRASIE3, Tpars1 = Tpars1, Tpars2 = Tpars2, Tpars3 = Tpars3)
Here test the influence of unbalance extinction rate
n_mainland_species <- 500 island_age <- 4 n_replicates <- 50 clado_rate <- 2 # cladogenesis rate ext_rate <- 2 # extinction rate island_wide_cap <- 20 # clade-level carrying capacity imm_rate <- 0.1 # immigration rate ana_rate <- 1 # anagenesis rate ## set various level of rate difference between two states pars1 = c(clado_rate, ext_rate * 0.1, island_wide_cap, imm_rate, ana_rate) ## great difference pars2 = c(clado_rate, ext_rate * 0.4, island_wide_cap, imm_rate, ana_rate) ## slight difference pars3 = c(clado_rate, ext_rate * 0.5, island_wide_cap, imm_rate, ana_rate) ## same rates Tpars1 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate * 0.9, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species ) Tpars2 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate * 0.6, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species) Tpars3 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate * 0.5, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species)
set.seed(42) DAISIE<- DAISIE_sim( time = island_age, M = n_mainland_species * 2, pars = pars3, replicates = n_replicates, Tpars = NULL, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE1 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars1, replicates = n_replicates, Tpars = Tpars1, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE2 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars2, replicates = n_replicates, Tpars = Tpars2, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE3<- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars3, replicates = n_replicates, Tpars = Tpars3, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 )
DAISIE_plot_sims(island_replicates = TRASIE3,Tpars = Tpars3, use_dev_new = FALSE)
compare = compare_diff(DAISIE_output = DAISIE, TRASIE_output1 = TRASIE1, TRASIE_output2 = TRASIE2, TRASIE_output3 = TRASIE3, Tpars1 = Tpars1, Tpars2 = Tpars2, Tpars3 = Tpars3)
compare = compare_diff2(DAISIE_output = DAISIE, TRASIE_output1 = TRASIE1, TRASIE_output2 = TRASIE2, TRASIE_output3 = TRASIE3, Tpars1 = Tpars1, Tpars2 = Tpars2, Tpars3 = Tpars3)
n_mainland_species <- 500 island_age <- 4 n_replicates <- 50 clado_rate <- 2 # cladogenesis rate ext_rate <- 2 # extinction rate island_wide_cap <- 20 # clade-level carrying capacity imm_rate <- 0.1 # immigration rate ana_rate <- 1 # anagenesis rate ## set various level of rate difference between two states pars1 = c(clado_rate, ext_rate * 0.1, island_wide_cap, imm_rate, ana_rate) ## great difference pars2 = c(clado_rate, ext_rate * 0.8, island_wide_cap, imm_rate, ana_rate) ## slight difference pars3 = c(clado_rate, ext_rate, island_wide_cap, imm_rate, ana_rate) ## same rates Tpars1 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate * 1.9, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species ) Tpars2 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate * 1.2, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species) Tpars3 <- create_trait_state_params( trans_rate = 0, immig_rate2 = imm_rate, ext_rate2 = ext_rate, ana_rate2 = ana_rate, clado_rate2 = clado_rate, trans_rate2 = 0, M2 = n_mainland_species)
set.seed(42) DAISIE<- DAISIE_sim( time = island_age, M = n_mainland_species * 2, pars = pars3, replicates = n_replicates, Tpars = NULL, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE1 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars1, replicates = n_replicates, Tpars = Tpars1, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE2 <- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars2, replicates = n_replicates, Tpars = Tpars2, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 ) set.seed(42) TRASIE3<- DAISIE_sim( time = island_age, M = n_mainland_species, pars = pars3, replicates = n_replicates, Tpars = Tpars3, plot_sims = FALSE, verbose = FALSE, Apars = NULL, divdepmodel = "IW", sample_freq = 50 )
DAISIE_plot_sims(island_replicates = TRASIE3,Tpars = Tpars3, use_dev_new = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.