epiverse-trace / serofoi

Estimates the Force-of-Infection of a given pathogen from population based sero-prevalence studies
https://epiverse-trace.github.io/serofoi/
Other
17 stars 4 forks source link

Error regarding age differing number of rows with data for visualization #47

Closed hyolimkang closed 1 year ago

hyolimkang commented 1 year ago

I am running serofoi model run_seromodel function, but it seems like the function selectively works with different data. When I run the function "run_seromodel", it seems like the model converged, but the plot_seromodel doesn't work with the following error message saying that Some Pareto k diagnostic values are too high. I am not sure where this error is oriented from and I'd appreciate with any helps regarding this issue!


# Warning message:
Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.
Error in data.frame(age = 1:80, predicted_prev = medianv, predicted_prev_lower = lower,  : 
  arguments imply differing number of rows: 80, 97

ntorresd commented 1 year ago

Hi Hyolim, thanks for your feedback.

The message regarding the pareto k diagnostic values is a warning by Stan. The statistical significance of this warning depends on your particular data and on the results of the modelling process. The error you're getting is likely due to a difference in length between the age vector assigned when plotting and the length of your dataframe; however I'd expect this kind of problems to occur because of how ages are being handled by the package right now. It'd be useful to have either a sample of the data or a reproducible example of the error to confirm whether is a problem with the package's handling of the age or with the dataframe you're using.

EDIT: we already identify the issue is coming from an inflexibility when handling ages for plotting.