Copyright | (c) 2021 Alexander E. Zarebski |
---|---|
License | MIT |
Maintainer | Alexander E. Zarebski <aezarebski@gmail.com> |
Stability | unstable |
Portability | ghc |
Safe Haskell | None |
Language | Haskell2010 |
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
- eventPopDelta :: EpidemicEvent -> Integer
- firstScheduled :: AbsoluteTime -> Timed Probability -> Maybe (AbsoluteTime, Probability)
- noScheduledEvent :: AbsoluteTime -> AbsoluteTime -> Timed Probability -> Bool
- personsInEvent :: EpidemicEvent -> [Person]
- peopleInEvents :: [EpidemicEvent] -> People
- infected :: Person -> Person -> EpidemicEvent -> Bool
- infectedBy :: Person -> [EpidemicEvent] -> People
- allEvents :: (ModelParameters a b, Population b) => SimulationRandEvent a b -> a -> AbsoluteTime -> Maybe (TerminationHandler b c) -> SimulationState b c -> GenIO -> IO (SimulationState b c)
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.
:: AbsoluteTime | The given time |
-> Timed Probability | The information about all scheduled events |
-> Maybe (AbsoluteTime, Probability) |
The first scheduled event after a given time.
:: 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
.
peopleInEvents :: [EpidemicEvent] -> People Source #
:: Person | Potential infector |
-> Person | Potential infectee |
-> EpidemicEvent | Given event |
-> Bool |
Predicate for whether the first person infected the second in the given event
:: Person | Potential infector |
-> [EpidemicEvent] | Events |
-> People |
The people infected by a particular person in a list of events.
:: (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.