Learn R Programming

⚠️There's a newer version (0.4.3) of this package.Take me there.

ABM R Package: Agent Based Model Simulation Framework

The ABM package provides a high-performance, flexible framework for agent-based modeling. It has an easy-to-use state transition mechanism, that makes it especially suitable for modeling agent based models. For example, an SEIR model can be implemented in 18 lines.

In addition, this framework is a general event-based framework. Yet this framework allows the state of an agent to be quite general, described by a R list taking arbitrary R values. The states are modified by events, which can be easily defined. Thus, it is suitable for a wide range of applications, such as implementing the Gillespie algorithm.

Installation

From CRAN

This R package is included in CRAN.

install.packages("ABM")

From GitHub

For the latest development version, use the devtoools::install_github method:

install_github("https://github.com/junlingm/ABM.git")

Concepts and Usage

See more information on the Wiki

Examples

  1. Simulate an SIR model using the Gillespie method
  2. Simulate an agent based SEIR model
  3. Simulate a multi-group SEIR model
  4. Simulate a contact network SIR model
  5. Simulate contact tracing on an SIR model
  6. Simulate a household SEIR model
  7. An SIR model with births and deaths

Acknowledgement

This package is supported by a Natural Sciences and Engineering Research Council of Canada (NSERC) Discovery grant, and two NSERC Emerging Infectious Disease Modeling grants (ONMI with Dr. Huaiping Zhu as PI, and MfPH with Dr. V. Kumar Murty and Dr. Jianhong Wu as PI).

Copy Link

Version

Install

install.packages('ABM')

Monthly Downloads

441

Version

0.4.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Junling Ma

Last Published

March 14th, 2024

Functions in ABM (0.4.1)

matchState

Check if the state of an agent matches a given state
newConfigurationModel

Creates a random network using the configuration model
newCounter

Create a logger of the Counter class
newAgent

Create an agent with a given state
getState

Get the state of the agent
getTime

returns the event time
newRandomMixing

Creates a RandomMixing object
getWaitingTime

Generate a waiting time from an WaitingTime object
newEvent

Creates a new event in R
leave

leave the population that the agent is in
newExpWaitingTime

Creates an exponentially distributed waiting time
newPopulation

Create a new population
newGammaWaitingTime

Creates an gamma distributed waiting time
getID

Get the ID of the agent.
stateMatch

Check if two states match
unschedule

Unschedule (detach) an event from an agent
getSize

Get the size of a population
setStates

Set the state for each agent in a population
setState

Set the state of the agent
newStateLogger

Create a logger of the StateLogger class
setDeathTime

set the time of death for an agent
schedule

Schedule (attach) an event to an agent
clearEvents

Unschedule all event from an agent
Event

R6 class to create and represent an event
Contact

An R6 class that implements a contact pattern in R
Simulation

R6 class Create and represent a Simulation object
Population

R6 class that represents a population
getAgent

Get the agent at an index in the population
State

The state of an agent
addAgent

add an agent to a population
Agent

R6 class that represent an agent
ABM-package

Agent Based Model Simulation Framework