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

clarify documentation for @return in chain_sim / change behavior for tree + serial combinations #4

Closed
pearsonca opened this issue Mar 10, 2020 · 3 comments · Fixed by #14

Comments

@pearsonca
Copy link

pearsonca commented Mar 10, 2020

The documentation for return value in chain_sim suggests that all combinations of serial and tree are allowed, but function complains if tree=FALSE with a serial function defined.

This suggests either a documentation or behavior bug.

Relative to behavior option, I have a case where I don't need id, generation, ancestor information, but do need time and am memory constrained, so disregarding those would be useful.

@sbfnk
Copy link
Collaborator

sbfnk commented Mar 11, 2020

Thanks for the note.

The documentation of serial states (though perhaps not clearly enough) that setting it implies tree=TRUE:
https://github.com/sbfnk/bpmodels/blob/466896dd57c5dd51ef9cbe7c0cff4cdd41bbfda4/man/chain_sim.Rd#L26

As for the point about memory, some sort of ancestor tracking is required with serial=TRUE, I think, to calculate the infection times of new offspring as they depend on the infection times of the ancestor. There might be a way to save memory (which would be a great thing) by only storing the last generation, but this would require a bit of a rewrite of how this is handled in chain_sim - happy to consider a pull request if you have the capacity to have a go at this.

On a related note, the rbinding of data frames in the same function is probably horrendously inefficient and worth looking at sometime in the future.

@pearsonca
Copy link
Author

pearsonca commented Mar 11, 2020 via email

@sbfnk
Copy link
Collaborator

sbfnk commented Mar 11, 2020

There's nothing as such that prevents this from going on CRAN as is - but all improvements would of course be most welcome!

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

Successfully merging a pull request may close this issue.

2 participants