Hi all,
I really like the new interface for integrating ODEs in Stan version 2.4 and 2.5, because we no longer have to mess around with reconstructing parameter and data structures from 1d arrays. However, in the old interface it was possible to distinguish between data and parameters which is important because the ODE integrator has to add sensitivity equations for the parameters, but not the data (right?).
So my question is: does the new ODE interface distinguish between arguments that are parameters and data, or can we tell it by using the data
keyword? For instance as I show in the following ODE model
functions {
// the ubiquitous SIR model
vector ode_sys(real t, vector y, real beta, data real gamma) { // assume gamma is known
vector[2] dy = [-beta * y[1] * y[2], beta * y[1] * y[2] - gamma * y[2]]';
return dy;
}
}
data {
// we are really confident about gamma
real<lower=0> gamma;
real t0;
int<lower=1> N;
real<lower=t0> ts[N];
// observations...
}
parameters {
// we want to estimate beta
real<lower=0> beta;
}
model {
vector[2] y0 = [0.99, 0.01]';
vector[2] y[N] = ode_adams(ode_sys, y0, t0, ts, beta, gamma);
// compute likelihood of observations...
}
Thanks,
Chris