|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sir.sim.SimCTMC
Class to sample infection and removal times from a stochastic SIR epidemic or other similar type continous time Markov Chains. It is an abstract class handling the simulation and a hook function is used to specify the intensities. Code is based on C++ code from Epi Study Group 7 April 2001. New in version
Field Summary | |
protected int |
curRegime
Current regime number, i.e. 0<= curRegime <= noOfRegimes-1 |
protected java.text.NumberFormat |
form
For formatting of doubles to an output stream. |
protected long[] |
m
Number of initially infected in each unit |
protected long[] |
n
Number of initially susceptibles in each unit |
protected int |
noOfRegimes
Number of different regimes in SIR process, aka. k in paper |
protected int |
noOfTrans
Number of different transitions in the chain, in SIR e.g. 3 |
protected int |
noOfUnits
Number of units/populations, aka. l in paper |
protected Distributions |
prob
Random number generation of various distributions (e.g. exp) |
Constructor Summary | |
SimCTMC(Distributions prob,
int M,
int noOfRegimes,
int noOfUnits,
Regime[] regimes,
long[] n,
long[] m)
Constructor - setup the model parameters and initializes the necessary arrays. |
Method Summary | |
void |
RunPrintHook(double t,
long[] x,
long[] y,
int event)
Hook function controlling what to print when showing run trajectories. |
void |
sim(long[] startn,
long maxStep,
long noOfRuns,
boolean showRun,
boolean showFinal)
Simulate from a Markovian SIR epidemic or related. |
abstract void |
transitionIntensitiesHook(double t,
long[] x,
long[] y)
Hook function to set up the transition Intensities |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected long[] n
protected long[] m
protected int noOfTrans
protected int noOfRegimes
protected int noOfUnits
protected int curRegime
protected Distributions prob
protected java.text.NumberFormat form
Constructor Detail |
public SimCTMC(Distributions prob, int M, int noOfRegimes, int noOfUnits, Regime[] regimes, long[] n, long[] m)
M
- Number of different jumps in the CTMCn
- initial number of susceptible individuals for each unitm
- initial number of infectious individuals for each unitMethod Detail |
public void sim(long[] startn, long maxStep, long noOfRuns, boolean showRun, boolean showFinal)
startn
- initial value of start population (typically equal to n)maxStep
- maximum number of steps to simulate per chain.noOfRuns
- number of chains to simulateshowRun
- should we print out the states obtained of each chain?showFinal
- print out the final size of a run to the screen?public abstract void transitionIntensitiesHook(double t, long[] x, long[] y)
t
- time passed so far.x
- number of susceptibles.y
- number of infected.public void RunPrintHook(double t, long[] x, long[] y, int event)
t
- time of eventx
- number of susceptibles.y
- number of infected.event
- event type
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |