We introduced parameters plot_constant and x_axis to the visualisation functions of the package. These enable the option to plot constant FoI estimates and their corresponding r-hat values, avoiding ambiguity in the specification of the x-axis by means of x_axis = "time" or x_axis = "age".
foi_models to show the prior specification options available in the package.foi_modelsseroprevalence_ and seropositive_ for seroprev_probability_ for prob__modelREADMElintr v3.2.0 new suggestionsHmisc dependency.Matrix package for expmdonttest to examples taking too long to runSerological surveys simulation functionalities
Enables the implementation of a wide variety of new models
sf_normal() and sf_uniform().simdata_* datasets from the package and replaced them with code-based simulation in vignettes.Unit testing
Refactorization of simulation examples
Documentation improvements
foi_sim_constant <- rep(0.02, 50)
serodata_constant <- generate_sim_data(
sim_data = data.frame(
age = seq(1, 50),
tsur = 2050),
foi = foi_sim_constant,
sample_size_by_age = 5
)
To generate grouped serosurveys the function group_sim_data can be used:
serodata_constant <- group_sim_data(serodata_constant, step = 5)
Simplifies fit_seromodel output
fit_seromodel was a list: seromodel_object <- list(
fit = fit,
seromodel_fit = seromodel_fit,
serodata = serodata,
serodata = serodata,
stan_data = stan_data,
...
)
Now, the output is a stan_fit object as obtained from rstan::sampling. Because of this, some plotting functionalities now require serodata as an input.
Initial prior distribution parameters foi_location and foi_scale can be specified explicitly in fit_seromodel:
seromodel <- fit_seromodel(
serodata,
foi_model = "tv_normal",
foi_location = 0,
foi_scale = 1
)
Depending on the selected model foi_model, the meaning of the parameters change. For the tv_normal_log model these parameters must be in logarithmic scale; the recommended usage is:
seromodel <- fit_seromodel(
serodata,
foi_model = "tv_normal_log",
foi_location = -6,
foi_scale = 4
)
data(chagas2012)
serodata <- prepare_serodata(chagas2012)
seromodel <- fit_seromodel(serodata, foi_model = "tv_normal")
seromodel <- fit_seromodel(serodata, foi_model = "tv_normal", chunk_size = 10)
or explicitly:
chunks <- rep(c(1, 2, 3, 4, 5), c(10, 10, 15, 15, max(serodata$age_mean_f)-50))
seromodel <- fit_seromodel(serodata, foi_model = "tv_normal", chunks = chunks)
run_seromodel. Initially this function was intended to be a handler for fit_seromodel for cases when the user may need to implement the same model to multiple independent serosurveys; now we plan to showcase examples of this using the current functionalities of the package (to be added in future versions to the vignettes).Refactorization of the visualization module
plot_seroprev allows for data binning (age group manipulation) by means of parameters bin_data=TRUE and bin_step.ymin and ymax aesthetics plotting functions (with the exception of plot_rhats).Remove duplicated data in veev2012 dataset
Remove large files from git history (see #77).
Added input validation for the following functions:
prepare_serodatagenerate_sim_dataget_age_groupfit_seromodelextract_seromodel_summaryplot_seroprevplot_seroprev_fittedplot_foiplot_seromodelUnit testing:
dplyr::near to test models statistical validityUpdate package template in accordance to {packagetemplate}
This release of serofoi, includes the following:
Overall, this release introduces essential package functionality, comprehensive documentation, various FoI models, and a coverage test, enabling users to analyse seroprevalence data and calculate the Force-of-infection.