sir.sim
Class SimCTMC

java.lang.Object
  |
  +--sir.sim.SimCTMC
Direct Known Subclasses:
SimSIR2

public abstract class SimCTMC
extends java.lang.Object

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

Version:
7 September 2001, Modified 17 Januar 2002
Author:
Michael Höhle
See Also:
Study group Homepage

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

n

protected long[] n
Number of initially susceptibles in each unit


m

protected long[] m
Number of initially infected in each unit


noOfTrans

protected int noOfTrans
Number of different transitions in the chain, in SIR e.g. 3


noOfRegimes

protected int noOfRegimes
Number of different regimes in SIR process, aka. k in paper


noOfUnits

protected int noOfUnits
Number of units/populations, aka. l in paper


curRegime

protected int curRegime
Current regime number, i.e. 0<= curRegime <= noOfRegimes-1


prob

protected Distributions prob
Random number generation of various distributions (e.g. exp)


form

protected java.text.NumberFormat form
For formatting of doubles to an output stream.

Constructor Detail

SimCTMC

public 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.

Parameters:
M - Number of different jumps in the CTMC
n - initial number of susceptible individuals for each unit
m - initial number of infectious individuals for each unit
Method Detail

sim

public void sim(long[] startn,
                long maxStep,
                long noOfRuns,
                boolean showRun,
                boolean showFinal)
Simulate from a Markovian SIR epidemic or related. Taken from Lieberman. Note: This part is independent of different units, which just adds to the number of transitions.

Parameters:
startn - initial value of start population (typically equal to n)
maxStep - maximum number of steps to simulate per chain.
noOfRuns - number of chains to simulate
showRun - should we print out the states obtained of each chain?
showFinal - print out the final size of a run to the screen?

transitionIntensitiesHook

public abstract void transitionIntensitiesHook(double t,
                                               long[] x,
                                               long[] y)
Hook function to set up the transition Intensities

Parameters:
t - time passed so far.
x - number of susceptibles.
y - number of infected.

RunPrintHook

public void RunPrintHook(double t,
                         long[] x,
                         long[] y,
                         int event)
Hook function controlling what to print when showing run trajectories.

Parameters:
t - time of event
x - number of susceptibles.
y - number of infected.
event - event type