epi-sim-0.7.0: A library for simulating epidemics as birth-death processes.
Copyright(c) 2021 Alexander E. Zarebski
LicenseMIT
MaintainerAlexander E. Zarebski <aezarebski@gmail.com>
Stabilityunstable
Portabilityghc
Safe HaskellNone
LanguageHaskell2010

Epidemic

Description

This package provides functionality for simulating stochastic epidemic models, in particular those that are of interest in phylodynamics. There are several models provided by the package, eg Epidemic.Model.BDSCOD, however there should be the basic functionality to implement a wide range of models available. Each of the models included in the package provide a configuration function which can be used to get a SimulationConfiguration and a randomEvent function which returns a SimulationRandEvent. With these you can then use allEvents to get all of the events in a simulation.

This package also provides some functionality for working with observation models, both epidemiological and phylogenetic. Observation values are used to describe the possible observation of an EpidemicEvent.

There is an example of how to use this package in the documentation for Epidemic.Model.InhomogeneousBDSCOD.

Synopsis

Documentation

eventPopDelta :: EpidemicEvent -> Integer Source #

The number of people added or removed in an event. In the case of an extinction event the number of people removed is arbitrarily set to zero because this information is available from the prior event in the sequence.

firstScheduled Source #

Arguments

:: AbsoluteTime

The given time

-> Timed Probability

The information about all scheduled events

-> Maybe (AbsoluteTime, Probability) 

The first scheduled event after a given time.

noScheduledEvent Source #

Arguments

:: AbsoluteTime

Start time for interval

-> AbsoluteTime

End time for interval

-> Timed Probability

Information about all scheduled events

-> Bool 

Predicate for whether there is a scheduled event during an interval. NOTE that this does not consider events that happen at the start of the interval as occurring between the times.

>>> tA = AbsoluteTime 1.0
>>> tB = AbsoluteTime 2.0
>>> noScheduledEvent tA tB <$> asTimed [(AbsoluteTime 1.5, 0.5)]
Just False
>>> noScheduledEvent tA tB <$> asTimed [(AbsoluteTime 2.5, 0.5)]
Just True
>>> noScheduledEvent tA tB <$> asTimed [(tA, 0.5)]
Just True

personsInEvent :: EpidemicEvent -> [Person] Source #

A list of the people involved in an EpidemicEvent.

infected Source #

Arguments

:: Person

Potential infector

-> Person

Potential infectee

-> EpidemicEvent

Given event

-> Bool 

Predicate for whether the first person infected the second in the given event

infectedBy Source #

Arguments

:: Person

Potential infector

-> [EpidemicEvent]

Events

-> People 

The people infected by a particular person in a list of events.

allEvents Source #

Arguments

:: (ModelParameters a b, Population b) 
=> SimulationRandEvent a b 
-> a 
-> AbsoluteTime

time at which to stop the simulation

-> Maybe (TerminationHandler b c) 
-> SimulationState b c

the initial/current state of the simulation

-> GenIO 
-> IO (SimulationState b c) 

Run the simulation until the specified stopping time and return a SimulationState which holds the history of the simulation.