GithubHelp home page GithubHelp logo

sirstochastic's Introduction

sirstochastic

R build status

The goal of package sirstochastic is to run simulations of single and multiple iterations of the SIR stochastic model.

Installation

You can install the released version of sirstochastic from CRAN with:

install.packages("sirstochastic")
install.packages("ggplot2")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("reside-ic/sirstochastic")

Equations

The equations defining the model are:

  • dS/dt = - beta * S * I / N
  • dI/dt = beta * S * I / N - sigma * I
  • dR/dt = sigma * I

and these are converted to the discrete stochastic model by imagining that in a small period of time dt the chance of an event happening follows a Bernoulli trial. In a discrete time step of size dt we model the number of infections (i.e., the number of individuals who move from S to I) as a binomial draw with n = S and p = beta * I / N * dt) and the number of recoveries (movements from I to R) as a binomial draw with n = I and p = sigma * dt. Note, N = S + I + R.

Example

This is a basic example which shows you how to solve a common problem. The model is run once for 10,000 iterations with a time step of 0.01.

This time the model is run a 100 times for 10,000 iterations with a time step of 0.01 using the same code.

License

MIT © Imperial College of Science, Technology and Medicine

sirstochastic's People

Contributors

ceeb950 avatar richfitz avatar

Watchers

James Cloos avatar  avatar

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.