mrc-ide/mcstate

Particle filter data with only one time point not allowed at the moment

MJomaba opened this issue · 0 comments

The following code is producing an error at the moment

d_df <- data.frame(t = 1, observed = rnorm(n_obs,20, 5))
pf_data <- mcstate::particle_filter_data(d_df, "t", rate=NULL, initial_time = 0)

Error in mcstate::particle_filter_data(d_df, "t", rate = NULL, initial_time = 0) : Expected at least two time windows

I cannot see a reason for this in principle.

In this particular case, and if initial time is 0, this is providing a workaround but it's neither general nor elegant:

d_df <- data.frame(t = c(0,1), observed = c(NA,rnorm(n_obs,20, 5)))
pf_data <- mcstate::particle_filter_data(d_df, "t", rate=NULL, initial_time = 0)