sempwn / bennu

Bayesian Estimation of Naloxone Numbers Underreporting
https://sempwn.github.io/bennu/
Other
1 stars 0 forks source link

More informative error if `time_point` is zero #29

Open sempwn opened 1 year ago

sempwn commented 1 year ago

timepoint in data for est_naloxone needs to start from 1, but produces unhelpful error message when indexed from 0.

THN_data <- bennu::generate_model_data()
# start index at 0 not 1
THN_data$times <- THN_data$times -1
fit <- bennu::est_naloxone(THN_data)

produces the following error

Error in eval(ei, envir) : 
  Exception: model_distribution_covariate_model_namespace::model_distribution_covariate_model: times[sym1__] is 0, but must be greater than or equal to 1 (in 'string', line 74, column 2 to column 52)
failed to create the sampler; sampling not done

Should do some data checking in est_naloxone function.