phylopomp
Phylodynamics for POMPs
|
Go to the source code of this file.
Macros | |
#define | host1 0 |
#define | host2 1 |
#define | Beta11 (__p[__parindex[0]]) |
#define | Beta12 (__p[__parindex[1]]) |
#define | Beta21 (__p[__parindex[2]]) |
#define | Beta22 (__p[__parindex[3]]) |
#define | gamma1 (__p[__parindex[4]]) |
#define | gamma2 (__p[__parindex[5]]) |
#define | psi1 (__p[__parindex[6]]) |
#define | psi2 (__p[__parindex[7]]) |
#define | omega1 (__p[__parindex[8]]) |
#define | omega2 (__p[__parindex[9]]) |
#define | b1 (__p[__parindex[10]]) |
#define | b2 (__p[__parindex[11]]) |
#define | d1 (__p[__parindex[12]]) |
#define | d2 (__p[__parindex[13]]) |
#define | C1 (__p[__parindex[14]]) |
#define | C2 (__p[__parindex[15]]) |
#define | S1_0 (__p[__parindex[16]]) |
#define | S2_0 (__p[__parindex[17]]) |
#define | I1_0 (__p[__parindex[18]]) |
#define | I2_0 (__p[__parindex[19]]) |
#define | R1_0 (__p[__parindex[20]]) |
#define | R2_0 (__p[__parindex[21]]) |
#define | S1 (__x[__stateindex[0]]) |
#define | S2 (__x[__stateindex[1]]) |
#define | I1 (__x[__stateindex[2]]) |
#define | I2 (__x[__stateindex[3]]) |
#define | R1 (__x[__stateindex[4]]) |
#define | R2 (__x[__stateindex[5]]) |
#define | N1 (__x[__stateindex[6]]) |
#define | N2 (__x[__stateindex[7]]) |
#define | ll (__x[__stateindex[8]]) |
#define | node (__x[__stateindex[9]]) |
#define | ell1 (__x[__stateindex[10]]) |
#define | ell2 (__x[__stateindex[11]]) |
#define | COLOR (__x[__stateindex[12]]) |
#define | EVENT_RATES |
#define | lik (__lik[0]) |
Functions | |
static int | random_choice (double n) |
static void | change_color (double *color, int nsample, int n, int from, int to) |
static int | check_color (double *color, int nsample, double size1, double size2) |
static double | event_rates (double *__x, const double *__p, double t, const int *__stateindex, const int *__parindex, const int *__covindex, const double *__covars, double *rate, double *logpi, double *penalty) |
void | twospecies_rinit (double *__x, const double *__p, double t0, const int *__stateindex, const int *__parindex, const int *__covindex, const double *__covars) |
void | twospecies_gill (double *__x, const double *__p, const int *__stateindex, const int *__parindex, const int *__covindex, const double *__covars, double t, double dt) |
void | twospecies_dmeas (double *__lik, const double *__y, const double *__x, const double *__p, int give_log, const int *__obsindex, const int *__stateindex, const int *__parindex, const int *__covindex, const double *__covars, double t) |
Measurement model likelihood (dmeasure). More... | |
Variables | |
static const int | nrate = 18 |
#define b1 (__p[__parindex[10]]) |
Definition at line 51 of file twospecies_pomp.c.
#define b2 (__p[__parindex[11]]) |
Definition at line 52 of file twospecies_pomp.c.
#define Beta11 (__p[__parindex[0]]) |
Definition at line 41 of file twospecies_pomp.c.
#define Beta12 (__p[__parindex[1]]) |
Definition at line 42 of file twospecies_pomp.c.
#define Beta21 (__p[__parindex[2]]) |
Definition at line 43 of file twospecies_pomp.c.
#define Beta22 (__p[__parindex[3]]) |
Definition at line 44 of file twospecies_pomp.c.
#define C1 (__p[__parindex[14]]) |
Definition at line 55 of file twospecies_pomp.c.
#define C2 (__p[__parindex[15]]) |
Definition at line 56 of file twospecies_pomp.c.
#define COLOR (__x[__stateindex[12]]) |
Definition at line 75 of file twospecies_pomp.c.
#define d1 (__p[__parindex[12]]) |
Definition at line 53 of file twospecies_pomp.c.
#define d2 (__p[__parindex[13]]) |
Definition at line 54 of file twospecies_pomp.c.
#define ell1 (__x[__stateindex[10]]) |
Definition at line 73 of file twospecies_pomp.c.
#define ell2 (__x[__stateindex[11]]) |
Definition at line 74 of file twospecies_pomp.c.
#define EVENT_RATES |
Definition at line 77 of file twospecies_pomp.c.
#define gamma1 (__p[__parindex[4]]) |
Definition at line 45 of file twospecies_pomp.c.
#define gamma2 (__p[__parindex[5]]) |
Definition at line 46 of file twospecies_pomp.c.
#define host1 0 |
Definition at line 5 of file twospecies_pomp.c.
#define host2 1 |
Definition at line 6 of file twospecies_pomp.c.
#define I1 (__x[__stateindex[2]]) |
Definition at line 65 of file twospecies_pomp.c.
#define I1_0 (__p[__parindex[18]]) |
Definition at line 59 of file twospecies_pomp.c.
#define I2 (__x[__stateindex[3]]) |
Definition at line 66 of file twospecies_pomp.c.
#define I2_0 (__p[__parindex[19]]) |
Definition at line 60 of file twospecies_pomp.c.
#define lik (__lik[0]) |
Definition at line 631 of file twospecies_pomp.c.
#define ll (__x[__stateindex[8]]) |
Definition at line 71 of file twospecies_pomp.c.
#define N1 (__x[__stateindex[6]]) |
Definition at line 69 of file twospecies_pomp.c.
#define N2 (__x[__stateindex[7]]) |
Definition at line 70 of file twospecies_pomp.c.
#define node (__x[__stateindex[9]]) |
Definition at line 72 of file twospecies_pomp.c.
#define omega1 (__p[__parindex[8]]) |
Definition at line 49 of file twospecies_pomp.c.
#define omega2 (__p[__parindex[9]]) |
Definition at line 50 of file twospecies_pomp.c.
#define psi1 (__p[__parindex[6]]) |
Definition at line 47 of file twospecies_pomp.c.
#define psi2 (__p[__parindex[7]]) |
Definition at line 48 of file twospecies_pomp.c.
#define R1 (__x[__stateindex[4]]) |
Definition at line 67 of file twospecies_pomp.c.
#define R1_0 (__p[__parindex[20]]) |
Definition at line 61 of file twospecies_pomp.c.
#define R2 (__x[__stateindex[5]]) |
Definition at line 68 of file twospecies_pomp.c.
#define R2_0 (__p[__parindex[21]]) |
Definition at line 62 of file twospecies_pomp.c.
#define S1 (__x[__stateindex[0]]) |
Definition at line 63 of file twospecies_pomp.c.
#define S1_0 (__p[__parindex[16]]) |
Definition at line 57 of file twospecies_pomp.c.
#define S2 (__x[__stateindex[1]]) |
Definition at line 64 of file twospecies_pomp.c.
#define S2_0 (__p[__parindex[17]]) |
Definition at line 58 of file twospecies_pomp.c.
|
static |
Definition at line 12 of file twospecies_pomp.c.
|
static |
Definition at line 26 of file twospecies_pomp.c.
|
static |
Definition at line 84 of file twospecies_pomp.c.
|
inlinestatic |
void twospecies_dmeas | ( | double * | __lik, |
const double * | __y, | ||
const double * | __x, | ||
const double * | __p, | ||
int | give_log, | ||
const int * | __obsindex, | ||
const int * | __stateindex, | ||
const int * | __parindex, | ||
const int * | __covindex, | ||
const double * | __covars, | ||
double | t | ||
) |
void twospecies_gill | ( | double * | __x, |
const double * | __p, | ||
const int * | __stateindex, | ||
const int * | __parindex, | ||
const int * | __covindex, | ||
const double * | __covars, | ||
double | t, | ||
double | dt | ||
) |
Simulator for the latent-state process (rprocess).
This is the Gillespie algorithm applied to the solution of the filter equation for the TwoSpecies model. It advances the state from time t
to time t+dt
.
A tricky aspect of this function is that it must return a "valid" state even when the state is incompatible with the genealogy. In such a case, we set the log likelihood (ll
) to R_NegInf
, but the state must remain valid. Hence insertion of extra infectives, etc.
FIXME: At the moment, the following codes exclude the possibility of importation of infection.
Definition at line 290 of file twospecies_pomp.c.
void twospecies_rinit | ( | double * | __x, |
const double * | __p, | ||
double | t0, | ||
const int * | __stateindex, | ||
const int * | __parindex, | ||
const int * | __covindex, | ||
const double * | __covars | ||
) |
Latent-state initializer (rinit component).
The state variables include S, E, I, R plus 'ellE' and 'ellI' (numbers of E- and I-deme lineages), the accumulated weight ('ll'), the current node number ('node'), and the coloring of each lineage ('COLOR').
Definition at line 249 of file twospecies_pomp.c.
|
static |
Definition at line 4 of file twospecies_pomp.c.