|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.omegahat.Simulation.MCMC.NotifyingMCMCObject | +--org.omegahat.Simulation.MCMC.BaseMarkovChain | +--sir.estimate.SIRestimate
This class implements estimation of the parameters in a SIR epidemic. Four methods are supported:
Inner classes inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject |
org.omegahat.Simulation.MCMC.NotifyingMCMCObject.MyHandle |
Field Summary | |
protected Data |
data
New version - all data related variables are gathered in a Data object |
static boolean |
DEBUG
Debugging flag - gives extra printed info |
static java.text.NumberFormat |
form
For formatting of doubles to an output stream. |
protected boolean |
gotI
Do we have acces to I time |
protected boolean |
metropolisBeta
Do we want the beta's to be updated using Metropolis sampling. |
protected Distributions |
prob
The Pseudo random generator for distributions |
Fields inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject |
listeners |
Constructor Summary | |
SIRestimate(org.omegahat.Simulation.RandomGenerators.PRNG prng,
java.lang.String lambdaFile,
java.lang.String IFile)
Constructor which calls all the necessary sub-routines, s.a. reading of data, registering of listeners and iteration of the MC. |
Method Summary | |
org.omegahat.Simulation.MCMC.MCMCState |
generate(org.omegahat.Simulation.MCMC.MCMCState state)
Generate the next state of the Markov Chain using Gibbs-within-Metropolis. |
org.omegahat.Simulation.MCMC.MCMCState |
initialState()
Method to generate the initial state of the Markov Chain. |
static void |
main(java.lang.String[] argv)
Main function - start a SIRestimate analyserer based on prompt arguments |
void |
MCMCEst(int noOfSamples,
int thinFactor,
int noOfBurnin,
double hmeanscale)
MCMC Estimation method - generates noOfSamples*thinFactor + noOfBurnin samples and estimates beta and gamma based on recovery times alone. |
SIRState |
MLEst(SIRState state,
boolean printEstimates)
Calculate parameters beta and gamma using ML estimation. |
void |
MMLEst(int noOfEstimates,
int noOfMCSamples,
double sumscale)
Do maximization of the marginalized density f(\bm{lambda}|\bm{beta}). |
protected void |
readDataFile(java.lang.String lambdaFile,
java.lang.String IFile)
Read information about the epidemic from the denoted files. |
protected void |
readLogFile(double[][][] Ebeta,
double[][][] Egamma,
double[] EbetaN,
double[][][] beta,
double[][][] gamma,
double[] betaN,
double[] pdm)
Method for calculating mean or variance of samples from the logfile. |
void |
SimMLEst()
Sim params and then do ML |
Methods inherited from class org.omegahat.Simulation.MCMC.BaseMarkovChain |
getState, iterate, run, step |
Methods inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject |
notifyAll, registerListener, unregisterListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean DEBUG
protected boolean gotI
protected Data data
protected boolean metropolisBeta
public static java.text.NumberFormat form
protected Distributions prob
Constructor Detail |
public SIRestimate(org.omegahat.Simulation.RandomGenerators.PRNG prng, java.lang.String lambdaFile, java.lang.String IFile)
prng
- The pseudo random number generatorlambdaFile
- Name of the file containing recovery timesIfile
- Name of file containing infectious times.Method Detail |
public org.omegahat.Simulation.MCMC.MCMCState initialState()
IFromFile
- Double array with inf times loaded from file (could be null)public org.omegahat.Simulation.MCMC.MCMCState generate(org.omegahat.Simulation.MCMC.MCMCState state)
generate
in class org.omegahat.Simulation.MCMC.BaseMarkovChain
state
- Current chain of the MCSIRState
protected void readLogFile(double[][][] Ebeta, double[][][] Egamma, double[] EbetaN, double[][][] beta, double[][][] gamma, double[] betaN, double[] pdm)
pdm
- P(D|M) - marginal posterior of data estimated by P2 estimator (harmonic mean of likelihoods)DIC
- - Deviance information criterion obtained form the posteriors. Not implemented yet, because it requires I'sprotected void readDataFile(java.lang.String lambdaFile, java.lang.String IFile)
lambdaFile
- The filename containing the recovery timesIFile
- Filename of the infectious time (if it exists).public void SimMLEst()
public void MMLEst(int noOfEstimates, int noOfMCSamples, double sumscale)
public SIRState MLEst(SIRState state, boolean printEstimates)
printRes
- If true, the parameter estimates found are printed to System.out.state
- In case we want to supply infection times directly, we provide them. If null then they are taken from the I-file.public void MCMCEst(int noOfSamples, int thinFactor, int noOfBurnin, double hmeanscale)
noOfBurnin
- Number of samples to use as burnin. Note: No thinningthinFactor
- Thinning,e.g. take each 100th sample.numiter
- How many sample do we want?hmeanscale
- Scaling of \hat{P}_2, i.e. scaling when compuing harmonic mean.public static void main(java.lang.String[] argv) throws java.lang.Throwable
argc
- 1st argument = text file wit SIR information.readDataFile(java.lang.String, java.lang.String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |