Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev fix pr 1 #80

Merged
merged 233 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
233 commits
Select commit Hold shift + click to select a range
eae1649
Documentation of the visualisation and modelling modules
megamezl Jan 20, 2023
4ac542d
automatic documentation of the visualisation and modeling modules
megamezl Jan 24, 2023
6acbbde
Merge pull request #6 from TRACE-LAC/dev-docmodel-miguel
ntorresd Jan 24, 2023
9f0e997
minor changes to the documentation. Typos and minor bugs corrected.
ntorresd Jan 24, 2023
05bbbf0
feat: define a preliminar version of the minimal dataset needed to us…
ntorresd Jan 25, 2023
1966598
Merge pull request #7 from TRACE-LAC/dev-data_test-nicolas
ntorresd Jan 25, 2023
60b39e2
fix: remove unused functions from all modules in preparation for a co…
ntorresd Jan 25, 2023
1d181a6
Merge branch 'main' into dev
ntorresd Jan 25, 2023
bcf6406
fix: prepare data_test for compilation of the package
ntorresd Jan 25, 2023
902f4b2
Dev compilation test nicolas (#10)
ntorresd Jan 26, 2023
f2ccfbf
create template of vignette
tracelac Jan 26, 2023
7021996
delete temporary files
tracelac Jan 26, 2023
f5201ed
testing vignette
zmcucunuba Jan 26, 2023
1f23090
vignette's test
zmcucunuba Jan 26, 2023
1682905
adding workflows sca and r-cmd-check
GeraldineGomez Jan 27, 2023
f4f4489
adding workflows sca and r-cmd-check (#11)
GeraldineGomez Jan 27, 2023
09e884a
Static code review with lintr in package modules
megamezl Jan 29, 2023
8b64fc1
Merge branch 'dev-feature-review-sca' of github.com:TRACE-LAC/serofoi…
megamezl Jan 29, 2023
3a29639
Merge pull request #12 from TRACE-LAC/dev
zmcucunuba Jan 29, 2023
2f3d2e5
changing descriotion
zmcucunuba Jan 29, 2023
dae111f
adding info into run-model function
zmcucunuba Jan 29, 2023
87f05c6
adding a script for model comparison
zmcucunuba Jan 29, 2023
6c22d3c
adding a script for model comparison
zmcucunuba Jan 29, 2023
f5511aa
adding a script for model comparison
zmcucunuba Jan 29, 2023
57f6c47
adding a script for model comparison
zmcucunuba Jan 29, 2023
ed92ff7
adding a script for model comparison
zmcucunuba Jan 29, 2023
3ea2f67
adding a script for model comparison
zmcucunuba Jan 29, 2023
be4d0bd
adding a script for model comparison
zmcucunuba Jan 29, 2023
efb3f4c
returning logo
zmcucunuba Jan 29, 2023
cd45e35
adding a script for model comparison
zmcucunuba Jan 29, 2023
f45988f
adding a script for model comparison
zmcucunuba Jan 29, 2023
aed51a4
changing README.Rmd file
zmcucunuba Jan 29, 2023
f7c8877
changing README.Rmd file
zmcucunuba Jan 29, 2023
df036d2
changing README.Rmd file
zmcucunuba Jan 29, 2023
1336ab8
changing README.Rmd file
zmcucunuba Jan 29, 2023
f2e2b90
adding plots to the readme file
zmcucunuba Jan 29, 2023
2e170a8
adding plots to the readme file
zmcucunuba Jan 29, 2023
17462df
adding function for plotting raw seroprevalence data
zmcucunuba Jan 29, 2023
953fdc9
adding the packages name standart
GeraldineGomez Jan 30, 2023
0651d77
adding data reference for dplyr
GeraldineGomez Jan 30, 2023
5ea0986
update function documentation
GeraldineGomez Jan 30, 2023
0912ec4
Static code analysis for package modules
megamezl Jan 30, 2023
420ebaa
Static code analysis for the modeling module
megamezl Jan 30, 2023
c0a7178
Merge pull request #13 from TRACE-LAC/dev-zulma
ntorresd Jan 31, 2023
b21ad21
Clean test/test_comparison.R. Add a warning for first compilation of …
ntorresd Jan 31, 2023
c62a760
Solve merge conflics with dev.
ntorresd Feb 2, 2023
45acd9e
Merge pull request #14 from TRACE-LAC/dev-feature-review-sca
ntorresd Feb 2, 2023
fd7af9e
fix: Calculate the binomial confidence interval from the raw seropre…
ntorresd Feb 2, 2023
9fe8545
Compilation test in test_plot_functions.R
ntorresd Feb 2, 2023
2e1f60b
minor changes before merging with dev
ntorresd Feb 2, 2023
59409bf
feat: Add function prepare_bin_data to seroprevalence_data module. Th…
ntorresd Feb 2, 2023
22029e2
minor changes before merging with dev
ntorresd Feb 2, 2023
ee1a3c8
Merge pull request #15 from TRACE-LAC/dev-plot-nicolas
zmcucunuba Feb 3, 2023
8de7010
fix: corrects the bin size in plot_seroprev(). Minor syntax changes.
ntorresd Feb 6, 2023
a8c5357
doc: Add the corresponding documentation for plot_seroprev() to READM…
ntorresd Feb 6, 2023
b20b214
Dev docu mg (#16)
megamezl Feb 7, 2023
86077cc
updating links of R-CMD check and Codecov test
GeraldineGomez Feb 14, 2023
0eebf7e
Dev doc nicolas (#18)
ntorresd Feb 14, 2023
e1bb4ff
updating package version and contributors
GeraldineGomez Feb 14, 2023
c9dd2e4
Dev doc nicolas (#20)
ntorresd Feb 15, 2023
d828465
Dev docker tests (#22)
jpavlich Feb 15, 2023
e4f3f5f
Now most examples run without errors. Those that not are temporarily …
jpavlich Feb 15, 2023
20f1e7c
Merge pull request #23 from TRACE-LAC/dev-examples
jpavlich Feb 15, 2023
37c81fe
Documentation of the seroprevalence_data and visualisation modules (#24)
megamezl Feb 16, 2023
2fb2b57
Added test functions for plots
jpavlich Feb 17, 2023
a7a00ba
doc: Update author's information in DESCRIPTION.
ntorresd Feb 17, 2023
d72d9a1
Added myself to contributors
jpavlich Feb 17, 2023
3561d97
Removed test/ folder
jpavlich Feb 17, 2023
974f178
Added a TODO
jpavlich Feb 17, 2023
289dec9
More automatic tests
jpavlich Feb 17, 2023
9ca3564
Merge remote-tracking branch 'origin/dev' into dev-misc-fixes
jpavlich Feb 17, 2023
cc4adf2
Merge pull request #26 from TRACE-LAC/dev-misc-fixes
jpavlich Feb 17, 2023
e6bdc9b
Update .gitignore
jpavlich Feb 17, 2023
d010f59
Fixed save_or_load_model to avoid DLL Bug
jpavlich Feb 17, 2023
b442335
same
jpavlich Feb 17, 2023
fb5133e
dontrun some examples
jpavlich Feb 17, 2023
b2d9fad
same
jpavlich Feb 17, 2023
8a98edb
misc changes
jpavlich Feb 17, 2023
bd761ba
Some corrections to the documentation
megamezl Feb 19, 2023
0e5c2de
R CMD Check now seems to be working without errors (hopefully :)
jpavlich Feb 20, 2023
c4bee5e
Some fixes to module documentation
megamezl Feb 21, 2023
7a8ebc7
R CMD Check works without errors (locally)
jpavlich Feb 21, 2023
84a2488
Merge pull request #27 from TRACE-LAC/dev-fix-dll-bug
jpavlich Feb 21, 2023
530bd8c
Merge pull request #28 from TRACE-LAC/dev-docu-mg
megamezl Feb 21, 2023
6d874b9
doc: review and correct visualization module documentation.
ntorresd Feb 21, 2023
03cdfef
doc: minor changes to seroprevalence_data module documentation.
ntorresd Feb 21, 2023
afd6950
Add function to generate comparative plot of the models (#29)
ntorresd Feb 21, 2023
25a12b7
Minor changes to individual_models .svg files.
ntorresd Feb 21, 2023
daba64a
Testing all platforms in github actions
jpavlich Feb 22, 2023
f8925ee
testing coverage
jpavlich Feb 22, 2023
791dd87
added missing BH dep to make it work on windows
jpavlich Feb 22, 2023
27cd3df
added more missing deps
jpavlich Feb 22, 2023
f67f7aa
doc: minor change to fit_model function documentation.
ntorresd Feb 22, 2023
0499bbd
add back the data folder to use mydata object when importing the libr…
ntorresd Feb 22, 2023
e26e24f
doc: generate documentation with devtools::document().
ntorresd Feb 22, 2023
af2fa48
updated RMD Check tasks for vscode and docker to make them more simil…
jpavlich Feb 22, 2023
e05a9f1
Added some deps to avoid warnings in R CMD Check
jpavlich Feb 22, 2023
4a237b3
Updated man pages with roxygen2
jpavlich Feb 22, 2023
56c2a51
Merge remote-tracking branch 'origin/dev' into bugfixes-jaime
jpavlich Feb 22, 2023
a83fc82
Added dep to TBB to hopefully fix compilation problems in windows
jpavlich Feb 22, 2023
a7091d0
Upgraded rstan to v2.26.11. Added required TBB dep
jpavlich Feb 22, 2023
0aa8974
Updated SVGs and CSVs to match results from rstan v2.26.11
jpavlich Feb 22, 2023
3387a56
Added mc-stan as extra repo to support rstan 2.26.11
jpavlich Feb 24, 2023
fd423a7
Misc fixes
jpavlich Feb 27, 2023
44dbd0f
Rename plot_models_list to plot_seroprev_models_grid.
ntorresd Feb 28, 2023
eae8143
doc: add documentation for plot_seroprev_models_grid function.
ntorresd Feb 28, 2023
0eeb3e9
Merge commit 'eae814348f9f15f7b276e04f823fce2fd5eb81ae' into bugfixes…
jpavlich Mar 1, 2023
7512588
Added more docker-related funcionality
jpavlich Mar 1, 2023
a02b415
Added script to clean SVGs and CSVs when there rstan needs to be upda…
jpavlich Mar 1, 2023
ab48434
misc changes
jpavlich Mar 1, 2023
bfb25c8
Merge pull request #30 from TRACE-LAC/bugfixes-jaime
jpavlich Mar 1, 2023
72d5d2a
Dev webrd (#32)
ntorresd Mar 1, 2023
b63fdd1
dependencie rstan (>= 2.26.11) changed to rstan (>= 2.21.1). 2.26.11 …
ntorresd Mar 1, 2023
9b7a2fa
Back to rstan (>= 2.26.11),
jpavlich Mar 1, 2023
338a4ee
Adding multiplatform tests
jpavlich Mar 1, 2023
7f5111b
test: run all tests for the new test dataset.
ntorresd Mar 1, 2023
7ff31b4
update plot_functions test figures.
ntorresd Mar 1, 2023
d592c3e
doc: minor change to plot_seroprev_models_grid documentation.
ntorresd Mar 2, 2023
562f155
style: Update the name of the functions to specify they refer to sero…
ntorresd Mar 2, 2023
590b265
style: mydata changed to serodata. The current dataset is chagas2012.…
ntorresd Mar 2, 2023
582f009
update tdata_test dataset. The dataset now corresponds to chagas2012.…
ntorresd Mar 2, 2023
bb9ce40
Merge remote-tracking branch 'origin/dev' into morebugfixes-jaime
jpavlich Mar 3, 2023
ce34ac8
removed unused code
jpavlich Mar 3, 2023
24681a9
Temporarily skipping tests on windows and mac, until we find an effic…
jpavlich Mar 3, 2023
ef9e5ef
branch change for testing
jpavlich Mar 3, 2023
d24d067
updated testing snapshots
jpavlich Mar 3, 2023
cba331b
misch changes
jpavlich Mar 3, 2023
d5b814c
added install deps task for vscode
jpavlich Mar 3, 2023
a8ecd96
Added TODOs
jpavlich Mar 3, 2023
1f9bb3d
Added missing deps
jpavlich Mar 3, 2023
6ab2d8c
Added missing testthat snapthots
jpavlich Mar 3, 2023
6465be6
Created new function `expect_similar_dataframes` to test dataframes u…
jpavlich Mar 3, 2023
0251c2c
Increased default tolerance to deal with rstan shenanigans
jpavlich Mar 3, 2023
48cd396
testing ci
jpavlich Mar 6, 2023
6cdfb8d
Skipping these tests on CI
jpavlich Mar 6, 2023
e0edbcc
Misc changes
jpavlich Mar 6, 2023
c4ee065
Merge pull request #33 from TRACE-LAC/morebugfixes-jaime
jpavlich Mar 6, 2023
9288f0a
Temporary changes while we improve tests
jpavlich Mar 6, 2023
3fbf372
fix: solve minor typo in the name of function prepare_seroprev_data.
ntorresd Mar 7, 2023
a6c2370
Dev zulma vignette (#34)
ntorresd Mar 7, 2023
4152953
Dev webrd (#35)
ntorresd Mar 7, 2023
4951388
fix: function get_exposure_years was returning ages that were not con…
ntorresd Mar 7, 2023
ea80c02
fix: description typo.
ntorresd Mar 7, 2023
ff86e6f
change the name of get_exposure_years to get_exposure_ages (for lack …
ntorresd Mar 7, 2023
2145eeb
fix: updating functions and variables names in the vignettes files. T…
ntorresd Mar 8, 2023
382c71a
Removed dev from actions scripts
jpavlich Mar 8, 2023
9479059
Updated badges in README.Rmd. Updated README.md with latest changes f…
jpavlich Mar 8, 2023
550995d
fix: add default value for seroprev_data to the prepare_seroprev_data…
ntorresd Mar 8, 2023
d4e487c
Update prepare_seroprev_data documentation.
ntorresd Mar 8, 2023
00b83d6
doc: minor corrections to simulated_data.Rmd.
ntorresd Mar 8, 2023
75b2596
webpage publication
ntorresd Mar 8, 2023
475aefe
fixed bug "recompiling to avoid crashing R session"
jpavlich Mar 14, 2023
ac5824f
Update use_cases.Rmd
ntorresd Mar 14, 2023
0c01d0c
Add simulated data generation (#36)
ntorresd Mar 21, 2023
cbb3e86
Solve conflicts dev -> main
ntorresd Mar 22, 2023
44d4a4b
remove unused man files.
ntorresd Mar 22, 2023
78f883f
Merge minor changes main -> dev
ntorresd Mar 22, 2023
badbe6c
refac: Removed functions still in developing stage that will be added…
ntorresd Mar 25, 2023
0405186
refac: Remove redundant tests and refactorize test_indivudual_models …
ntorresd Mar 25, 2023
6b8abf0
Remove unused file R/test_vignettes.R
ntorresd Mar 25, 2023
17a5bf9
Remove unused data files.
ntorresd Mar 25, 2023
9abae2e
Minor changes to vignettes.
ntorresd Mar 25, 2023
7d6461b
Remove cowplot and pracma from dependencies and unnecessary test file…
ntorresd Mar 25, 2023
27a574c
chore: change seroprev_model to seromodel.
ntorresd Mar 27, 2023
40d2d46
chore: change seroprev_data to serodata.
ntorresd Mar 27, 2023
37df159
chore: change model_object for seromodel_object.
ntorresd Mar 27, 2023
358ebfe
Add option print_summary with deaful TRUE to run_seromodel (modelling…
ntorresd Mar 27, 2023
7e22689
doc: update documentation for model_comparison and modelling modules.
ntorresd Mar 27, 2023
86ef54d
doc: update documentation for visualization and modelling seroprevale…
ntorresd Mar 27, 2023
1d47ee3
activate test-coverage github action for dev branch
ntorresd Mar 28, 2023
7b7e318
run models inside the for loop in test_models instead of using lapply…
ntorresd Mar 28, 2023
6e35e64
minor changes to documentation in all modules
ntorresd Mar 28, 2023
c6ea05a
Add back cowplot dependencie since its used for some plotting functions
ntorresd Mar 28, 2023
bcdb042
change models names constant_foi_bi -> constant, continuous_foi_norma…
ntorresd Mar 29, 2023
4dea3e7
change models names constant_foi_bi -> constant, continuous_foi_norma…
ntorresd Mar 29, 2023
1f8f54d
refac: Divide test_models into three different tests (one for each cu…
ntorresd Mar 29, 2023
9dc8c24
solve merge conflics dev -> main
ntorresd Mar 29, 2023
cab4d49
Dev datasets (#40)
ntorresd Mar 30, 2023
c5ea73d
Dev plot foi (#41)
ntorresd Apr 3, 2023
83db5c1
add the simulated datasets simdata_constant, simdata_sw_dec and simda…
ntorresd Apr 3, 2023
a5906f0
added scripts to test exceptions of visualisation module functions
Apr 4, 2023
761747f
Dev vignettes: add contents to vignettes articles (#42)
ntorresd Apr 4, 2023
d8d2dde
doc: add updated README.md file
ntorresd Apr 4, 2023
1959181
vignettes publication test
ntorresd Apr 4, 2023
5724246
vignettes publication test
ntorresd Apr 4, 2023
b5558d6
solve minor conflict in get_prev_expanded function documentation
ntorresd Apr 4, 2023
42ad09f
remove docs/ from .gitignore to test website publication
ntorresd Apr 4, 2023
e074ca5
add doc/ files generated by pkgdown::build_site function
ntorresd Apr 4, 2023
c620c41
remove doc/ folder
ntorresd Apr 4, 2023
7c4f8f4
vignettes publication test: add dev to push activation branches in pk…
ntorresd Apr 4, 2023
2fdea8c
Deploying to dev from @ TRACE-LAC/serofoi@7c4f8f4b22a5c1556d49ae32edb…
ntorresd Apr 4, 2023
4e947ec
website publication test: ignore docs folder. Remove dev from push tr…
ntorresd Apr 4, 2023
4f33beb
doc: minor corrections to vignettes/references.bib
ntorresd Apr 5, 2023
4c16cd5
remove skip_on_ci() from all tests
ntorresd Apr 6, 2023
e8a4de2
Remove files generated by pkgdown (#45)
Bisaloo Apr 6, 2023
896e7a6
merge dev -> dev-tests-mg. Solve conflicts
ntorresd Apr 18, 2023
a342425
Issue 47: fix inflexible age group structure definition for visualiza…
ntorresd Apr 19, 2023
54d3bf3
Merge branch 'main' into dev
ntorresd Apr 19, 2023
554e89a
Issue 47: fix inflexible age group structure definition for visualiza…
ntorresd Apr 19, 2023
4180764
Update _pkgdown.yml
ntorresd Apr 4, 2023
e7eccca
Dev (#44)
ntorresd Apr 4, 2023
a4d53fd
Remove files generated by pkgdown (#45)
Bisaloo Apr 6, 2023
efde61f
creating scripts for module tests
Apr 22, 2023
1ebdb18
refac: unify individual models tests into a single test for the model…
ntorresd Apr 26, 2023
bfc1eb4
add option bin_data to prepare_serodata (modelling) and plot_seroprev…
ntorresd May 2, 2023
e984f61
test for the modelling module now compares the results with a standar…
ntorresd May 2, 2023
dc0234f
add models_serialization.R to tests/testthat. This script saves the m…
ntorresd May 2, 2023
01384cd
refactorize test for the visualization model reading the models from …
ntorresd May 2, 2023
ed9dd29
Merge branch 'main' into dev-tests-mg
ntorresd May 2, 2023
286c6f2
solving conflics with dev
ntorresd May 2, 2023
bf1a88b
Added missing deps
jpavlich May 5, 2023
054fee4
Added missing newline at the end
jpavlich May 5, 2023
160f875
Added missing data
jpavlich May 5, 2023
43323ca
misc fixes
jpavlich May 5, 2023
281c7db
moved RDS files outside data/ dir to comply with r-cmd-check
jpavlich May 5, 2023
2ac96bb
Removed r-cmd-check warnings
jpavlich May 5, 2023
4b6a3e1
Merge pull request #53 from epiverse-trace/remove-r-cmd-warnings
jpavlich May 5, 2023
061ddab
Removed save_or_load_model, since rstantools does that job now
jpavlich May 12, 2023
70072fb
migrated to rstantools
jpavlich May 12, 2023
53b3937
added dev to trigger action
jpavlich May 12, 2023
9376869
Merge pull request #54 from epiverse-trace/migrate-to-rstantools
jpavlich May 12, 2023
de932d4
fix: solve conflicts from dev-fix-pr-1 <- main
ntorresd Jun 27, 2023
ed861cc
fix: update config R-CMD-check.yaml adding devel and oldrel-1 librari…
ntorresd Jun 27, 2023
20f87de
Revert "fix: update config R-CMD-check.yaml adding devel and oldrel-1…
ntorresd Jun 27, 2023
2152b0e
fix: update config R-CMD-check.yaml removing release libraries for u…
ntorresd Jun 27, 2023
6bd403d
add missing config files
sbfnk Jun 28, 2023
968f5f3
remove obsolete src dir
sbfnk Jun 28, 2023
d9e4839
add missing dependency lines
sbfnk Jun 28, 2023
7e2503b
update config R-CMD-check.yaml adding macos, windows and ubuntu-lates…
ntorresd Jun 28, 2023
e604284
remove stray line
sbfnk Jun 28, 2023
12438df
fix: small change to stanmodels.R (normal_log_model)
ntorresd Jun 28, 2023
e5cce4b
doc: minor correction to documentation. This addresses an R-CMD-check…
ntorresd Jun 29, 2023
378c24b
doc: minor correction to documentation. This addresses an R-CMD-check…
ntorresd Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, master, dev]
pull_request:
branches: [main, master]

Expand All @@ -18,11 +18,11 @@ jobs:
fail-fast: false
matrix:
config:
# - {os: macos-latest, r: 'release'}
# - {os: windows-latest, r: 'release'}
# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
# - {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
43 changes: 41 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ vignettes/*.pdf
.Rhistory


# RStudio Connect folder
rsconnect/

# Mac File
.DS_Store

Expand All @@ -53,5 +56,41 @@ _snaps/
!tests/testthat/_snaps
tests/testthat/Rplots.pdf
t,
tests/testthat/extdata/plots/actual/*.png
tests/testthat/extdata/dataframes/actual/*.csv


# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

inst/stan/*.rds

src/
53 changes: 31 additions & 22 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Authors@R:
),
person(
given = "Nicolás",
family = "T-Domínguez",
family = "T. Domínguez",
role = c("aut"),
email = "[email protected]",
comment = c(ORCID = "https://orcid.org/0009-0002-8484-1298")
Expand All @@ -38,38 +38,47 @@ LazyData: true
RoxygenNote: 7.2.3
Depends:
R (>= 3.5.0)
Imports:
config,
rstan (>= 2.21.1),
StanHeaders,
tidyverse,
reshape2,
bayesplot,
loo,
Hmisc,
Imports:
methods,
Rcpp (>= 0.12.0),
RcppParallel (>= 5.0.1),
rstan (>= 2.18.1),
rstantools (>= 2.3.1),
dplyr,
gsubfn,
usethis,
testthat (>= 3.0.0),
vdiffr (>= 1.0.0),
bayesplot,
config,
cowplot,
devtools,
methods,
Rcpp,
ggplot2,
BH,
RcppEigen,
RcppParallel,
gsubfn,
Hmisc,
jsonlite,
loo,
purrr,
cowplot
qtl,
reshape2,
tidyverse,
usethis,
vdiffr (>= 1.0.0)
LinkingTo:
BH (>= 1.66.0),
Rcpp (>= 0.12.0),
RcppEigen (>= 0.3.3.3.0),
RcppParallel (>= 5.0.1),
rstan (>= 2.18.1),
StanHeaders (>= 2.18.0)
Suggests:
knitr,
rmarkdown
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Config/Needs/website:
epiverse-trace/epiversetheme
VignetteBuilder: knitr
URL: https://trace-lac.github.io/serofoi/
Additional_repositories:
https://mc-stan.org/r-packages/
Config/testthat/edition: 3
Remotes:
tidyverse/purrr
Biarch: true
SystemRequirements: GNU make
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export(plot_seroprev_fitted)
export(prepare_bin_data)
export(prepare_serodata)
export(run_seromodel)
export(save_or_load_model)
import(Rcpp)
import(dplyr)
import(methods)
Expand All @@ -24,3 +23,4 @@ importFrom(graphics,text)
importFrom(rstan,sampling)
importFrom(stats,quantile)
importFrom(utils,read.table)
useDynLib(serofoi, .registration = TRUE)
1 change: 1 addition & 0 deletions R/chagas2012.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO Check if we really need to have the package `qtl` installed. Otherwise remove all entries of the form `see \code{\link[qtl]...`
#' Seroprevalence data on serofoi
#'
#' Data from a serological surveys
Expand Down
115 changes: 44 additions & 71 deletions R/modelling.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#' Function that runs the specified stan model for the Force-of-Infection and estimates de seroprevalence based on the result of the fit
#'
#' This function runs the specified model for the Force-of-Infection \code{foi_model} using the data froma seroprevalence survey
# TODO Complete @param documentation


#' Function that runs the specified stan model for the Force-of-Infection and estimates de seroprevalence based on the result of the fit
#'
#' This function runs the specified model for the Force-of-Infection \code{foi_model} using the data froma seroprevalence survey
#' \code{serodata} as the input data. See \link{fit_seromodel} for further details.
#'
#' @param serodata A data frame containing the data from a seroprevalence survey.
Expand Down Expand Up @@ -36,6 +39,7 @@
#' For further details refer to the \code{control} parameter in \link[rstan]{sampling} or \href{https://mc-stan.org/rstanarm/reference/adapt_delta.html}{here}.
#' @param m_treed Maximum tree depth for the binary tree used in the NUTS stan sampler. For further details refer to the \code{control} parameter in \link[rstan]{sampling}.
#' @param decades Number of decades covered by the survey data.
#' @param print_summary TBD
#' @return \code{seromodel_object}. An object containing relevant information about the implementation of the model. For further details refer to \link{fit_seromodel}.
#' @examples
#' \dontrun{
Expand Down Expand Up @@ -69,46 +73,11 @@ run_seromodel <- function(serodata,
return(seromodel_object)
}

# TODO The warning 'recompiling to avoid crashing R session' still appears when the function is run for a second time.
#' Function used to determine whether the stan model corresponding to the specified serological model has been already compiled or not
#'
#' This function determines whether the corresponding .RDS file of the selected model exists or not.
#' In case the .RDS file exists, it is read and returned; otherwise, the object model is created through the
#' \link[rstan]{stan_model} function, saved as an .RDS file and returned as the output of the function.
#' @param foi_model Name of the selected model. Current version provides three options:
#' \describe{
#' \item{\code{"constant"}}{Runs a constant model}
#' \item{\code{"tv_normal"}}{Runs a normal model}
#' \item{\code{"tv_normal_log"}}{Runs a normal logarithmic model}
#' }
#' @return \code{model}. The rstan model object corresponding to the selected model.
#' @examples
#' \dontrun{
#' model <- save_or_load_model(foi_model="constant")
#' }
#'
#' @export

save_or_load_model <- function(foi_model = "constant") {
base_path <- config::get("stan_models_base_path",
file = system.file("config.yml", package = "serofoi", mustWork = TRUE))
rds_path <- system.file(base_path, paste(foi_model, ".rds", sep = ""), package = getPackageName())
if (!file.exists(rds_path)) {
message(sprintf("\nNo rds file found for model %s. Compiling stan model...", foi_model))
}
stan_path <- system.file(base_path, paste(foi_model, ".stan", sep = ""), package = getPackageName())

model <- rstan::stan_model(stan_path, auto_write = TRUE)

return(model)
}


#' Function that fits the selected model to the specified seroprevalence survey data
#'
#' This function fits the specified model \code{foi_model} to the serological survey data \code{serodata}
#' by means of the \link[rstan]{sampling} method. The function determines whether the corresponding stan model
#' object needs to be compiled by means of the function \link{save_or_load_model}.
#'
#' This function fits the specified model \code{foi_model} to the serological survey data \code{serodata}
#' by means of the \link[rstan]{sampling} method. The function determines whether the corresponding stan model
#' object needs to be compiled by rstan.
#' @param serodata A data frame containing the data from a seroprevalence survey. For further details refer to \link{run_seromodel}.
#' @param foi_model Name of the selected model. Current version provides three options:
#' \describe{
Expand Down Expand Up @@ -160,7 +129,7 @@ fit_seromodel <- function(serodata,
m_treed = 10,
decades = 0) {
# TODO Add a warning because there are exceptions where a minimal amount of iterations is needed
model <- save_or_load_model(foi_model)
model <- stanmodels[[foi_model]]
exposure_ages <- get_exposure_ages(serodata)
exposure_years <- (min(serodata$birth_year):serodata$tsur[1])[-1]
exposure_matrix <- get_exposure_matrix(serodata)
Expand Down Expand Up @@ -280,7 +249,7 @@ fit_seromodel <- function(serodata,

#' Function that generates an atomic vector containing the corresponding exposition years of a serological survey
#'
#' This function generates an atomic vector containing the exposition years corresponding to the specified serological survey data \code{serodata}.
#' This function generates an atomic vector containing the exposition years corresponding to the specified serological survey data \code{serodata}.
#' The exposition years to the disease for each individual corresponds to the time from birth to the moment of the survey.
#' @param serodata A data frame containing the data from a seroprevalence survey. This data frame must contain the year of birth for each individual (birth_year) and the time of the survey (tsur). birth_year can be constructed by means of the \link{prepare_serodata} function.
#' @return \code{exposure_ages}. An atomic vector with the numeration of the exposition years in serodata
Expand Down Expand Up @@ -321,15 +290,15 @@ get_exposure_matrix <- function(serodata) {

#' Method to extact a summary of the specified serological model object
#'
#' This method extracts a summary corresponding to a serological model object that contains information about the original serological
#' survey data used to fit the model, such as the year when the survey took place, the type of test taken and the corresponding antibody,
#' as well as information about the convergence of the model, like the expected log pointwise predictive density \code{elpd} and its
#' This method extracts a summary corresponding to a serological model object that contains information about the original serological
#' survey data used to fit the model, such as the year when the survey took place, the type of test taken and the corresponding antibody,
#' as well as information about the convergence of the model, like the expected log pointwise predictive density \code{elpd} and its
#' corresponding standar deviation.
#' @param seromodel_object \code{seromodel_object}. An object containing relevant information about the implementation of the model.
#' @param seromodel_object \code{seromodel_object}. An object containing relevant information about the implementation of the model.
#' Refer to \link{fit_seromodel} for further details.
#' @return \code{model_summary}. Object with a summary of \code{seromodel_object} containing the following:
#' \tabular{ll}{
#' \code{foi_model} \tab Name of the selected model. For further details refer to \link{save_or_load_model}. \cr \tab \cr
#' \code{foi_model} \tab Name of the selected model. \cr \tab \cr
#' \code{data_set} \tab Seroprevalence survey label.\cr \tab \cr
#' \code{country} \tab Name of the country were the survey was conducted in. \cr \tab \cr
#' \code{year} \tab Year in which the survey was conducted. \cr \tab \cr
Expand Down Expand Up @@ -385,14 +354,15 @@ extract_seromodel_summary <- function(seromodel_object) {
return(model_summary)
}


#' Function that generates an object containing the confidence interval based on a
# TODO Complete @param documentation
#' Function that generates an object containing the confidence interval based on a
#' Force-of-Infection fitting
#'
#' This function computes the corresponding binomial confidence intervals for the obtained prevalence based on a fitting
#' of the Force-of-Infection \code{foi} for plotting an analysis purposes.
#' @param serodata A data frame containing the data from a seroprevalence survey. For further details refer to \link{run_seromodel}.
#' of the Force-of-Infection \code{foi} for plotting an analysis purposes.
#' @param foi Object containing the information of the force of infection. It is obtained from \code{rstan::extract(seromodel_object$fit, "foi", inc_warmup = FALSE)[[1]]}.
#' @param serodata A data frame containing the data from a seroprevalence survey. For further details refer to \link{run_seromodel}.
#' @param bin_data TBD
#' @return \code{prev_final}. The expanded prevalence data. This is used for plotting purposes in the \code{visualization} module.
#' @examples
#' \dontrun{
Expand All @@ -404,8 +374,10 @@ extract_seromodel_summary <- function(seromodel_object) {
#' }
#' @export
get_prev_expanded <- function(foi,
serodata) {
serodata,
bin_data = FALSE) {
dim_foi <- dim(foi)[2]
# TODO: check whether this conditional is necessary
if (dim_foi < 80) {
oldest_year <- 80 - dim_foi + 1
foin <- matrix(NA, nrow = dim(foi)[1], 80)
Expand Down Expand Up @@ -438,7 +410,7 @@ get_prev_expanded <- function(foi,
medianv <- apply(prev_pn, 2, function(x) quantile(x, 0.5))

predicted_prev <- data.frame(
age = 1:80,
age = 1:age_max,
predicted_prev = medianv,
predicted_prev_lower = lower,
predicted_prev_upper = upper
Expand All @@ -460,22 +432,23 @@ get_prev_expanded <- function(foi,
observed_prev,
by = "age",
all.x = TRUE) %>% dplyr::mutate(survey = serodata$survey[1])

# I added this here for those cases when binned is prefered for plotting
if (serodata$age_max[1] - serodata$age_min[1] < 3) {
xx <- prepare_bin_data(serodata)
prev_final <-
base::merge(prev_expanded, xx, by = "age", all.x = TRUE)
} else {
prev_final <- prev_expanded %>% dplyr::mutate(
cut_ages = "original",
bin_size = .data$sample_by_age,
bin_pos = .data$positives,
p_obs_bin = .data$prev_obs,
p_obs_bin_l = .data$prev_obs_lower,
p_obs_bin_u = .data$prev_obs_upper
)
if (bin_data) {
# I added this here for those cases when binned is prefered for plotting
if (serodata$age_max[1] - serodata$age_min[1] < 3) {
xx <- prepare_bin_data(serodata)
prev_expanded <-
base::merge(prev_expanded, xx, by = "age", all.x = TRUE)
} else {
prev_expanded <- prev_expanded %>% dplyr::mutate(
cut_ages = "original",
bin_size = .data$sample_by_age,
bin_pos = .data$positives,
p_obs_bin = .data$prev_obs,
p_obs_bin_l = .data$prev_obs_lower,
p_obs_bin_u = .data$prev_obs_upper
)
}
}

return(prev_final)
return(prev_expanded)
}
21 changes: 21 additions & 0 deletions R/serofoi-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#' The 'serofoi' package.
#'
#' @description A DESCRIPTION OF THE PACKAGE
#'
#' @docType package
#' @name serofoi-package
#' @aliases serofoi
#' @useDynLib serofoi, .registration = TRUE
#' @import dplyr
#' @importFrom dplyr %>%

#' @import methods
#' @import Rcpp
#' @importFrom rstan sampling
#' @importFrom graphics text
#' @importFrom utils read.table
#' @importFrom stats quantile
#' @references
#' Stan Development Team (NA). RStan: the R interface to Stan. R package version 2.26.22. https://mc-stan.org
#'
NULL
Loading