jtimonen / odeint-stan

ODE problems in Stan
0 stars 0 forks source link

rk4 method: how to specify STEP_SIZE, INTERP_R and INTERP_A? #1

Open anthonyhauser opened 4 years ago

anthonyhauser commented 4 years ago

Dear Juho, My name is Anthony Hauser. I am working at the Institute of Social and Preventive Medicine (ISPM) in Bern, Switzerland, with Julien Riou. A few weeks ago, you applied some faster ODE-solvers on our model estimating Covid-19 mortality with really promising results (Julien showed me the results). I would like to try to run one of these ODE-solvers (the rk4 one, as it seems to be the fastest) on my computer using the 'main_model13.R' file from your github, but in this file, you only show how to do it for the bdf solver. For the rk4 method, I would need to know three parameters, STEP_SIZE, INTERP_R and INTERP_A, in order to run it, but did not find how to specify them. I tried something, but I got some NaN or Inf values, so I must be doing something wrong. Would you have a 'main_model.R' file for the rk4 method? Many thanks for the great work! Anthony

jtimonen commented 4 years ago

Hi,

I would like to try to run one of these ODE-solvers (the rk4 one, as it seems to be the fastest) on my computer using the 'main_model13.R' file from your github, but in this file, you only show how to do it for the bdf solver.

In covid/main_model13.R, you would just uncomment the line

model <- stan_model(file = 'model13/model13_rk4.stan')

and comment out or remove the line

model <- stan_model(file = 'model13/model13_bdf.stan')

to use rk4. Value step_size <- 1 (one day) would be okay with rk4 if I remember correctly. The line

data_list_model13 <- add_interpolation_data(data_list_model13, step_size)

will compute and add to the data list the INTERP_R and INTERP_A values for you, with given step size.