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

Merge dev into main #127

Merged
merged 22 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0793b5e
remove serodata .Rdata and .Rd files
ntorresd Aug 14, 2023
4f3ec6e
remove R/serodata.R
ntorresd Aug 14, 2023
5e2c6e1
doc: update functions documentation replacing for in examples
ntorresd Aug 14, 2023
bc1cd01
doc: update README and vignettes
ntorresd Aug 14, 2023
f18911f
fix: minor correction to test_modelling
ntorresd Aug 14, 2023
414165d
feat: add function `get_foi_central_estimates()` to the modelling mod…
ntorresd Aug 15, 2023
58ae494
fix: minor corrections to tests according to commit 052c90c
ntorresd Aug 15, 2023
42f861c
fix: change to in model_comparison
ntorresd Aug 15, 2023
acd1595
doc: add documentation file for
ntorresd Aug 15, 2023
4bdd021
doc: minor correction to documentation
ntorresd Aug 15, 2023
d6a4d2c
refac: updates
ntorresd Aug 15, 2023
cef2c1d
refac: reduce the output of
ntorresd Aug 15, 2023
ae2e715
fix(tests): change storing format of model object files from .json t…
ntorresd Aug 15, 2023
d5d57f0
Fixes #115 (#116)
jpavlich Sep 7, 2023
d69d24a
82 tidyverse dependency (#120)
jpavlich Sep 15, 2023
8a419d4
refac: `fit_seromodel` returns stanfit object (#117)
ntorresd Sep 27, 2023
a5fd750
doc: parameter description correction
ntorresd Sep 28, 2023
ba190dc
doc: minor corrections to functions documentation
ntorresd Sep 28, 2023
cd1834c
fix: add input check for `age_mean_f` column (#123)
ntorresd Oct 2, 2023
3155cc6
Add input validation (#92)
jamesmbaazam Oct 5, 2023
bf05a4c
Remove test_visualisation and related files
Bisaloo Oct 10, 2023
25f0ca1
Convert logo to png
Bisaloo Oct 10, 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
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main, master, dev]
pull_request:
branches: [main, master]
branches: [main, master, dev]

name: R-CMD-check

Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ LazyData: true
RoxygenNote: 7.2.3
Depends:
R (>= 3.5.0)
Imports:
Imports:
checkmate,
methods,
Rcpp (>= 0.12.0),
RcppParallel (>= 5.0.1),
Expand All @@ -57,7 +58,6 @@ Imports:
purrr,
qtl,
reshape2,
tidyverse,
usethis,
vdiffr (>= 1.0.0)
LinkingTo:
Expand Down
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

export(extract_seromodel_summary)
export(fit_seromodel)
export(get_exposure_ages)
export(get_cohort_ages)
export(get_exposure_matrix)
export(get_foi_central_estimates)
export(get_prev_expanded)
export(get_table_rhats)
export(plot_foi)
Expand Down
25 changes: 13 additions & 12 deletions R/model_comparison.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#' Method for extracting a dataframe containing the R-hat estimates for a given serological model
#'
#' This method relies in the function \link[bayesplot]{rhat} to extract the R-hat estimates of the serological model object
#' \code{seromodel_object} and returns a table a dataframe with the estimates for each year of birth.
#' @param seromodel_object seromodel_object
#' \code{seromodel_object} and returns a table a dataframe with the estimates for each year of birth.
#' @inheritParams get_foi_central_estimates
#' @return rhats table
#' @examples
#' \dontrun{
#' data("serodata")
#' data_test <- prepare_serodata(serodata = serodata)
#' model_constant <- run_seromodel(serodata = data_test,
#' foi_model = "constant",
#' data(chagas2012)
#' serodata <- prepare_serodata(serodata = chagas2012)
#' model_constant <- run_seromodel(serodata = serodata,
#' foi_model = "constant",
#' n_iters = 1500)
#' get_table_rhats(model_object = model_constant)
#' }
#' cohort_ages <- get_cohort_ages(serodata)
#' get_table_rhats(seromodel_object = model_constant,
#' cohort_ages = cohort_ages)
#' @export
get_table_rhats <- function(seromodel_object) {
rhats <- bayesplot::rhat(seromodel_object$fit, "foi")
get_table_rhats <- function(seromodel_object,
cohort_ages) {
rhats <- bayesplot::rhat(seromodel_object, "foi")

if (any(is.nan(rhats))) {
rhats[which(is.nan(rhats))] <- 0
}
model_rhats <- data.frame(year = seromodel_object$exposure_years, rhat = rhats)
model_rhats <- data.frame(year = cohort_ages$birth_year, rhat = rhats)
model_rhats$rhat[model_rhats$rhat == 0] <- NA

return(model_rhats)
Expand Down
Loading
Loading