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

115 remove dontrun from examples #116

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions R/model_comparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
#' @param seromodel_object seromodel_object
#' @return rhats table
#' @examples
#' \dontrun{
#' data(chagas2012)
#' data_test <- prepare_serodata(serodata = chagas2012)
#' model_constant <- run_seromodel(serodata = data_test,
#' foi_model = "constant",
#' n_iters = 1500)
#' get_table_rhats(model_object = model_constant)
#' }
#' get_table_rhats(seromodel_object = model_constant)
#' @export
get_table_rhats <- function(seromodel_object) {
rhats <- bayesplot::rhat(seromodel_object$seromodel_fit, "foi")
Expand Down
20 changes: 3 additions & 17 deletions R/modelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
#' @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{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' run_seromodel (chagas2012,
#' run_seromodel (serodata,
#' foi_model = "constant")
#' }
#' @export
run_seromodel <- function(serodata,
foi_model = "constant",
Expand Down Expand Up @@ -114,12 +113,10 @@ run_seromodel <- function(serodata,
#' }

#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_fit <- fit_seromodel(serodata = serodata,
#' foi_model = "constant")
#' }
#'
#' @export
fit_seromodel <- function(serodata,
Expand Down Expand Up @@ -203,11 +200,9 @@ fit_seromodel <- function(serodata,
#' @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
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(serodata = chagas2012, alpha = 0.05)
#' exposure_ages <- get_exposure_ages(serodata)
#' }
#' @export
get_exposure_ages <- function(serodata) {
return(seq_along(min(serodata$birth_year):(serodata$tsur[1] - 1)))
Expand All @@ -219,11 +214,9 @@ get_exposure_ages <- function(serodata) {
#' @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_output}. An atomic matrix containing the expositions for each entry of \code{serodata} by year.
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(serodata = chagas2012)
#' exposure_matrix <- get_exposure_matrix(serodata = serodata)
#' }
#' @export
get_exposure_matrix <- function(serodata) {
age_class <- serodata$age_mean_f
Expand All @@ -242,14 +235,11 @@ get_exposure_matrix <- function(serodata) {
#' generated by means of \link{get_exposure_ages}.
#' @return \code{foi_central_estimates}. Central estimates for the fitted forced FoI
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- fit_seromodel(serodata = serodata,
#' foi_model = "constant")
#' foi_central_estimates <- get_foi_central_estimates(seromodel_object)
#' }
#'
#' @export
get_foi_central_estimates <- function(seromodel_object) {

Expand Down Expand Up @@ -301,13 +291,11 @@ get_foi_central_estimates <- function(seromodel_object) {
#' \code{converged} \tab convergence \cr \tab \cr
#' }
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(serodata = serodata,
#' foi_model = "constant")
#' extract_seromodel_summary(seromodel_object)
#' }
#' @export
extract_seromodel_summary <- function(seromodel_object) {
#------- Loo estimates
Expand Down Expand Up @@ -352,14 +340,12 @@ extract_seromodel_summary <- function(seromodel_object) {
#' @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{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(serodata = serodata,
#' foi_model = "constant")
#' foi <- rstan::extract(seromodel_object$seromodel_fit, "foi")[[1]]
#' get_prev_expanded <- function(foi, serodata)
#' }
#' get_prev_expanded(foi, serodata)
#' @export
get_prev_expanded <- function(foi,
serodata,
Expand Down
7 changes: 2 additions & 5 deletions R/seroprevalence_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
#' \code{prev_obs_upper} \tab Upper limit of the confidence interval for the observed prevalence \cr \tab \cr
#' }
#' @examples
#'\dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' }
#' @export
prepare_serodata <- function(serodata = serodata,
alpha = 0.05,
Expand Down Expand Up @@ -90,10 +88,9 @@ prepare_serodata <- function(serodata = serodata,
#' The last six colums can be added to \code{serodata} by means of the function \code{\link{prepare_serodata}}.
#' @return data set with the binomial confidence intervals
#' @examples
#'\dontrun{
#' data(chagas2012)
#' prepare_bin_data(chagas2012)
#' }
#' serodata <- prepare_serodata(chagas2012)
#' prepare_bin_data(serodata)
#' @export
prepare_bin_data <- function(serodata) {
serodata$cut_ages <-
Expand Down
38 changes: 11 additions & 27 deletions R/visualisation.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@
#' @param size_text Text size use in the theme of the graph returned by the function.
#' @return A ggplot object containing the seropositivity-vs-age graph of the raw data of a given seroprevalence survey with its corresponging binomial confidence interval.
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(
#' serodata = serodata,
#' foi_model = "constant",
#' n_iters = 1000
#')
#' plot_seroprev(seromodel_object, size_text = 15)
#' }
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' plot_seroprev(serodata, size_text = 15)
#' @export
plot_seroprev <- function(serodata,
size_text = 6) {
Expand All @@ -52,14 +45,12 @@ plot_seroprev <- function(serodata,
#' @param size_text Text size of the graph returned by the function.
#' @return A ggplot object containing the seropositivity-vs-age graph including the data, the fitted model and their corresponding confindence intervals.
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(serodata = serodata,
#' foi_model = "constant",
#' n_iters = 1000)
#' plot_seroprev_fitted(seromodel_object, size_text = 15)
#' }
#' @export
plot_seroprev_fitted <- function(seromodel_object,
size_text = 6) {
Expand Down Expand Up @@ -133,7 +124,6 @@ plot_seroprev_fitted <- function(seromodel_object,
#' @param foi_sim TBD
#' @return A ggplot2 object containing the Force-of-infection-vs-time including the corresponding confidence interval.
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(
Expand All @@ -142,7 +132,6 @@ plot_seroprev_fitted <- function(seromodel_object,
#' n_iters = 1000
#' )
#' plot_foi(seromodel_object, size_text = 15)
#' }
#' @export
plot_foi <- function(seromodel_object,
max_lambda = NA,
Expand Down Expand Up @@ -229,7 +218,6 @@ plot_foi <- function(seromodel_object,
#' @param size_text Text size use in the theme of the graph returned by the function.
#' @return The rhats-convergence plot of the selected model.
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(
Expand All @@ -239,7 +227,6 @@ plot_foi <- function(seromodel_object,
#' )
#' plot_rhats(seromodel_object,
#' size_text = 15)
#' }
#' @export
plot_rhats <- function(seromodel_object,
size_text = 25) {
Expand Down Expand Up @@ -295,7 +282,6 @@ plot_rhats <- function(seromodel_object,
#' @param foi_sim TBD
#' @return A ggplot object with a vertical arrange containing the seropositivity, force of infection, and convergence plots.
#' @examples
#' \dontrun{
#' data(chagas2012)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(
Expand All @@ -304,7 +290,6 @@ plot_rhats <- function(seromodel_object,
#' n_iters = 1000
#' )
#' plot_seromodel(seromodel_object, size_text = 15)
#' }
#' @export
plot_seromodel <- function(seromodel_object,
max_lambda = NA,
Expand Down Expand Up @@ -380,16 +365,15 @@ plot_seromodel <- function(seromodel_object,
#' @param size_text Text size of the graph returned by the function
#' @return p the plot for the given table
#' @examples
#' \dontrun{
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(
#' serodata = serodata,
#' foi_model = "constant",
#' n_iters = 1000
#' )
#' info = t(seromodel_object$model_summary)
#' serodata <- prepare_serodata(chagas2012)
#' seromodel_object <- run_seromodel(
#' serodata = serodata,
#' foi_model = "constant",
#' n_iters = 1000
#' )
#' seromodel_summary = extract_seromodel_summary(seromodel_object)
#' info = t(seromodel_summary)
#' plot_info_table (info, size_text = 15)
#' }
#' @export
plot_info_table <- function(info, size_text) {
dato <- data.frame(y = NROW(info):seq_len(1),
Expand Down
2 changes: 0 additions & 2 deletions man/extract_seromodel_summary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/fit_seromodel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/get_exposure_ages.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/get_exposure_matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions man/get_foi_central_estimates.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions man/get_prev_expanded.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions man/get_table_rhats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/plot_foi.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions man/plot_info_table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/plot_rhats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading