From 80bbc2d3c02d7e7f4feaff0a0024d6e115d0c055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JAIME=20ANDR=C3=89S=20PAVLICH=20MARISCAL?= Date: Fri, 5 May 2023 10:57:57 -0500 Subject: [PATCH 1/2] moved RDS files outside data/ dir to comply with r-cmd-check --- {data => inst/extdata}/chagas2012.RDS | Bin {data => inst/extdata}/chik2015.RDS | Bin {data => inst/extdata}/serodata.RDS | Bin {data => inst/extdata}/simdata_constant.RDS | Bin {data => inst/extdata}/simdata_large_epi.RDS | Bin {data => inst/extdata}/simdata_sw_dec.RDS | Bin {data => inst/extdata}/veev2012.RDS | Bin 7 files changed, 0 insertions(+), 0 deletions(-) rename {data => inst/extdata}/chagas2012.RDS (100%) rename {data => inst/extdata}/chik2015.RDS (100%) rename {data => inst/extdata}/serodata.RDS (100%) rename {data => inst/extdata}/simdata_constant.RDS (100%) rename {data => inst/extdata}/simdata_large_epi.RDS (100%) rename {data => inst/extdata}/simdata_sw_dec.RDS (100%) rename {data => inst/extdata}/veev2012.RDS (100%) diff --git a/data/chagas2012.RDS b/inst/extdata/chagas2012.RDS similarity index 100% rename from data/chagas2012.RDS rename to inst/extdata/chagas2012.RDS diff --git a/data/chik2015.RDS b/inst/extdata/chik2015.RDS similarity index 100% rename from data/chik2015.RDS rename to inst/extdata/chik2015.RDS diff --git a/data/serodata.RDS b/inst/extdata/serodata.RDS similarity index 100% rename from data/serodata.RDS rename to inst/extdata/serodata.RDS diff --git a/data/simdata_constant.RDS b/inst/extdata/simdata_constant.RDS similarity index 100% rename from data/simdata_constant.RDS rename to inst/extdata/simdata_constant.RDS diff --git a/data/simdata_large_epi.RDS b/inst/extdata/simdata_large_epi.RDS similarity index 100% rename from data/simdata_large_epi.RDS rename to inst/extdata/simdata_large_epi.RDS diff --git a/data/simdata_sw_dec.RDS b/inst/extdata/simdata_sw_dec.RDS similarity index 100% rename from data/simdata_sw_dec.RDS rename to inst/extdata/simdata_sw_dec.RDS diff --git a/data/veev2012.RDS b/inst/extdata/veev2012.RDS similarity index 100% rename from data/veev2012.RDS rename to inst/extdata/veev2012.RDS From ea1662ac6185d34967233eda57edb601e7b3537e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JAIME=20ANDR=C3=89S=20PAVLICH=20MARISCAL?= Date: Fri, 5 May 2023 11:46:25 -0500 Subject: [PATCH 2/2] Removed r-cmd-check warnings --- DESCRIPTION | 3 ++- R/chagas2012.R | 1 + R/modelling.R | 9 +++++++-- R/seroprevalence_data.R | 6 +++++- R/visualisation.R | 12 ++++++++++-- man/get_prev_expanded.Rd | 2 ++ man/plot_foi.Rd | 4 ++++ man/plot_info_table.Rd | 2 +- man/plot_seromodel.Rd | 4 ++++ man/prepare_serodata.Rd | 4 +++- man/run_seromodel.Rd | 2 ++ 11 files changed, 41 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7d3cd7f0..9a8dccfe 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,7 +59,8 @@ Imports: RcppParallel, purrr, cowplot, - jsonlite + jsonlite, + qtl Suggests: knitr, rmarkdown diff --git a/R/chagas2012.R b/R/chagas2012.R index e58bc111..ac00f646 100644 --- a/R/chagas2012.R +++ b/R/chagas2012.R @@ -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 diff --git a/R/modelling.R b/R/modelling.R index 68756b36..1629ff74 100644 --- a/R/modelling.R +++ b/R/modelling.R @@ -1,3 +1,6 @@ + # 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 @@ -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{ @@ -385,14 +389,15 @@ extract_seromodel_summary <- function(seromodel_object) { return(model_summary) } - +# 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}. #' @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{ diff --git a/R/seroprevalence_data.R b/R/seroprevalence_data.R index 29352522..f4168cfe 100644 --- a/R/seroprevalence_data.R +++ b/R/seroprevalence_data.R @@ -1,3 +1,6 @@ +# TODO Complete @param documentation + + #' Function that prepares the data from a serological survey for modelling #' #' This function adds the necessary additional variables to the given dataset \code{serodata} corresponding to a serological survey. @@ -14,7 +17,8 @@ #' \code{test} \tab The type of test taken \cr \tab \cr #' \code{antibody} \tab antibody \cr \tab \cr #' } -#' @param alpha probability of a type I error. For further details refer to \link{Hmisc::binconf}. +#' @param alpha probability of a type I error. For further details refer to \link[Hmisc]{binconf}. +#' @param add_age_mean_f TBD #' @return serodata with additional columns necessary for the analysis. These columns are: #' \tabular{ll}{ #' \code{age_mean_f} \tab Floor value of the average between age_min and age_max \cr \tab \cr diff --git a/R/visualisation.R b/R/visualisation.R index 33be5245..26f7fd81 100644 --- a/R/visualisation.R +++ b/R/visualisation.R @@ -119,6 +119,8 @@ plot_seroprev_fitted <- function(seromodel_object, return(prev_plot) } +# TODO Complete @param documentation + #' Function that generates a Force-of-Infection plot corresponding to the specified fitted serological model #' #' This function generates a Force-of-Infection plot from the results obtained by fitting a serological model. @@ -126,6 +128,8 @@ plot_seroprev_fitted <- function(seromodel_object, #' The x axis corresponds to the decades covered by the survey the y axis to the Force-of-Infection. #' @param seromodel_object Object containing the results of fitting a model by means of \link{run_seromodel}. #' @param size_text Text size use in the theme of the graph returned by the function. +#' @param max_lambda TBD +#' @param foi_sim TBD #' @return A ggplot2 object containing the Force-of-infection-vs-time including the corresponding confidence interval. #' @examples #' \dontrun{ @@ -278,12 +282,15 @@ plot_rhats <- function(seromodel_object, return(rhats_plot) } +# TODO Complete @param documentation #' Function that generates a vertical arrange of plots showing a summary of a model, the estimated seroprevalence, #' the Force-of-Infection fit and the R-hat estimates plots. #' #' @param seromodel_object Object containing the results of fitting a model by means of \link{run_seromodel}. #' @param size_text Text size use in the theme of the graph returned by the function. +#' @param max_lambda TBD +#' @param foi_sim TBD #' @return A ggplot object with a vertical arrange containing the seropositivity, force of infection, and convergence plots. #' @examples #' \dontrun{ @@ -362,12 +369,13 @@ plot_seromodel <- function(seromodel_object, return(plot_arrange) } - +# TODO Improve documentation of @return. +# TODO Give more details about the generated plot #' Function that generates a plot for a given table #' #' @param info the information that will be contained in the table #' @param size_text Text size of the graph returned by the function -#' @return p, a variable that will be used in the \link{visualisation} module +#' @return p the plot for the given table #' @examples #' \dontrun{ #' data_test <- prepare_serodata(serodata) diff --git a/man/get_prev_expanded.Rd b/man/get_prev_expanded.Rd index b9cd74fb..a95f4899 100644 --- a/man/get_prev_expanded.Rd +++ b/man/get_prev_expanded.Rd @@ -11,6 +11,8 @@ get_prev_expanded(foi, serodata, bin_data = FALSE) \item{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]]}.} \item{serodata}{A data frame containing the data from a seroprevalence survey. For further details refer to \link{run_seromodel}.} + +\item{bin_data}{TBD} } \value{ \code{prev_final}. The expanded prevalence data. This is used for plotting purposes in the \code{visualization} module. diff --git a/man/plot_foi.Rd b/man/plot_foi.Rd index 81c78e46..6e376c70 100644 --- a/man/plot_foi.Rd +++ b/man/plot_foi.Rd @@ -9,7 +9,11 @@ plot_foi(seromodel_object, max_lambda = NA, size_text = 25, foi_sim = NULL) \arguments{ \item{seromodel_object}{Object containing the results of fitting a model by means of \link{run_seromodel}.} +\item{max_lambda}{TBD} + \item{size_text}{Text size use in the theme of the graph returned by the function.} + +\item{foi_sim}{TBD} } \value{ A ggplot2 object containing the Force-of-infection-vs-time including the corresponding confidence interval. diff --git a/man/plot_info_table.Rd b/man/plot_info_table.Rd index 32d43ebb..72ddc003 100644 --- a/man/plot_info_table.Rd +++ b/man/plot_info_table.Rd @@ -12,7 +12,7 @@ plot_info_table(info, size_text) \item{size_text}{Text size of the graph returned by the function} } \value{ -p, a variable that will be used in the \link{visualisation} module +p the plot for the given table } \description{ Function that generates a plot for a given table diff --git a/man/plot_seromodel.Rd b/man/plot_seromodel.Rd index 6f682b7d..6a36f736 100644 --- a/man/plot_seromodel.Rd +++ b/man/plot_seromodel.Rd @@ -15,7 +15,11 @@ plot_seromodel( \arguments{ \item{seromodel_object}{Object containing the results of fitting a model by means of \link{run_seromodel}.} +\item{max_lambda}{TBD} + \item{size_text}{Text size use in the theme of the graph returned by the function.} + +\item{foi_sim}{TBD} } \value{ A ggplot object with a vertical arrange containing the seropositivity, force of infection, and convergence plots. diff --git a/man/prepare_serodata.Rd b/man/prepare_serodata.Rd index 5b03d6e2..33b4a1de 100644 --- a/man/prepare_serodata.Rd +++ b/man/prepare_serodata.Rd @@ -21,7 +21,9 @@ This data frame must contain the following columns: \code{antibody} \tab antibody \cr \tab \cr }} -\item{alpha}{probability of a type I error. For further details refer to \link{Hmisc::binconf}.} +\item{alpha}{probability of a type I error. For further details refer to \link[Hmisc]{binconf}.} + +\item{add_age_mean_f}{TBD} } \value{ serodata with additional columns necessary for the analysis. These columns are: diff --git a/man/run_seromodel.Rd b/man/run_seromodel.Rd index dd7d758d..becb135a 100644 --- a/man/run_seromodel.Rd +++ b/man/run_seromodel.Rd @@ -55,6 +55,8 @@ For further details refer to the \code{control} parameter in \link[rstan]{sampli \item{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}.} \item{decades}{Number of decades covered by the survey data.} + +\item{print_summary}{TBD} } \value{ \code{seromodel_object}. An object containing relevant information about the implementation of the model. For further details refer to \link{fit_seromodel}.