Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add data simulation functions (#126)
* remove serodata .Rdata and .Rd files * remove R/serodata.R * doc: update functions documentation replacing for in examples * doc: update README and vignettes This commit changes the removed preloaded dataset `serodata` for the identical `chagas2012`. * fix: minor correction to test_modelling * feat: add function `get_foi_central_estimates()` to the modelling module. This change is meant to simplify `fit_seromodel()`. This commit also changes the name of the stanfit object in the output of `fit_seromodel()` from `fit` to `seromodel_fit`. * fix: minor corrections to tests according to commit 052c90c * fix: change to in model_comparison * doc: add documentation file for * doc: minor correction to documentation * refac: updates * refac: reduce the output of * fix(tests): change storing format of model object files from .json to .RDS and updates test_visualization accordingly * Remove `serodata` from pre-loaded datasets of the package (#107) * remove serodata .Rdata and .Rd files * remove R/serodata.R * doc: update functions documentation replacing for in examples * doc: update serofoi logo * doc: update README and vignettes This commit changes the removed preloaded dataset `serodata` for the identical `chagas2012`. * fix: minor correction to test_modelling * Fixes #115 (#116) * 82 tidyverse dependency (#120) * Enabling CMD check when doing pull request on `dev` * Removed tidyverse dependency * refac: `fit_seromodel` returns stanfit object (#117) * refac: `fit_seromodel` returns a stanfit object `fit_seromodel` returns a stanfit object now, which induces changes all across the pachage - `seromodel_object$seromodel_fit -> seromodel_object`: * `get_foi_central_estimates` * `extract_seromodel_summary` * `plot_seroprev_fitted` * `plot_foi` * `plot_rhats` * `plot_seromodel` * `get_table_rhats` - add `serodata` as input: * `get_foi_central_estimates` * `extract_seromodel_summary` * `plot_seroprev_fitted` * `plot_seromodel` * `plot_rhats` * `plot_foi` * `get_table_rhats` - use of `exposure_years` (this suggest adding a function for this purpose): * `get_foi_central_estimates` * `get_table_rhats` - minor corrections: * `plot_seromodel` -> correction to exception * tests(refac): re-generate .RDS files used in tests * tests(refac): update tests according to 7be19f9 - change `model_object$seromodel_fit` to `model_object` - add `serodata` as input where needed - minor syntax changes to test_issue_47.R * fix examples Fix examples of functions across the package in accordance to the new output of `fit_seromodel`. Updated examples: - `get_table_rhats` - `get_foi_central_estimates` - `get_prev_expanded` - `extract_seromodel_summary` - `plot_seroprev_fitted` - `plot_foi` - `plot_rhats` - `plot_seromodel` - `plot_info_table` * refac: replace `get_exposure_ages` for `get_cohort_ages` add `get_cohort_ages`: this function serves as replacement for `get_exposure_ages` and also includes the information of `exposure_years`, which was being used in some functions. Affected functions: - `fit_seromodel` - `get_exposure_matrix` - `get_table_rhats` * test: add test for `get_cohort_ages` to the test_modelling.R * refac: replace `serodata` for `cohort_ages` where needed Affected functions: - `get_table_rhats` - `get_foi_central_estimates` - `extract_seromodel_summary` - `plot_foi` - `plot_rhats` - `plot_seromodel` * doc: update documentation use @inheritParams to simplify documentation * add comment to exception in `fit_seromodel` * refac: specify argument `parameter_name` Explicitely specify argument `parameter_name = "logLikelihood"` in `loo::loo` * change condition to check whether sampling is done or not * doc: update vignettes according to changes * doc: update documentation and examples * doc: parameter description correction parameter `seromodel_object` description correction in `get_foi_central_estimates` * doc: minor corrections to functions documentation * fix: add input check for `age_mean_f` column (#123) add input check for `age_mean_f` in `serodata` in the following functions - `prepare_serodata` - `prepare_bin_data` * Add input validation (#92) * Added argument matching in fit_seromodel() * Added allowed options to arg foi_model * Added input validation to prepare_serodata() * Fixed the check for required columns * Regenerated the docs --------- Co-authored-by: ntorresd <[email protected]> * Remove test_visualisation and related files * Convert logo to png To keep a reasonable repo size * Add functions to simulate datasets to the seroprevalence_data module. (#58) * fix: add exception to function plot_foi() to plot a FOI trend with different length along with the data for the case when their sizes don't coincide * clean test_visualisation * feature: add three functions to simulate datasets. get_sim_counts() generates a list with simulated counts by age following a binomial distribution. generate_sim_data() uses the counts generated by get_sim_counts() to create a dataframe with the necessary structure to use other functions of the package. group_sim_data() serves to group the previously generated dataset by age group; right now it groups the data by periods of 5 years. * add test_simulate_data to test the data simulation functions in the seroprevalence_data module * doc: update generate_sim_data description * doc: complete get_sim_counts documentation and remove corresponding TODO item in seroprevalence_data.R * feat: add function get_sim_prob to seroprevalence_data.R. This function generates a list containing a seropositivity destribution by age following the specified force of infection. * doc: complete documentation of generate_sim_data in seroprevalence_data.R. Remove corresponding TODO item. * feat: add function `get_age_group` to seroprevalence_data.R. This function was taken from vaccineff [vaccineff](https://github.com/epiverse-trace/vaccineff). Minor changes to `group_sim_data` description. * feat (refac): use `get_age_group` function to generate the age groups in `group_sim_data` * doc: add or update documentation for data simulation functions * refac: minor changes to `get_sim_prob()` Move seed setting from `get_sim_prob()` to `get_sim_counts()`. Remove unnecessary parameters from documentation in `get_sim_prob()` * doc: update documentation for data simulation functions update `foi` parameter description - `get_sim_prob()` - `get_sim_counts` - `generate_sim_data` update `birth_year` parameter description - `prepare_serodata()` - `prepare_bin_data()` - `get_sim_counts()` - `get_sim_prob()` update function descriptions - `get_sim_counts()` - `generate_sim_data()` update return description - `get_sim_counts()` remove export - `prepare_bin_data()` - `get_sim_prob()` remove unnecessary input parameters - `get_sim_prob()` - `get_sim_counts()` * refac: change `size_age_class` for `sample_size_by_age` * doc: update documentation of data simulation functions update @return description for `get_age_group()` update documentation files for - `generate_sim_data()` - `get_age_group()` - `get_sim_counts()` - `group_sim_data()` * doc: remove example for `get_age_group()` * refac: change name and output of `get_sim_prob` change name of `get_sim_prob` to `get_sim_n_seropositive`. The function now returns a dataframe containing the exposure ages and the number of seropositive cases for each age. * doc: add example for `get_sim_counts()` * Revert "refac: change name and output of `get_sim_prob`" This reverts commit 966e463. * refac: change name and output of `get_sim_prob()` change name of `get_sim_prob()` to `get_sim_probability`. The output of the function is now a dataframe. * refac: change name and output of `get_sim_counts` change name of function `get_sim_counts` to `get_sim_n_seropositive` and update the documentation accordingly. minor correction to documentation of `get_sim_probability` * doc: minor correction to function documentation minor correction to function `get_age_group` documentation * doc: remove function `group_sim_data` from export remove function `group_sim_data` from export and the corresponding example * refac: simplify function `get_age_group` Remove unnecessary parameters from `get_age_group`. Now the function takes an age vector as input rather than a dataframe containing an specific age column. * test: remove data writing from test Remove data writing from `test_simulate_data.R` as well as the corresponding .csv files. * clean: remove unused data paths from test Remove unused data paths from `test_simulate_data` * test: add tests for `get_sim_` functionalities Add tests for `get_sim_probability` and `get_sim_n_seropositive` * test(refac): modify test for data sim functions Modify test for `generate_sim_data` and `group_sim_data` functions. Remove unnecessary model running. Remove `expect_doppleganger` tests. * add test for values from `get_sim_probability` Add `get_sim_probability` to export to enable testing. Test the values of the probabilities. * test: add statistical test for `generate_sim_data` The idea of the test is to make sure that the foi trend used to simulate the data is in the confidence interval of a suitable model. Add possibility to test for: - constant FoI - smooth-descendent FoI Minor clean up of `plot_foi`. * add pracma to dependencies * add parameter descriptions in `generate_sim_data` * doc: update documentation * test: add analytical test for constant foi Add analytical test for constant foi for large sample sizes. * test: add test for data simulation with time-varying foi * small syntax corrections in test_sim_data.R --------- Co-authored-by: ntorresd <[email protected]> Co-authored-by: Nicolás Torres Domínguez <[email protected]> Co-authored-by: Jaime Pavlich-Mariscal <[email protected]> Co-authored-by: James Azam <[email protected]>
- Loading branch information