Giter VIP home page Giter VIP logo

epiverse-trace / bpmodels Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 7.0 1.21 MB

Methods for simulating and analysing the sizes and lengths of chains from branching process models

Home Page: https://epiverse-trace.github.io/bpmodels/

License: Other

R 100.00%
branching-process epidemic-dynamics epidemic-modelling epidemic-simulations outbreak-simulator r r-package transmission-chain transmission-chain-reconstruction epidemiology

bpmodels's People

Contributors

actions-user avatar bisaloo avatar ffinger avatar jamesmbaazam avatar sbfnk avatar timtaylor avatar zkamvar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bpmodels's Issues

Update `chain_sim` help file

The following comment in the examples of chain_sim() says that specifying serial and setting tree=FALSE will throw an error but this has subsequently been relaxed to a warning (see #53), so the comment in the example here should be updated to reflect the change.

This will require a simple rewording of the comment and a rerun of devtools::check(), which will in turn run devtools::document() to regenerate the .Rd files.

Codecov badge pointing to master

This issue is to point out that the Codecov badge in the Readme points to the now renamed master branch. This could be fixed by pointing it to main. Should have caught this in #24 but slipped past me.

Explain why we set seed

It might be worth mentioning somewhere in the get started vignette that the simulation is stochastic and therefore setting the seed is required for consistent output. This could be in the text or a small comment above the set.seed()

Originally posted by @joshwlambert in #79 (comment)

Add use case vignettes

Adding use case vignettes would help the user identify ways to apply this package. Some use cases include:

  1. Forecasting an epidemic given data (ideally a linelist) on the first few cases. (*Will update with more later)
  2. Estimating R0 from epidemic data

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

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.

Change package title in DESCRIPTION to title case

  The Title field should be in title case. Current version is:Analysing transmission chain statistics using branching process modelsIn title case that is:Analysing Transmission Chain Statistics using Branching Process Models

Update website style

The website seems to be outdated and should be updated to use the latest version of bootstrap and Epiverse theme.

Likelihoods as callable functions?

At present, it looks like the individual likelihood functions aren't in NAMESPACE so can't be called? Although maybe these are passed through chain_ll()?

Move quickstart in README to website

The current quickstart section in the README is probably best placed on the package website.

The quick start in the README should be simple and point out the current functionality without providing too many details on the inner workings of the functions.

Fix HTML validation problems

checking HTML version of manual ... NOTE
  Found the following HTML validation problems:
  bpmodels-package.html:4:1 (bpmodels-package.Rd:7): Warning: <link> inserting "type" attribute
  bpmodels-package.html:12:1 (bpmodels-package.Rd:7): Warning: <script> proprietary attribute "onload"
  bpmodels-package.html:12:1 (bpmodels-package.Rd:7): Warning: <script> inserting "type" attribute
  bpmodels-package.html:17:1 (bpmodels-package.Rd:7): Warning: <table> lacks "summary" attribute
  chain_ll.html:4:1 (chain_ll.Rd:5): Warning: <link> inserting "type" attribute
  chain_ll.html:12:1 (chain_ll.Rd:5): Warning: <script> proprietary attribute "onload"
  chain_ll.html:12:1 (chain_ll.Rd:5): Warning: <script> inserting "type" attribute
  chain_ll.html:17:1 (chain_ll.Rd:5): Warning: <table> lacks "summary" attribute
  chain_ll.html:45:1 (chain_ll.Rd:20): Warning: <table> lacks "summary" attribute
  chain_sim.html:4:1 (chain_sim.Rd:5): Warning: <link> inserting "type" attribute
  chain_sim.html:12:1 (chain_sim.Rd:5): Warning: <script> proprietary attribute "onload"
  chain_sim.html:12:1 (chain_sim.Rd:5): Warning: <script> inserting "type" attribute
  chain_sim.html:17:1 (chain_sim.Rd:5): Warning: <table> lacks "summary" attribute
  chain_sim.html:47:1 (chain_sim.Rd:20): Warning: <table> lacks "summary" attribute
  chain_sim_susc.html:4:1 (chain_sim_susc.Rd:5): Warning: <link> inserting "type" attribute
  chain_sim_susc.html:12:1 (chain_sim_susc.Rd:5): Warning: <script> proprietary attribute "onload"
  chain_sim_susc.html:12:1 (chain_sim_susc.Rd:5): Warning: <script> inserting "type" attribute
  chain_sim_susc.html:17:1 (chain_sim_susc.Rd:5): Warning: <table> lacks "summary" attribute
  chain_sim_susc.html:46:1 (chain_sim_susc.Rd:20): Warning: <table> lacks "summary" attribute
  complementary_logprob.html:4:1 (complementary_logprob.Rd:5): Warning: <link> inserting "type" attribute
  complementary_logprob.html:12:1 (complementary_logprob.Rd:5): Warning: <script> proprietary attribute "onload"
  complementary_logprob.html:12:1 (complementary_logprob.Rd:5): Warning: <script> inserting "type" attribute
  complementary_logprob.html:17:1 (complementary_logprob.Rd:5): Warning: <table> lacks "summary" attribute
  complementary_logprob.html:35:1 (complementary_logprob.Rd:10): Warning: <table> lacks "summary" attribute
  covid19_sa.html:4:1 (covid19_sa.Rd:6): Warning: <link> inserting "type" attribute
  covid19_sa.html:12:1 (covid19_sa.Rd:6): Warning: <script> proprietary attribute "onload"
  covid19_sa.html:12:1 (covid19_sa.Rd:6): Warning: <script> inserting "type" attribute
  covid19_sa.html:17:1 (covid19_sa.Rd:6): Warning: <table> lacks "summary" attribute
  dborel.html:4:1 (dborel.Rd:5): Warning: <link> inserting "type" attribute
  dborel.html:12:1 (dborel.Rd:5): Warning: <script> proprietary attribute "onload"
  dborel.html:12:1 (dborel.Rd:5): Warning: <script> inserting "type" attribute
  dborel.html:17:1 (dborel.Rd:5): Warning: <table> lacks "summary" attribute
  dborel.html:35:1 (dborel.Rd:10): Warning: <table> lacks "summary" attribute
  find_function_name.html:4:1 (find_function_name.Rd:5): Warning: <link> inserting "type" attribute
  find_function_name.html:12:1 (find_function_name.Rd:5): Warning: <script> proprietary attribute "onload"
  find_function_name.html:12:1 (find_function_name.Rd:5): Warning: <script> inserting "type" attribute
  find_function_name.html:17:1 (find_function_name.Rd:5): Warning: <table> lacks "summary" attribute
  find_function_name.html:37:1 (find_function_name.Rd:10): Warning: <table> lacks "summary" attribute
  gborel_size_ll.html:4:1 (gborel_size_ll.Rd:5): Warning: <link> inserting "type" attribute
  gborel_size_ll.html:12:1 (gborel_size_ll.Rd:5): Warning: <script> proprietary attribute "onload"
  gborel_size_ll.html:12:1 (gborel_size_ll.Rd:5): Warning: <script> inserting "type" attribute
  gborel_size_ll.html:17:1 (gborel_size_ll.Rd:5): Warning: <table> lacks "summary" attribute
  gborel_size_ll.html:35:1 (gborel_size_ll.Rd:10): Warning: <table> lacks "summary" attribute
  geom_length_ll.html:4:1 (geom_length_ll.Rd:5): Warning: <link> inserting "type" attribute
  geom_length_ll.html:12:1 (geom_length_ll.Rd:5): Warning: <script> proprietary attribute "onload"
  geom_length_ll.html:12:1 (geom_length_ll.Rd:5): Warning: <script> inserting "type" attribute
  geom_length_ll.html:17:1 (geom_length_ll.Rd:5): Warning: <table> lacks "summary" attribute
  geom_length_ll.html:35:1 (geom_length_ll.Rd:10): Warning: <table> lacks "summary" attribute
  nbinom_size_ll.html:4:1 (nbinom_size_ll.Rd:5): Warning: <link> inserting "type" attribute
  nbinom_size_ll.html:12:1 (nbinom_size_ll.Rd:5): Warning: <script> proprietary attribute "onload"
  nbinom_size_ll.html:12:1 (nbinom_size_ll.Rd:5): Warning: <script> inserting "type" attribute
  nbinom_size_ll.html:17:1 (nbinom_size_ll.Rd:5): Warning: <table> lacks "summary" attribute
  nbinom_size_ll.html:37:1 (nbinom_size_ll.Rd:11): Warning: <table> lacks "summary" attribute
  offspring_ll.html:4:1 (offspring_ll.Rd:5): Warning: <link> inserting "type" attribute
  offspring_ll.html:12:1 (offspring_ll.Rd:5): Warning: <script> proprietary attribute "onload"
  offspring_ll.html:12:1 (offspring_ll.Rd:5): Warning: <script> inserting "type" attribute
  offspring_ll.html:17:1 (offspring_ll.Rd:5): Warning: <table> lacks "summary" attribute
  offspring_ll.html:37:1 (offspring_ll.Rd:10): Warning: <table> lacks "summary" attribute
  pois_length_ll.html:4:1 (pois_length_ll.Rd:5): Warning: <link> inserting "type" attribute
  pois_length_ll.html:12:1 (pois_length_ll.Rd:5): Warning: <script> proprietary attribute "onload"
  pois_length_ll.html:12:1 (pois_length_ll.Rd:5): Warning: <script> inserting "type" attribute
  pois_length_ll.html:17:1 (pois_length_ll.Rd:5): Warning: <table> lacks "summary" attribute
  pois_length_ll.html:35:1 (pois_length_ll.Rd:10): Warning: <table> lacks "summary" attribute
  pois_size_ll.html:4:1 (pois_size_ll.Rd:5): Warning: <link> inserting "type" attribute
  pois_size_ll.html:12:1 (pois_size_ll.Rd:5): Warning: <script> proprietary attribute "onload"
  pois_size_ll.html:12:1 (pois_size_ll.Rd:5): Warning: <script> inserting "type" attribute
  pois_size_ll.html:17:1 (pois_size_ll.Rd:5): Warning: <table> lacks "summary" attribute
  pois_size_ll.html:35:1 (pois_size_ll.Rd:10): Warning: <table> lacks "summary" attribute
  rbinom_size.html:4:1 (rbinom_size.Rd:5): Warning: <link> inserting "type" attribute
  rbinom_size.html:12:1 (rbinom_size.Rd:5): Warning: <script> proprietary attribute "onload"
  rbinom_size.html:12:1 (rbinom_size.Rd:5): Warning: <script> inserting "type" attribute
  rbinom_size.html:17:1 (rbinom_size.Rd:5): Warning: <table> lacks "summary" attribute
  rbinom_size.html:36:1 (rbinom_size.Rd:10): Warning: <table> lacks "summary" attribute
  rborel.html:4:1 (rborel.Rd:5): Warning: <link> inserting "type" attribute
  rborel.html:12:1 (rborel.Rd:5): Warning: <script> proprietary attribute "onload"
  rborel.html:12:1 (rborel.Rd:5): Warning: <script> inserting "type" attribute
  rborel.html:17:1 (rborel.Rd:5): Warning: <table> lacks "summary" attribute
  rborel.html:35:1 (rborel.Rd:10): Warning: <table> lacks "summary" attribute
  rgen_length.html:4:1 (rgen_length.Rd:5): Warning: <link> inserting "type" attribute
  rgen_length.html:12:1 (rgen_length.Rd:5): Warning: <script> proprietary attribute "onload"
  rgen_length.html:12:1 (rgen_length.Rd:5): Warning: <script> inserting "type" attribute
  rgen_length.html:17:1 (rgen_length.Rd:5): Warning: <table> lacks "summary" attribute
  rgen_length.html:37:1 (rgen_length.Rd:10): Warning: <table> lacks "summary" attribute
  rnbinom_mean_disp.html:4:1 (rnbinom_mean_disp.Rd:5): Warning: <link> inserting "type" attribute
  rnbinom_mean_disp.html:12:1 (rnbinom_mean_disp.Rd:5): Warning: <script> proprietary attribute "onload"
  rnbinom_mean_disp.html:12:1 (rnbinom_mean_disp.Rd:5): Warning: <script> inserting "type" attribute
  rnbinom_mean_disp.html:17:1 (rnbinom_mean_disp.Rd:5): Warning: <table> lacks "summary" attribute
  rnbinom_mean_disp.html:37:1 (rnbinom_mean_disp.Rd:11): Warning: <table> lacks "summary" attribute

Allow user to specify tree=FALSE when serial is specified.

Currently, the user gets an error when they specify serial with tree = FALSE. I think this might be harsh on them. Maybe, we can make it more flexible by allowing that specification to happen, except that we'll set tree = TRUE internally and tell the user what happened.

Reset linguist to default behaviour

In a previous PR (#47), Github linguist was set to count .Rmd and .md files as R scripts and ignore the vignettes folder.

This was because linguist was counting .Rmd, .md, and .tex files separately and messing up the language statistics.

Currently, the workaround is to do #60. After closing the said issue, there will be no need to keep the reconfiguration and should be reset to the default.

Make clear whether `chain_ll()` function calculates a likelihood or loglikelihood

The current documentation of the chain_ll() function says it calculates the likelihood. But from what I can tell it is actually the loglikelihood. Indications of this also come from the function name (I assume _ll() stands for loglikelihood) and return value in the documentation of nbinom_size_ll() is "log-likelihood values".

I would recommend making it clear in the documentation of chain_ll() whether it is the likelihood or loglikelihood being returned.

Related to this could be a log argument in the function which accepts boolean values to turn the log transformation on or off.

Organize vignettes into topics

I propose to restructure the website vignettes into the following topics:
- [ ] Applications of branching processes (bibliography of modelling literature that uses branching processes)
- [ ] Modelling (including forecasting, etc.)

behavior near `infinite = ...`?

Using infinite = ... with a fixed value, I am routinely observing logistic style cumulative cases. While it's plausible to get that kind of result stochastically, this is a feature of every chain that doesn't go extinct. The expected behavior is the curve to generally be on an exponential growth trajectory, and then be censored to the value associated with infinite = ... (or all cases that occur <= the day when that value is surpassed.

I can manually censor to that value in the results, but fact the changing the infinite = ... value does not appear to change the fraction chains going to the limit, only where the curve begins to bend, suggests that something internally is not working the way I expect it to.

Terminology: serial interval vs generation time

At the moment the package references the serial interval in describing the time between cases. Technically this should be the generation time, as time between infections. In practice, this distinction probably doesn't matter here as we don't have model of latent infections that lead to symptoms, i.e. implicitly assume that symptom onset is the same as infection/infectiousness onset.

We should either switch the terminology to use generation times, or mention the assumption somewhere explicitly (my preference being for the second option).

projection or forecast?

Great vignette for projecting incidence!

The vignette is consistent with the usage of the word "projection" in most of the document, except at the end of the second paragraph where it says "forecast an outbreak". In the referenced paper, after a quick skim, my initial impression is that the authors use both of them interchangeably, e.g. for the projection/forecast time intervals.

Could we use them interchangeably?

My last reference about this is the one below:

What do I mean by projections/forecasts/predictions?

  • Projections: short term not mechanistic – taking current trend and continuing
  • Forecasts: relies on somehow more mechanistic model but typically assumes conditions in future remain stable
  • Predictions: relies on understanding the system and making hypothesis about future conditions – closer scenario modelling

reference: https://www.reconlearn.org/post/projections.html

I would like to know if I can be flexible with the terminology given its usage in the field, or if they do refer to different things and then need to homogenize the terminology.

Release bpmodels 0.3.0

First release:

Prepare for release:

  • git pull
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Fix urlchecker warning

> urlchecker::url_check()
! Warning: README.md:9:13 Moved
[![codecov](https://codecov.io/github/epiverse-trace/bpmodels/branch/main/graphs/badge.svg)](https://codecov.io/github/epiverse-trace/bpmodels)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            https://app.codecov.io/github/epiverse-trace/bpmodels
! Warning: README.md:13:60 Moved
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                           https://opensource.org/license/mit/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.