#include "pomplink.h"
#include "internal.h"
Go to the source code of this file.
|
#define | Beta (__p[__parindex[0]]) |
|
#define | gamma (__p[__parindex[1]]) |
|
#define | psi (__p[__parindex[2]]) |
|
#define | omega (__p[__parindex[3]]) |
|
#define | S0 (__p[__parindex[4]]) |
|
#define | I0 (__p[__parindex[5]]) |
|
#define | R0 (__p[__parindex[6]]) |
|
#define | N (__p[__parindex[7]]) |
|
#define | S (__x[__stateindex[0]]) |
|
#define | I (__x[__stateindex[1]]) |
|
#define | R (__x[__stateindex[2]]) |
|
#define | ll (__x[__stateindex[3]]) |
|
#define | ellI (__x[__stateindex[4]]) |
|
#define | node (__x[__stateindex[5]]) |
|
#define | EVENT_RATES |
|
#define | lik (__lik[0]) |
|
|
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 *penalty) |
|
void | sirs_rinit (double *__x, const double *__p, double t, const int *__stateindex, const int *__parindex, const int *__covindex, const double *__covars) |
| Latent-state initializer (rinit). More...
|
|
void | sirs_gill (double *__x, const double *__p, const int *__stateindex, const int *__parindex, const int *__covindex, const double *__covars, double t, double dt) |
|
void | sirs_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...
|
|
|
static const int | nrate = 3 |
|
◆ Beta
#define Beta (__p[__parindex[0]]) |
◆ ellI
#define ellI (__x[__stateindex[4]]) |
◆ EVENT_RATES
Value:
__stateindex,__parindex,__covindex, \
__covars,rate,&penalty) \
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 *penalty)
Definition at line 21 of file sirs_pomp.c.
◆ gamma
#define gamma (__p[__parindex[1]]) |
#define I (__x[__stateindex[1]]) |
◆ I0
#define I0 (__p[__parindex[5]]) |
◆ lik
◆ ll
#define ll (__x[__stateindex[3]]) |
#define N (__p[__parindex[7]]) |
◆ node
#define node (__x[__stateindex[5]]) |
◆ omega
#define omega (__p[__parindex[3]]) |
◆ psi
#define psi (__p[__parindex[2]]) |
#define R (__x[__stateindex[2]]) |
◆ R0
#define R0 (__p[__parindex[6]]) |
#define S (__x[__stateindex[0]]) |
◆ S0
#define S0 (__p[__parindex[4]]) |
◆ event_rates()
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 * |
penalty |
|
) |
| |
|
static |
Definition at line 26 of file sirs_pomp.c.
38 double event_rate = 0;
47 event_rate += (*rate = alpha*(1-disc)); rate++;
48 *penalty += alpha*disc;
52 event_rate += (*rate = alpha); rate++;
59 event_rate += (*rate = alpha); rate++;
63 assert(R_FINITE(event_rate));
◆ sirs_dmeas()
void sirs_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).
Definition at line 189 of file sirs_pomp.c.
204 lik = (give_log) ?
ll : exp(
ll);
◆ sirs_gill()
void sirs_gill |
( |
double * |
__x, |
|
|
const double * |
__p, |
|
|
const int * |
__stateindex, |
|
|
const int * |
__parindex, |
|
|
const int * |
__covindex, |
|
|
const double * |
__covars, |
|
|
double |
t, |
|
|
double |
dt |
|
) |
| |
Latent-state process simulator (rprocess).
This integrates the filter equation.
Definition at line 90 of file sirs_pomp.c.
101 double tstep = 0.0, tmax = t + dt;
105 int parent = (int) nearbyint(
node);
110 assert(parent<=nnode);
114 switch (nodetype[parent]) {
125 if (sat[parent] == 1) {
127 }
else if (sat[parent] == 0) {
140 assert(sat[parent]==2);
144 ll -= log(
I*(
I-1)/2);
157 tstep = exp_rand()/event_rate;
159 while (t + tstep < tmax) {
178 tstep = exp_rand()/event_rate;
get_userdata_int_t * get_userdata_int
static int rcateg(double erate, double *rate, int nrate)
◆ sirs_rinit()
void sirs_rinit |
( |
double * |
__x, |
|
|
const double * |
__p, |
|
|
double |
t, |
|
|
const int * |
__stateindex, |
|
|
const int * |
__parindex, |
|
|
const int * |
__covindex, |
|
|
const double * |
__covars |
|
) |
| |
Latent-state initializer (rinit).
Definition at line 68 of file sirs_pomp.c.
◆ nrate