|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.omegahat.Simulation.MCMC.NotifyingMCMCObject | +--org.omegahat.Simulation.MCMC.BaseMarkovChain | +--sir.estimate.LadyBug2
This class implements estimation of the parameters in a SIR epidemic. Four methods are supported:
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 boolean |
metropolisGamma
Do we want the gamma's to be updated using Metropolis, i.e. |
protected Distributions |
prob
The Pseudo random generator for distributions |
Fields inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject |
listeners |
Constructor Summary | |
LadyBug2(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 |
generate2(org.omegahat.Simulation.MCMC.MCMCState state)
Generate the next state of the Markov Chain using Gibbs-within-Metropolis. |
org.omegahat.Simulation.MCMC.MCMCState |
initialState(boolean mcmctheta)
Method to generate the initial state of the Markov Chain. |
static void |
main(java.lang.String[] argv)
Main function - start a LadyBug2 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
protected boolean metropolisGamma
public static java.text.NumberFormat form
protected Distributions prob
Constructor Detail |
public LadyBug2(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 timesMethod Detail |
public org.omegahat.Simulation.MCMC.MCMCState initialState(boolean mcmctheta)
mcmctheta
- How to interpretate theta, if true then param in exp distribution.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 MC
EpiState
public org.omegahat.Simulation.MCMC.MCMCState generate2(org.omegahat.Simulation.MCMC.MCMCState state)
state
- Current chain of the MC
SIRState
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)protected 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)
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.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
java.lang.Throwable
readDataFile(java.lang.String, java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |