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

Bug: DAISIE_sim_cr_iw wrongly computes number of species at present #147

Closed
Yangshen0325 opened this issue Sep 12, 2022 · 0 comments
Closed

Comments

@Yangshen0325
Copy link
Contributor

In DAISIE_sim_cr_iw(), the number of species at present is incorrectly calculated when cond > 0 and replicates > 1.
The number of species at present is obtained by counting the number of lineages on the island with a stac other than 0.
This calculation is wrong when there are multiple replicates. With each new replicate the number of species at present corresponds to the sum of the species at present for replicate 1 with those simulated during replicate 2.
The bug lies in lines 33 to 35 of DAISIE_sim_cr_iw.R

stac_vec <- unlist(island_replicates)[which(names(unlist(island_replicates)) == "taxon_list.stac")]
present <- which(stac_vec != 0)
number_present <- length(present)

This should read:

temp_island_replicates <- island_replicates[[rep]]
stac_vec <- unlist(temp_island_replicates)[which(names(unlist(temp_island_replicates)) == "taxon_list.stac")]
present <- which(stac_vec != 0)
number_present <- length(present)
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