sir.model
Class SEIRStateExp

java.lang.Object
  |
  +--sir.model.EpiState
        |
        +--sir.model.SEIRStateExp
All Implemented Interfaces:
org.omegahat.Simulation.MCMC.MCMCState, Uncmin_methods

public class SEIRStateExp
extends EpiState
implements org.omegahat.Simulation.MCMC.MCMCState, Uncmin_methods

This class is used to represent the state a SEIR model as mentioned in the O'Neill and Becker article. I.e. we have - fixed latency time (c), - beta* X * Y for infection and - gamm, distributed infection time, i.e. f I\sim \Gamma(\gamma,\delta) Note: Nothing about regimes included anymore. Copyright: Copyright (c) 2002

Version:
16 October 2002
Author:
Michael Höhle <hoehle@dina.kvl.dk>

Field Summary
 double beta
          Infection pressure aka. transmission parameter
 double c
          Length of the latency period - this value does not really change
 double delta
          Parameters of the gamma distribution
static int deltaaccept
          Delta acceptance rate
 Event[] E
          All the exposed states
 double gamma
          Parameters of the gamma distribution
 
Fields inherited from class sir.model.EpiState
betaNaccept, betaaccept, data, deviance, gammaaccept, I, Iaccept, loglik, nogen, prob, runs
 
Constructor Summary
SEIRStateExp()
          Constructor - necessary to allocate an array for I
 
Method Summary
 double f_to_minimize(double[] theta)
          In case the object is given to a numerical minimizer, this is the function to minimize.
 EpiState generateNext()
          Generate method for MCMC chain Modifcation happen on the instance itself to keep things simple.
protected  void genXYFuncs()
          Generate X, Y, XY, and time by sorting appropriate events.
 void gradient(double[] x, double[] g)
          Gradient function, in case one wants to do numeric optimization of the likelihood.
 void hessian(double[] x, double[][] h)
          Hessian function, in case one wants to do numeric optimization of the likelihood.
protected  int ISize(Unit u, int r)
          Deduce number of 'I' events within unit and regime time contributing to the likelihood.
 double loglik()
          Abstract method to calculate the loglikelihood of the state.
 double loglik2()
           
 void ML()
           
 EpiState sampleState()
          Make a valid instance of the parameters to start the MCMC chain with.
 java.lang.String toHeaderParams()
          Hook function to get header of logfile right.
 java.lang.String toStringParams()
          Hook function called by toString.
 void updateBeta()
          Gibbs updating of beta - we know the full conditional (see paper)
 void updateDelta()
          Gibbs updating of delta - we know the full conditional (see paper)
 void updateGamma()
          Update gamma using Metropolis Hastings.
 void updateI()
          Update I using Metropolis Hastings.
 
Methods inherited from class sir.model.EpiState
acceptProposal, analLog, isIValid, ISize, setData, setProb, tauSize, toHeader, toString, toStringEvents, Yintegrate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

c

public double c
Length of the latency period - this value does not really change


beta

public double beta
Infection pressure aka. transmission parameter


gamma

public double gamma
Parameters of the gamma distribution


delta

public double delta
Parameters of the gamma distribution


deltaaccept

public static int deltaaccept
Delta acceptance rate


E

public Event[] E
All the exposed states

Constructor Detail

SEIRStateExp

public SEIRStateExp()
Constructor - necessary to allocate an array for I

Method Detail

toHeaderParams

public java.lang.String toHeaderParams()
Hook function to get header of logfile right.

Specified by:
toHeaderParams in class EpiState

toStringParams

public java.lang.String toStringParams()
Hook function called by toString. Show all params

Specified by:
toStringParams in class EpiState

ISize

protected int ISize(Unit u,
                    int r)
Deduce number of 'I' events within unit and regime time contributing to the likelihood. This means that the I_0 event does not count. Same as calculating |I^u_r|

Overrides:
ISize in class EpiState
Parameters:
u - The unit
r - The regime
Returns:
|I^u_r|

loglik

public double loglik()
Abstract method to calculate the loglikelihood of the state. The equation is taken from the article. Note: It is required that genXYFuncs has been called

Specified by:
loglik in class EpiState

loglik2

public double loglik2()

sampleState

public EpiState sampleState()
Make a valid instance of the parameters to start the MCMC chain with. If a proper prior is specified for the model parameters we begin in the mean of the prior. Note: Currently no regime or individual spatial param setup implemented.

Specified by:
sampleState in class EpiState

updateBeta

public void updateBeta()
Gibbs updating of beta - we know the full conditional (see paper)


updateDelta

public void updateDelta()
Gibbs updating of delta - we know the full conditional (see paper)


updateGamma

public void updateGamma()
Update gamma using Metropolis Hastings.


updateI

public void updateI()
Update I using Metropolis Hastings.


generateNext

public EpiState generateNext()
Generate method for MCMC chain Modifcation happen on the instance itself to keep things simple.

Specified by:
generateNext in class EpiState
Returns:
this

f_to_minimize

public double f_to_minimize(double[] theta)
In case the object is given to a numerical minimizer, this is the function to minimize. We will only do maximization of the likelihood, i.e. parameters have to be transmoglyffed to account for different indexing of arrays etc. Thus, this will work as a wrapper to logflambdaI.

Specified by:
f_to_minimize in interface Uncmin_methods
Parameters:
theta - The parameter vector(remember Fortran indexing of arrayx (starting at 1))

gradient

public void gradient(double[] x,
                     double[] g)
Gradient function, in case one wants to do numeric optimization of the likelihood. Contains an EMPTY body.

Specified by:
gradient in interface Uncmin_methods
Parameters:
x - The parameter (remember Fortran indexing of arrayx (starting at 1))
g - The computed gradient.

hessian

public void hessian(double[] x,
                    double[][] h)
Hessian function, in case one wants to do numeric optimization of the likelihood. Contains an EMPTY body.

Specified by:
hessian in interface Uncmin_methods
Parameters:
x - The parameter (remember indexing of arrayx (starting at 1))

genXYFuncs

protected void genXYFuncs()
Generate X, Y, XY, and time by sorting appropriate events. Note: New Version using Event classes. Before, we sorted by zipping. Now we use general sort on all events. Slower? Probably - use zipper again, which required I to be sorted, but then we have to sort it twice??

Specified by:
genXYFuncs in class EpiState

ML

public void ML()