|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sir.model.SIRState
Title: LadyBug
Description: Estimation of SIR parameters. Class corresponds to state of the Markov
Chain in the simple SIR example. It consists of beta, gamma, I1, \mathbf{I}. The two
latter are stored into the same I array as I[0] and I[1]...I[?], respectively.
Copyright: Copyright (c) 2002
Field Summary | |
static int |
accepted
Static stuff to keep track of progress |
static int |
betaNaccept
Static stuff to keep track of progress |
static int[] |
betaaccept
Static link to an array structure holding individual beta acceptance rates. |
static Data |
data
Static link to the data. |
double |
deviance
Deviance part |
static int[] |
gammaaccept
Gamma acceptance rate |
double |
loglik
LogLikelihood |
boolean |
nogen
Boolean telling whether genXYZ has been ran on this object (inits events array) |
static int |
runs
Static stuff to keep track of progress |
Constructor Summary | |
SIRState()
Constructor - necessary to allocate an array for I |
|
SIRState(Event[] I)
Constructor - necessary to allocate an array for I |
Method Summary | |
void |
add(SIRState s,
double noOfSamples)
Add values for posterior mean calculations |
double |
allBetaBetweenIntegrate(int r)
Calculate int_{S[i-1]},S[i]} sum{u\in U} \sum\sum \beta^N X^u Y^u for a regime i, i.e. |
double |
allBetaIntegrate(int r)
Calculate int_{S[i-1]},S[i]} \lambda_{all}(t) for a regime i, i.e. |
double |
allBetaWithinIntegrate(int r)
Calculate int_{S[i-1]},S[i]} sum{u\in U} \beta X^u Y^u for a regime i, i.e. |
double |
f_to_minimize(double[] theta)
In case the object is given to a numerical minimizer, this is the function to minimize. |
int |
genUniformI(java.lang.Double I0,
Distributions prob)
Method to generate an instance of the I vector conditioned on tau. |
protected void |
genXYZFromLambdaI()
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. |
boolean |
isIValid()
Verify whether I is valid wrt. tau, i.e. that the constraints are fulfilled |
protected int |
ISize(Unit u,
int r)
Deduce number of 'I' events within unit and regime time contributing to the likelihood. |
protected int |
ISize(Unit u,
int r,
Unit uorigin)
Deduce number of 'I' events within unit u and regime r contributing to the likelihood originating from section u'. |
java.lang.String |
ItoString()
Show I as one line |
double |
logflambdaI()
Corrected spatial edition, calculating \int_{I_0}^T \sum_{u\in U} \lambda_\all^u(t) |
protected int |
tauSize(Unit u,
int r)
Deduce number of 'R' events within unit and regime time contributing to the likelihood. |
java.lang.String |
toString()
Debug/Information as usual |
void |
translateTheta2Beta(double[] theta)
Function to transfer beta vector from one long array to our 3D array This is used in the minimizing stuff. |
void |
writeRFile()
To R-compatible file, i.e. write a .txt file containing the following columns t, X_11, Y_11, ..., X_nn, Y_nn, eventype. |
protected double |
XYintegrate(Unit u,
int r)
Calculate int_{S[i-1]},S[i]} X(t) Y(t) for a regime i. |
protected double |
Yintegrate(Unit u,
int r)
Calculate int_{S[i-1]},S[i]} Y_u(t) dt for a unit u and regime r. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public double loglik
public boolean nogen
public double deviance
public static int runs
public static int accepted
public static int betaNaccept
public static int[] betaaccept
public static int[] gammaaccept
public static Data data
Constructor Detail |
public SIRState()
public SIRState(Event[] I)
Method Detail |
public void translateTheta2Beta(double[] theta)
public double f_to_minimize(double[] theta)
f_to_minimize
in interface Uncmin_methods
public void gradient(double[] x, double[] g)
gradient
in interface Uncmin_methods
x
- The parameter (remember Fortran indexing of arrayx (starting at 1))g
- The computed gradient.public void hessian(double[] x, double[][] h)
hessian
in interface Uncmin_methods
x
- The parameter (remember indexing of arrayx (starting at 1))public void writeRFile()
public java.lang.String ItoString()
public java.lang.String toString()
toString
in class java.lang.Object
public void add(SIRState s, double noOfSamples)
protected double Yintegrate(Unit u, int r)
u
- The unit to get Y(t) from.r
- The regime defining the time limits. I.e. all points with that number.
public double allBetaBetweenIntegrate(int r)
r
- The regime defining the time limits. I.e. all points with that number.public double allBetaWithinIntegrate(int r)
r
- The regime defining the time limits. I.e. all points with that number.public double allBetaIntegrate(int r)
r
- The regime defining the time limits. I.e. all points with that number.protected double XYintegrate(Unit u, int r)
u
- Unit to take X,Y values in. This only works as long as there is no interaction.r
- The regime defining the time limits. I.e. all points with that number.protected int ISize(Unit u, int r)
u
- The unitr
- The regime
protected int ISize(Unit u, int r, Unit uorigin)
u
- The unitr
- The regimeuorigin
- The origin of the infection (a reference)
protected int tauSize(Unit u, int r)
u
- The unitr
- The regime
public boolean isIValid()
protected void genXYZFromLambdaI()
public double logflambdaI()
public int genUniformI(java.lang.Double I0, Distributions prob)
I0
- Initial value, if not null then it is kept fixed and used to generate I.prob
- The random number generator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |