From 7e9c4ee9928d3f7521b6e6e77136fa66e1f521f5 Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Tue, 14 Nov 2023 15:19:05 +0000 Subject: [PATCH 1/8] Hyperlink functions and use consistent styling --- R/adjust.R | 4 +- R/create.R | 85 ++++++++++++++-------------- R/dist.R | 56 +++++++++--------- R/epinow.R | 11 ++-- R/estimate_infections.R | 21 +++---- R/estimate_secondary.R | 70 +++++++++++------------ R/estimate_truncation.R | 14 ++--- R/extract.R | 36 ++++++------ R/get.R | 28 ++++----- R/opts.R | 65 +++++++++++---------- R/plot.R | 34 +++++------ R/regional_epinow.R | 57 ++++++++++--------- R/setup.R | 39 ++++++------- R/simulate_infections.R | 21 ++++--- R/summarise.R | 24 ++++---- R/utilities.R | 24 ++++---- man/adjust_infection_to_report.Rd | 4 +- man/allocate_delays.Rd | 2 +- man/allocate_empty.Rd | 2 +- man/bootstrapped_dist_fit.Rd | 2 +- man/c.dist_spec.Rd | 2 +- man/calc_summary_measures.Rd | 2 +- man/calc_summary_stats.Rd | 2 +- man/clean_regions.Rd | 4 +- man/convert_to_logmean.Rd | 2 +- man/convert_to_logsd.Rd | 2 +- man/create_backcalc_data.Rd | 8 +-- man/create_clean_reported_cases.Rd | 2 +- man/create_future_rt.Rd | 4 +- man/create_gp_data.Rd | 10 ++-- man/create_initial_conditions.Rd | 8 +-- man/create_obs_model.Rd | 12 ++-- man/create_rt_data.Rd | 8 +-- man/create_shifted_cases.Rd | 8 +-- man/create_stan_args.Rd | 18 +++--- man/create_stan_data.Rd | 29 +++++----- man/delay_opts.Rd | 3 +- man/dist_fit.Rd | 4 +- man/dist_skel.Rd | 2 +- man/dist_spec.Rd | 2 +- man/dist_spec_plus.Rd | 2 +- man/epinow.Rd | 50 ++++++++-------- man/estimate_delay.Rd | 6 +- man/estimate_infections.Rd | 37 ++++++------ man/estimate_secondary.Rd | 26 ++++----- man/estimate_truncation.Rd | 14 ++--- man/expose_stan_fns.Rd | 4 +- man/extract_CrIs.Rd | 7 ++- man/extract_inits.Rd | 8 +-- man/extract_parameter.Rd | 8 +-- man/extract_parameter_samples.Rd | 9 +-- man/extract_stan_param.Rd | 8 +-- man/extract_static_parameter.Rd | 4 +- man/fit_model_with_nuts.Rd | 4 +- man/fit_model_with_vb.Rd | 2 +- man/fix_dist.Rd | 10 ++-- man/forecast_secondary.Rd | 34 +++++------ man/format_fit.Rd | 2 +- man/gamma_dist_def.Rd | 4 +- man/generation_time_opts.Rd | 7 ++- man/get_dist.Rd | 6 +- man/get_generation_time.Rd | 4 +- man/get_incubation_period.Rd | 4 +- man/get_raw_result.Rd | 2 +- man/get_regional_results.Rd | 6 +- man/get_regions.Rd | 2 +- man/get_regions_with_most_reports.Rd | 2 +- man/get_seeding_time.Rd | 4 +- man/gp_opts.Rd | 4 +- man/growth_to_R.Rd | 2 +- man/init_cumulative_fit.Rd | 2 +- man/lognorm_dist_def.Rd | 4 +- man/mean.dist_spec.Rd | 2 +- man/opts_list.Rd | 12 ++-- man/plot.dist_spec.Rd | 8 +-- man/plot.epinow.Rd | 6 +- man/plot.estimate_infections.Rd | 4 +- man/plot.estimate_secondary.Rd | 2 +- man/plot.estimate_truncation.Rd | 4 +- man/plot_CrIs.Rd | 6 +- man/plot_estimates.Rd | 12 ++-- man/plot_summary.Rd | 6 +- man/plus-.dist_spec.Rd | 2 +- man/print.dist_spec.Rd | 2 +- man/process_region.Rd | 6 +- man/process_regions.Rd | 9 +-- man/regional_epinow.Rd | 63 ++++++++++----------- man/regional_runtimes.Rd | 4 +- man/regional_summary.Rd | 6 +- man/report_cases.Rd | 4 +- man/report_plots.Rd | 4 +- man/rstan_opts.Rd | 6 +- man/rstan_sampling_opts.Rd | 8 +-- man/rstan_vb_opts.Rd | 12 ++-- man/run_region.Rd | 50 ++++++++-------- man/sample_approx_dist.Rd | 6 +- man/save_input.Rd | 2 +- man/secondary_opts.Rd | 18 +++--- man/set_dt_single_thread.Rd | 8 +-- man/setup_default_logging.Rd | 6 +- man/setup_dt.Rd | 6 +- man/setup_future.Rd | 15 ++--- man/setup_logging.Rd | 14 ++--- man/simulate_infections.Rd | 23 +++++--- man/simulate_secondary.Rd | 4 +- man/stan_opts.Rd | 8 +-- man/summarise_key_measures.Rd | 2 +- man/summarise_results.Rd | 2 +- man/summary.epinow.Rd | 2 +- man/summary.estimate_infections.Rd | 2 +- man/trunc_opts.Rd | 5 +- man/update_horizon.Rd | 2 +- man/update_list.Rd | 2 +- man/update_secondary_args.Rd | 8 +-- 114 files changed, 707 insertions(+), 685 deletions(-) diff --git a/R/adjust.R b/R/adjust.R index 2b4b4ccbf..fc19ee611 100644 --- a/R/adjust.R +++ b/R/adjust.R @@ -3,12 +3,12 @@ #' @description `r lifecycle::badge("stable")` #' Maps from cases by date of infection to date of report via date of #' onset. -#' @param infections `data.table` containing a `date` variable and a numeric +#' @param infections `` containing a `date` variable and a numeric #' `cases` variable. #' #' @param delay_defs A list of single row data.tables that each defines a #' delay distribution (model, parameters and maximum delay for each model). -#' See `lognorm_dist_def` for an example of the structure. +#' See [lognorm_dist_def()] for an example of the structure. #' #' @param reporting_effect A numeric vector of length 7 that allows the scaling #' of reported cases by the day on which they report (1 = Monday, 7 = Sunday). diff --git a/R/create.R b/R/create.R index 7fdd54cc1..73c066650 100644 --- a/R/create.R +++ b/R/create.R @@ -74,8 +74,8 @@ create_clean_reported_cases <- function(reported_cases, horizon, #' This functions creates a data frame of reported cases that has been smoothed #' using a centred partial rolling average (with a period set by #' `smoothing_window`) and shifted back in time by some delay. It is used by -#' `estimate_infections` to generate the mean shifted prior on which the back -#' calculation method (see `backcalc_opts()`) is based. +#' [estimate_infections()] to generate the mean shifted prior on which the back +#' calculation method (see [backcalc_opts()]) is based. #' #' @param smoothing_window Numeric, the rolling average smoothing window #' to apply. Must be odd in order to be defined as a centred average. @@ -87,7 +87,7 @@ create_clean_reported_cases <- function(reported_cases, horizon, #' @importFrom data.table copy shift frollmean fifelse .N #' @importFrom stats lm #' @importFrom runner mean_run -#' @return A data frame for shifted reported cases +#' @return A `` for shifted reported cases #' @export #' @author Sam Abbott #' @examples @@ -144,8 +144,8 @@ create_shifted_cases <- function(reported_cases, shift, #' Construct the Required Future Rt assumption #' #' @description `r lifecycle::badge("stable")` -#' Converts the `future` argument from `rt_opts()` into arguments that can be -#' passed to `stan`. +#' Converts the `future` argument from [rt_opts()] into arguments that can be +#' passed to `{stan}`. #' #' @param future A character string or integer. This argument indicates how to #' set future Rt values. Supported options are to project using the Rt model @@ -184,10 +184,10 @@ create_future_rt <- function(future = "latest", delay = 0) { #' Create Time-varying Reproduction Number Data #' #' @description `r lifecycle::badge("stable")` -#' Takes the output from `rt_opts()` and converts it into a list understood by -#' `stan`. -#' @param rt A list of options as generated by `rt_opts()` defining Rt -#' estimation. Defaults to `rt_opts()`. Set to `NULL` to switch to using back +#' Takes the output from [rt_opts()] and converts it into a list understood by +#' `{stan}`. +#' @param rt A list of options as generated by [rt_opts()] defining Rt +#' estimation. Defaults to [rt_opts()]. Set to `NULL` to switch to using back #' calculation rather than generating infections using Rt. #' #' @param breakpoints An integer vector (binary) indicating the location of @@ -256,11 +256,11 @@ create_rt_data <- function(rt = rt_opts(), breakpoints = NULL, #' Create Back Calculation Data #' #' @description `r lifecycle::badge("stable")` -#' Takes the output of `backcalc_opts()` and converts it into a list understood -#' by `stan`. +#' Takes the output of [backcalc_opts()] and converts it into a list understood +#' by `{stan}`. #' -#' @param backcalc A list of options as generated by `backcalc_opts()` to -#' define the back calculation. Defaults to `backcalc_opts()`. +#' @param backcalc A list of options as generated by [backcalc_opts()] to +#' define the back calculation. Defaults to [backcalc_opts()]. #' #' @seealso backcalc_opts #' @importFrom data.table fcase @@ -284,15 +284,15 @@ create_backcalc_data <- function(backcalc = backcalc_opts()) { #' Create Gaussian Process Data #' #' @description `r lifecycle::badge("stable")` -#' Takes the output of `gp_opts()` and converts it into a list understood by -#' `stan`. -#' @param gp A list of options as generated by `gp_opts()` to define the -#' Gaussian process. Defaults to `gp_opts()`.Set to NULL to disable the +#' Takes the output of [gp_opts()] and converts it into a list understood by +#' `{stan}`. +#' @param gp A list of options as generated by [gp_opts()] to define the +#' Gaussian process. Defaults to [gp_opts()]. Set to `NULL` to disable the #' Gaussian process. #' @param data A list containing the following numeric values: #' `t`, `seeding_time`, `horizon`. #' @importFrom data.table fcase -#' @seealso gp_opts +#' @seealso [gp_opts()] #' @return A list of settings defining the Gaussian process #' @export #' @author Sam Abbott @@ -356,13 +356,13 @@ create_gp_data <- function(gp = gp_opts(), data) { #' Create Observation Model Settings #' #' @description `r lifecycle::badge("stable")` -#' Takes the output of `obs_opts()` and converts it into a list understood -#' by `stan`. -#' @param obs A list of options as generated by `obs_opts()` defining the -#' observation model. Defaults to `obs_opts()`. +#' Takes the output of [obs_opts()] and converts it into a list understood +#' by `{stan}`. +#' @param obs A list of options as generated by [obs_opts()] defining the +#' observation model. Defaults to [obs_opts()]. #' @param dates A vector of dates used to calculate the day of the week. -#' @seealso obs_opts -#' @return A list of settings ready to be passed to stan defining +#' @seealso [obs_opts()] +#' @return A list of settings ready to be passed to `{stan}` defining #' the Observation Model #' @export #' @author Sam Abbott @@ -408,14 +408,15 @@ create_obs_model <- function(obs = obs_opts(), dates) { #' Create Stan Data Required for estimate_infections #' #' @description`r lifecycle::badge("stable")` -#' Takes the output of `stan_opts()` and converts it into a list understood by -#' `stan`. Internally calls the other `create_` family of functions to -#' construct a single list for input into stan with all data required present. +#' Takes the output of [stan_opts()] and converts it into a list understood by +#' `{stan}`. Internally calls the other `create_` family of functions to +#' construct a single list for input into `{stan}` with all data required +#' present. #' -#' @param shifted_cases A dataframe of delay shifted cases +#' @param shifted_cases A `` of delay shifted cases #' #' @param seeding_time Integer; seeding time, usually obtained using -#' `get_seeding_time()` +#' [get_seeding_time()]. #' #' @inheritParams create_gp_data #' @inheritParams create_obs_model @@ -497,11 +498,11 @@ create_stan_data <- function(reported_cases, seeding_time, #' Create Initial Conditions Generating Function #' @description `r lifecycle::badge("stable")` -#' Uses the output of `create_stan_data` to create a function which can be used -#' to sample from the prior distributions (or as close as possible) for -#' parameters. Used in order to initialise each `stan` chain within a range of +#' Uses the output of [create_stan_data()] to create a function which can be +#' used to sample from the prior distributions (or as close as possible) for +#' parameters. Used in order to initialise each `{stan}` chain within a range of #' plausible values. -#' @param data A list of data as produced by `create_stan_data.` +#' @param data A list of data as produced by [create_stan_data()]. #' @return An initial condition generating function #' @importFrom purrr map2_dbl #' @importFrom truncnorm rtruncnorm @@ -598,26 +599,26 @@ create_initial_conditions <- function(data) { #' Create a List of Stan Arguments #' #' @description `r lifecycle::badge("stable")` -#' Generates a list of arguments as required by `rstan::sampling` or -#' `rstan::vb` by combining the required options, with data, and type of +#' Generates a list of arguments as required by [rstan::sampling()] or +#' [rstan::vb()] by combining the required options, with data, and type of #' initialisation. Initialisation defaults to random but it is expected that -#' `create_initial_conditions` will be used. +#' [create_initial_conditions()] will be used. #' -#' @param stan A list of stan options as generated by `stan_opts()`. Defaults -#' to `stan_opts()`. Can be used to override `data`, `init`, and `verbose` +#' @param stan A list of stan options as generated by [stan_opts()]. Defaults +#' to [stan_opts()]. Can be used to override `data`, `init`, and `verbose` #' settings if desired. #' -#' @param data A list of stan data as created by `create_stan_data` +#' @param data A list of `{stan}` data as created by [create_stan_data()] #' -#' @param init Initial conditions passed to `rstan`. Defaults to "random" but -#' can also be a function (as supplied by `create_intitial_conditions`). +#' @param init Initial conditions passed to `{rstan}`. Defaults to "random" but +#' can also be a function (as supplied by [create_intitial_conditions()]). #' #' @param verbose Logical, defaults to `FALSE`. Should verbose progress #' messages be returned. #' #' @importFrom utils modifyList #' -#' @return A list of stan arguments +#' @return A list of `{stan}` arguments #' @author Sam Abbott #' @export #' @examples diff --git a/R/dist.R b/R/dist.R index d6ced5983..8a3dc42d0 100644 --- a/R/dist.R +++ b/R/dist.R @@ -3,7 +3,7 @@ #' @description `r lifecycle::badge("questioning")` #' This function acts as a skeleton for a truncated distribution defined by #' model type, maximum value and model parameters. It is designed to be used -#' with the output from `get_dist`. +#' with the output from [get_dist()]. #' #' @param n Numeric vector, number of samples to take (or days for the #' probability density). @@ -177,7 +177,7 @@ dist_skel <- function(n, dist = FALSE, cum = TRUE, model, #' #' @description `r lifecycle::badge("stable")` #' Fits an integer adjusted exponential, gamma or lognormal distribution using -#' `stan`. +#' `{stan}`. #' @param values Numeric vector of values #' #' @param samples Numeric, number of samples to take. Must be >= 1000. @@ -196,7 +196,7 @@ dist_skel <- function(n, dist = FALSE, cum = TRUE, model, #' @param verbose Logical, defaults to FALSE. Should verbose progress messages #' be printed. #' -#' @return A `stan` fit of an interval censored distribution +#' @return A `{stan}` fit of an interval censored distribution #' @author Sam Abbott #' @export #' @examples @@ -286,7 +286,7 @@ dist_fit <- function(values = NULL, samples = 1000, cores = 1, #' #' @description `r lifecycle::badge("soft-deprecated")` #' Generates a distribution definition when only parameter estimates -#' are available for gamma distributed parameters. See `rgamma` for +#' are available for gamma distributed parameters. See [rgamma()] for #' distribution information. #' #' @param shape Numeric, shape parameter of the gamma distribution. @@ -300,7 +300,7 @@ dist_fit <- function(values = NULL, samples = 1000, cores = 1, #' @param samples Numeric, number of sample distributions to generate. #' #' @importFrom truncnorm rtruncnorm -#' @return A data.table defining the distribution as used by `dist_skel` +#' @return A `` defining the distribution as used by [dist_skel()] #' @export #' @inheritParams dist_skel #' @inheritParams lognorm_dist_def @@ -370,7 +370,7 @@ gamma_dist_def <- function(shape, shape_sd, #' #' @description `r lifecycle::badge("soft-deprecated")` #' Generates a distribution definition when only parameter estimates -#' are available for log normal distributed parameters. See `rlnorm` for +#' are available for log normal distributed parameters. See [rlnorm()] for #' distribution information. #' #' @param mean Numeric, log mean parameter of the gamma distribution. @@ -385,7 +385,7 @@ gamma_dist_def <- function(shape, shape_sd, #' #' @param to_log Logical, should parameters be logged before use. #' -#' @return A data.table defining the distribution as used by `dist_skel` +#' @return A `` defining the distribution as used by [dist_skel()] #' @author Sam Abbott #' @importFrom truncnorm rtruncnorm #' @export @@ -488,7 +488,7 @@ lognorm_dist_def <- function(mean, mean_sd, #' @param max_value Numeric, defaults to the maximum value in the observed #' data. Maximum delay to allow (added to output but does impact fitting). #' -#' @return A `dist_spec` object summarising the bootstrapped distribution +#' @return A `` object summarising the bootstrapped distribution #' @author Sam Abbott #' @importFrom purrr transpose #' @importFrom future.apply future_lapply @@ -587,16 +587,16 @@ bootstrapped_dist_fit <- function(values, dist = "lognormal", #' #' @description `r lifecycle::badge("maturing")` #' Estimate a log normal delay distribution from a vector of integer delays. -#' Currently this function is a simple wrapper for `bootstrapped_dist_fit`. +#' Currently this function is a simple wrapper for [bootstrapped_dist_fit()]. #' #' @param delays Integer vector of delays #' #' @param ... Arguments to pass to internal methods. #' -#' @return A `dist_spec` summarising the bootstrapped distribution +#' @return A `` summarising the bootstrapped distribution #' @author Sam Abbott #' @export -#' @seealso bootstrapped_dist_fit +#' @seealso [bootstrapped_dist_fit()] #' @examples #' \donttest{ #' delays <- rlnorm(500, log(5), 1) @@ -614,9 +614,9 @@ estimate_delay <- function(delays, ...) { #' #' @description `r lifecycle::badge("soft-deprecated")` #' Convolves cases by a PMF function. This function will soon be removed or -#' replaced with a more robust `stan` implementation. +#' replaced with a more robust `{stan}` implementation. #' -#' @param cases A dataframe of cases (in date order) with the following +#' @param cases A `` of cases (in date order) with the following #' variables: `date` and `cases`. #' #' @param max_value Numeric, maximum value to allow. Defaults to 120 days @@ -639,7 +639,7 @@ estimate_delay <- function(delays, ...) { #' @param truncate_future Logical, should cases be truncated if they occur #' after the first date reported in the data. Defaults to `TRUE`. #' -#' @return A `data.table` of cases by date of onset +#' @return A `` of cases by date of onset #' @export #' @importFrom purrr map_dfc #' @importFrom data.table data.table setorder @@ -1054,7 +1054,7 @@ dist_spec <- function(mean, sd = 0, mean_sd = 0, sd_sd = 0, #' Creates a delay distribution as the sum of two other delay distributions #' -#' This is done via convolution with `stats::convolve()`. Nonparametric delays +#' This is done via convolution with [stats::convolve()]. Nonparametric delays #' that can be combined are processed together, and their cumulative #' distribution function is truncated at a specified tolerance level, ensuring #' numeric stability. @@ -1109,7 +1109,7 @@ dist_spec_plus <- function(e1, e2, tolerance = 0.001) { #' Creates a delay distribution as the sum of two other delay distributions #' -#' This is done via convolution with `stats::convolve()`. Nonparametric delays +#' This is done via convolution with [stats::convolve()]. Nonparametric delays #' that can be combined are processed together, and their cumulative #' distribution function is truncated at a specified tolerance level, ensuring #' numeric stability. @@ -1146,7 +1146,7 @@ dist_spec_plus <- function(e1, e2, tolerance = 0.001) { #' distributions to [epinow()] or [estimate_infections()]. #' #' @param ... The delay distributions (from calls to [dist_spec()]) to combine -#' @return Combined delay distributions (with class [dist_spec()]`) +#' @return Combined delay distributions (with class ``) #' @author Sebastian Funk #' @method c dist_spec #' @importFrom purrr transpose map @@ -1174,7 +1174,7 @@ c.dist_spec <- function(...) { ##' This works out the mean of all the (parametric / nonparametric) delay ##' distributions combined in the passed [dist_spec()]. ##' -##' @param x The [dist_spec()] to use +##' @param x The `` to use ##' @param ... Not used ##' @return A vector of means. ##' @author Sebastian Funk @@ -1226,7 +1226,7 @@ mean.dist_spec <- function(x, ...) { #' #' This displays the parameters of the uncertain and probability mass #' functions of fixed delay distributions combined in the passed [dist_spec()]. -#' @param x The [dist_spec()] to use +#' @param x The `` to use #' @param ... Not used #' @return invisible #' @author Sebastian Funk @@ -1293,12 +1293,12 @@ print.dist_spec <- function(x, ...) { #' Plot PMF and CDF for a dist_spec object #' -#' This function takes a [dist_spec] object and plots its probability mass -#' function (PMF) and cumulative distribution function (CDF) using [ggplot2]. +#' This function takes a `` object and plots its probability mass +#' function (PMF) and cumulative distribution function (CDF) using `{ggplot2}`. #' Note that currently uncertainty in distributions is not plot. #' -#' @param x A [dist_spec] object -#' @param ... Additional arguments to pass to \code{ggplot} +#' @param x A `` object +#' @param ... Additional arguments to pass to `{ggplot}`. #' @importFrom ggplot2 aes geom_col geom_step facet_wrap vars theme_bw #' @export #' @author Sam Abbott @@ -1380,17 +1380,17 @@ plot.dist_spec <- function(x, ...) { return(plot) } -##' Fix the parameters of a `dist_spec` +##' Fix the parameters of a `` object ##' -##' If the given `dist_spec` has any uncertainty, it is removed and the +##' If the given `` has any uncertainty, it is removed and the ##' corresponding distribution converted into a fixed one. -##' @return A `dist_spec` object without uncertainty +##' @return A `` object without uncertainty ##' @author Sebastian Funk ##' @export -##' @param x A [dist_spec] object +##' @param x A `` object ##' @param strategy Character; either "mean" (use the mean estimates of the ##' mean and standard deviation) or "sample" (randomly sample mean and -##' standard deviation from uncertainty given in the `dist_spec`) +##' standard deviation from uncertainty given in the `` ##' @importFrom truncnorm rtruncnorm ##' @importFrom rlang arg_match fix_dist <- function(x, strategy = c("mean", "sample")) { diff --git a/R/epinow.R b/R/epinow.R index 7da0b4398..5eefe62e9 100644 --- a/R/epinow.R +++ b/R/epinow.R @@ -1,13 +1,13 @@ #' Real-time Rt Estimation, Forecasting and Reporting #' #' @description `r lifecycle::badge("maturing")` -#' This function wraps the functionality of `estimate_infections()` in order +#' This function wraps the functionality of [estimate_infections()] in order #' to estimate Rt and cases by date of infection and forecast these infections #' into the future. In addition to the functionality of -#' `estimate_infections()` it produces additional summary output useful for +#' [estimate_infections()] it produces additional summary output useful for #' reporting results and interpreting them as well as error catching and #' reporting, making it particularly useful for production use e.g. running at -#' set intervals on a deidcated server. +#' set intervals on a dedicated server. #' #' @param output A character vector of optional output to return. Supported #' options are samples ("samples"), plots ("plots"), the run time ("timing"), @@ -18,14 +18,13 @@ #' @param return_output Logical, defaults to FALSE. Should output be returned, #' this automatically updates to TRUE if no directory for saving is specified. #' -#' @param plot_args A list of optional arguments passed to `plot.epinow()`. +#' @param plot_args A list of optional arguments passed to [plot.epinow()]. #' #' @return A list of output from estimate_infections with additional elements #' summarising results and reporting errors if they have occurred. #' @author Sam Abbott #' @export -#' @seealso estimate_infections simulate_infections -#' @seealso regional_epinow +#' @seealso [estimate_infections()] [simulate_infections()] [regional_epinow()] #' @inheritParams setup_target_folder #' @inheritParams estimate_infections #' @inheritParams setup_default_logging diff --git a/R/estimate_infections.R b/R/estimate_infections.R index e39429cd2..9173a417f 100644 --- a/R/estimate_infections.R +++ b/R/estimate_infections.R @@ -17,19 +17,19 @@ #' for an example of using `estimate_infections` within the `epinow` wrapper to #' estimate Rt for Covid-19 in a country from the ECDC data source. #' -#' @param reported_cases A data frame of confirmed cases (confirm) by date +#' @param reported_cases A `` of confirmed cases (confirm) by date #' (date). confirm must be integer and date must be in date format. #' -#' @param generation_time A call to `generation_time_opts()` defining the +#' @param generation_time A call to [generation_time_opts()] defining the #' generation time distribution used. For backwards compatibility a list of #' summary parameters can also be passed. #' -#' @param delays A call to `delay_opts()` defining delay distributions and -#' options. See the documentation of `delay_opts()` and the examples below for +#' @param delays A call to [delay_opts()] defining delay distributions and +#' options. See the documentation of [delay_opts()] and the examples below for #' details. #' -#' @param truncation A call to `trunc_opts()` defining the truncation of -#' observed data. Defaults to `trunc_opts()`. See `estimate_truncation()` for +#' @param truncation A call to [trunc_opts()] defining the truncation of +#' observed data. Defaults to [trunc_opts()]. See [estimate_truncation()] for #' an approach to estimating truncation from data. #' #' @param horizon Numeric, defaults to 7. Number of days into the future to @@ -51,7 +51,8 @@ #' samples, data used to fit the model, and the fit object itself. #' #' @author Sam Abbott -#' @seealso epinow regional_epinow simulate_infections +#' @seealso [epinow()] [regional_epinow()] [simulate_infections()] +#' [estimate_truncation()] #' @inheritParams create_stan_args #' @inheritParams create_stan_data #' @inheritParams create_stan_data @@ -364,7 +365,7 @@ init_cumulative_fit <- function(args, samples = 50, warmup = 50, #' Fit a Stan Model using the NUTs sampler #' #' @description `r lifecycle::badge("maturing")` -#' Fits a stan model using `rstan::sampling`. Provides the optional ability to +#' Fits a stan model using [rstan::sampling()]. Provides the optional ability to #' run chains using `future` with error catching, timeouts and merging of #' completed chains. #' @@ -378,7 +379,7 @@ init_cumulative_fit <- function(args, samples = 50, warmup = 50, #' as at least 2 chains complete successfully within the timelimit. #' #' @param id A character string used to assign logging information on error. -#' Used by `regional_epinow` to assign errors to regions. Alter the default to +#' Used by [regional_epinow()] to assign errors to regions. Alter the default to #' run with error catching. #' #' @importFrom futile.logger flog.debug flog.info flog.error @@ -583,7 +584,7 @@ fit_model_with_vb <- function(args, future = FALSE, id = "stan") { #' Summaries posterior samples and adds additional custom variables. #' #' @param posterior_samples A list of posterior samples as returned by -#' `extract_parameter_samples`. +#' [extract_parameter_samples()]. #' #' @param horizon Numeric, forecast horizon. #' diff --git a/R/estimate_secondary.R b/R/estimate_secondary.R index cc563e9a2..3a139eab5 100644 --- a/R/estimate_secondary.R +++ b/R/estimate_secondary.R @@ -3,7 +3,7 @@ #' @description `r lifecycle::badge("stable")` #' Estimates the relationship between a primary and secondary observation, for #' example hospital admissions and deaths or hospital admissions and bed -#' occupancy. See `secondary_opts()` for model structure options. See parameter +#' occupancy. See [secondary_opts()] for model structure options. See parameter #' documentation for model defaults and options. See the examples for case #' studies using synthetic data and #' [here](https://gist.github.com/seabbs/4f09d7609df298db7a86c31612ff9d17) @@ -14,24 +14,24 @@ #' [here](https://github.com/epiforecasts/covid.german.forecasts/blob/master/rt-forecast/death-from-cases.R) # nolint #' for an application forecasting Covid-19 deaths in Germany and Poland. #' -#' @param secondary A call to `secondary_opts()` or a list containing the +#' @param secondary A call to [secondary_opts()] or a list containing the #' following binary variables: cumulative, historic, primary_hist_additive, #' current, primary_current_additive. These parameters control the structure of -#' the secondary model, see `secondary_opts()` for details. +#' the secondary model, see [secondary_opts()] for details. #' #' @param delays A call to [delay_opts()] defining delay distributions between -#' primary and secondary observations See the documentation of `delay_opts()` +#' primary and secondary observations See the documentation of [delay_opts()] #' for details. By default a diffuse prior is assumed with a mean of 14 days #' and standard deviation of 7 days (with a standard deviation of 0.5 and 0.25 #' respectively on the log scale). #' -#' @param reports A data frame containing the `date` of report and both +#' @param reports A `` containing the `date` of report and both #' `primary` and `secondary` reports. #' #' @param model A compiled stan model to override the default model. May be #' useful for package developers or those developing extensions. #' -#' @param priors A `data.frame` of named priors to be used in model fitting +#' @param priors A `` of named priors to be used in model fitting #' rather than the defaults supplied from other arguments. This is typically #' useful if wanting to inform an estimate from the posterior of another model #' fit. @@ -48,12 +48,12 @@ #' parameters. #' #' @param verbose Logical, should model fitting progress be returned. Defaults -#' to `interactive()`. +#' to [interactive()]. #' -#' @param ... Additional parameters to pass to `rstan::sampling`. +#' @param ... Additional parameters to pass to [rstan::sampling()]. #' -#' @return A list containing: `predictions` (a data frame ordered by date with -#' the primary, and secondary observations, and a summary of the model +#' @return A list containing: `predictions` (a `` ordered by date +#' with the primary, and secondary observations, and a summary of the model #' estimated secondary observations), `posterior` which contains a summary of #' the entire model posterior, `data` (a list of data used to fit the #' model), and `fit` (the `stanfit` object). @@ -230,7 +230,7 @@ estimate_secondary <- function(reports, #' #' @description `r lifecycle::badge("stable")` #' Returns a list of options defining the secondary model used in -#' `estimate_secondary()`. This model is a combination of a convolution of +#' [estimate_secondary()]. This model is a combination of a convolution of #' previously observed primary reports combined with current primary reports #' (either additive or subtractive). It can optionally be cumulative. See the #' documentation of `type` for sensible options to cover most use cases and the @@ -302,18 +302,18 @@ secondary_opts <- function(type = "incidence", ...) { #' #' @description `r lifecycle::badge("stable")` #' This functions allows the user to more easily specify data driven or model -#' based priors for `estimate_secondary()` from example from previous model fits -#' using a `data.frame` to overwrite other default settings. Note that default +#' based priors for [estimate_secondary()] from example from previous model fits +#' using a `` to overwrite other default settings. Note that default #' settings are still required. #' #' @param data A list of data and arguments as returned by `create_stan_data()`. #' -#' @param priors A `data.frame` of named priors to be used in model fitting +#' @param priors A `` of named priors to be used in model fitting #' rather than the defaults supplied from other arguments. This is typically #' useful if wanting to inform a estimate from the posterior of another model #' fit. Priors that are currently use to update the defaults are the scaling #' fraction ("frac_obs"), the mean delay ("delay_mean"), and standard deviation -#' of the delay ("delay_sd"). The `data.frame` should have the following +#' of the delay ("delay_sd"). The `` should have the following #' variables: `variable`, `mean`, and `sd`. #' #' @return A list as produced by `create_stan_data()`. @@ -376,7 +376,7 @@ update_secondary_args <- function(data, priors, verbose = TRUE) { #' #' @param to Date object indicating when to plot up to. #' -#' @param new_obs A data.frame containing the columns `date` and `secondary` +#' @param new_obs A `` containing the columns `date` and `secondary` #' which replace the secondary observations stored in the `estimate_secondary` #' output. #' @@ -444,7 +444,7 @@ plot.estimate_secondary <- function(x, primary = FALSE, #' Simulate a secondary observation #' -#' @param data A data frame containing the `date` of report and `primary` +#' @param data A `` containing the `date` of report and `primary` #' cases as a numeric vector. #' #' @param family Character string defining the observation model. Options are @@ -457,7 +457,7 @@ plot.estimate_secondary <- function(x, primary = FALSE, #' @param ... Additional parameters to pass to the observation model (i.e #' `rnbinom` or `rpois`). #' -#' @return A data frame containing simulated data in the format required by +#' @return A `` containing simulated data in the format required by #' [estimate_secondary()]. #' #' @author Sam Abbott @@ -555,31 +555,31 @@ simulate_secondary <- function(data, type = "incidence", family = "poisson", #' #' @description `r lifecycle::badge("experimental")` #' This function forecasts secondary observations using the output of -#' `estimate_secondary()` and either observed primary data or a forecast of -#' primary observations. See the examples of `estimate_secondary()` -#' for one use case. It can also be combined with `estimate_infections()` t +#' [estimate_secondary()] and either observed primary data or a forecast of +#' primary observations. See the examples of [estimate_secondary()] +#' for one use case. It can also be combined with [estimate_infections()] to #' produce a forecast for a secondary observation from a forecast of a primary -#' observation. See the examples of `estimate_secondary()` for +#' observation. See the examples of [estimate_secondary()] for #' example use cases on synthetic data. See #' [here](https://gist.github.com/seabbs/4f09d7609df298db7a86c31612ff9d17) #' for an example of forecasting Covid-19 deaths from Covid-19 cases. #' #' @param estimate An object of class "estimate_secondary" as produced by -#' `estimate_secondary()`. +#' [estimate_secondary()]. #' -#' @param primary A data.frame containing at least `date` and `value` (integer) -#' variables and optionally `sample`. Used as the primary observation used to -#' forecast the secondary observations. Alternatively, this may be an object of -#' class "estimate_infections" as produced by `estimate_infections()`. If -#' `primary` is of class "estimate_infections" then the internal samples will +#' @param primary A `` containing at least `date` and `value` +#' (integer) variables and optionally `sample`. Used as the primary observation +#' used to forecast the secondary observations. Alternatively, this may be an +#' object of class "estimate_infections" as produced by `estimate_infections()`. +#' If `primary` is of class "estimate_infections" then the internal samples will #' be filtered to have a minimum date ahead of those observed in the `estimate` #' object. #' #' @param primary_variable A character string indicating the primary variable, #' defaulting to "reported_cases". Only used when primary is of class -#' "estimate_infections". +#' ``. #' -#' @param model A compiled stan model as returned by `rstan::stan_model`. +#' @param model A compiled stan model as returned by [rstan::stan_model()]. #' #' @param samples Numeric, number of posterior samples to simulate from. The #' default is to use all samples in the `primary` input when present. If not @@ -588,11 +588,11 @@ simulate_secondary <- function(data, type = "incidence", family = "poisson", #' @param all_dates Logical, defaults to FALSE. Should a forecast for all dates #' and not just those in the forecast horizon be returned. #' -#' @return A list containing: `predictions` (a data frame ordered by date with -#' the primary, and secondary observations, and a summary of the forecast +#' @return A list containing: `predictions` (a `` ordered by date +#' with the primary, and secondary observations, and a summary of the forecast #' secondary observations. For primary observations in the forecast horizon -#' when uncertainty is present the median is used), `samples` a data frame of -#' forecast secondary observation posterior samples, and `forecast` a summary +#' when uncertainty is present the median is used), `samples` a `` +#' of forecast secondary observation posterior samples, and `forecast` a summary #' of the forecast secondary observation posterior. #' #' @author Sam Abbott @@ -603,7 +603,7 @@ simulate_secondary <- function(data, type = "incidence", family = "poisson", #' @importFrom utils tail #' @importFrom purrr map #' @inheritParams estimate_secondary -#' @seealso estimate_secondary +#' @seealso [estimate_secondary()] #' @export forecast_secondary <- function(estimate, primary, diff --git a/R/estimate_truncation.R b/R/estimate_truncation.R index 1326c98ee..7028e89c9 100644 --- a/R/estimate_truncation.R +++ b/R/estimate_truncation.R @@ -3,7 +3,7 @@ #' @description `r lifecycle::badge("stable")` #' Estimates a truncation distribution from multiple snapshots of the same #' data source over time. This distribution can then be used in -#' `regional_epinow`, `epinow`, and `estimate_infections` to adjust for +#' [regional_epinow()], [epinow()], and [estimate_infections()] to adjust for #' truncated data. See #' [here](https://gist.github.com/seabbs/176b0c7f83eab1a7192a25b28bbd116a) #' for an example of using this approach on Covid-19 data in England. The @@ -33,7 +33,7 @@ #' - Truncation is a multiplicative scaling of underlying reported cases. #' - Truncation is log normally distributed. #' -#' @param obs A list of data frames each containing a date variable +#' @param obs A list of ``s each containing a date variable #' and a confirm (integer) variable. Each data set should be a snapshot #' of the reported data over time. All data sets must contain a complete vector #' of dates. @@ -56,13 +56,13 @@ #' #' @param verbose Logical, should model fitting progress be returned. #' -#' @param ... Additional parameters to pass to `rstan::sampling`. +#' @param ... Additional parameters to pass to [rstan::sampling()]. #' #' @return A list containing: the summary parameters of the truncation #' distribution (`dist`), the estimated CMF of the truncation distribution -#' (`cmf`, can be used to adjusted new data), a data frame containing the +#' (`cmf`, can be used to adjusted new data), a `` containing the #' observed truncated data, latest observed data and the adjusted for -#' truncation observations (`obs`), a data frame containing the last +#' truncation observations (`obs`), a `` containing the last #' observed data (`last_obs`, useful for plotting and validation), the data #' used for fitting (`data`) and the fit object (`fit`). #' @@ -342,12 +342,12 @@ estimate_truncation <- function(obs, max_truncation, trunc_max = 10, #' Plot method for estimate_truncation #' #' @description `r lifecycle::badge("experimental")` -#' `plot` method for class "estimate_truncation". Returns +#' [plot()] method for class ``. Returns #' a plot faceted over each dataset used in fitting with the latest #' observations as columns, the data observed at the time (and so truncated) #' as dots and the truncation adjusted estimates as a ribbon. #' -#' @param x A list of output as produced by `estimate_truncation` +#' @param x A list of output as produced by [estimate_truncation()] #' #' @param ... Pass additional arguments to plot function. Not currently in use. #' diff --git a/R/extract.R b/R/extract.R index c210e1ad5..dc743e17a 100644 --- a/R/extract.R +++ b/R/extract.R @@ -1,17 +1,17 @@ #' Extract Samples for a Parameter from a Stan model #' #' @description `r lifecycle::badge("stable")` -#' Extracts a single from a list of `stan` output and returns it as a -#' `data.table`. +#' Extracts a single from a list of `{stan}` output and returns it as a +#' ``. # #' @param param Character string indicating the parameter to extract #' -#' @param samples Extracted stan model (using `rstan::extract`) +#' @param samples Extracted stan model (using [rstan::extract()]) #' #' @param dates A vector identifying the dimensionality of the parameter to #' extract. Generally this will be a date. #' -#' @return A data frame containing the parameter name, date, sample id and +#' @return A `` containing the parameter name, date, sample id and #' sample value. #' @author Sam Abbott #' @importFrom data.table melt as.data.table @@ -42,7 +42,7 @@ extract_parameter <- function(param, samples, dates) { #' Extract Samples from a Parameter with a Single Dimension #' #' @inheritParams extract_parameter -#' @return A data frame containing the parameter name, sample id and sample +#' @return A `` containing the parameter name, sample id and sample #' value #' @author Sam Abbott extract_static_parameter <- function(param, samples) { @@ -57,12 +57,12 @@ extract_static_parameter <- function(param, samples) { #' Extract Parameter Samples from a Stan Model #' #' @description `r lifecycle::badge("stable")` -#' Extracts a custom set of parameters from a stan object and adds +#' Extracts a custom set of parameters from a `{stan}` object and adds #' stratification and dates where appropriate. #' -#' @param stan_fit A fit Stan model as returned by `rstan:sampling`. +#' @param stan_fit A fit Stan model as returned by [rstan:sampling()]. #' -#' @param data A list of the data supplied to the `rstan::sampling` call. +#' @param data A list of the data supplied to the [rstan::sampling()] call. #' #' @param reported_dates A vector of dates to report estimates for. #' @@ -75,7 +75,8 @@ extract_static_parameter <- function(param, samples) { #' @param merge if TRUE, merge samples and data so that parameters can be #' extracted from data. #' -#' @return A list of dataframes each containing the posterior of a parameter +#' @return A list of ``'s each containing the posterior of a +#' parameter #' @author Sam Abbott #' @importFrom rstan extract #' @importFrom data.table data.table @@ -188,10 +189,10 @@ extract_parameter_samples <- function(stan_fit, data, reported_dates, #' #' @description `r lifecycle::badge("stable")` #' Extracts summarised parameter posteriors from a `stanfit` object using -#' `rstan::summary` in a format consistent with other summary functions in -#' `EpiNow2`. +#' `rstan::summary()` in a format consistent with other summary functions +#' in `{EpiNow2}`. #' -#' @param fit A `stanfit` objec. +#' @param fit A `` objec. # #' @param params A character vector of parameters to extract. Defaults to all #' parameters. @@ -199,7 +200,7 @@ extract_parameter_samples <- function(stan_fit, data, reported_dates, #' @param var_names Logical defaults to `FALSE`. Should variables be named. #' Automatically set to TRUE if multiple parameters are to be extracted. #' -#' @return A `data.table` summarising parameter posteriors. Contains a +#' @return A `` summarising parameter posteriors. Contains a #' following variables: `variable`, `mean`, `mean_se`, `sd`, `median`, and #' `lower_`, `upper_` followed by credible interval labels indicating the #' credible intervals present. @@ -247,18 +248,18 @@ extract_stan_param <- function(fit, params = NULL, #' @description `r lifecycle::badge("experimental")` #' Extracts posterior samples to use to initialise a full model fit. This may #' be useful for certain data sets where the sampler gets stuck or cannot -#' easily be initialised. In `estimate_infections()`, `epinow()` and\ -#' `regional_epinow()` this option can be engaged by setting +#' easily be initialised. In [estimate_infections()], [epinow()] and +#' [regional_epinow()] this option can be engaged by setting #' `stan_opts(init_fit = )`. #' #' This implementation is based on the approach taken in #' [epidemia](https://github.com/ImperialCollegeLondon/epidemia/) authored by #' James Scott. #' -#' @param fit A stanfit object. +#' @param fit A `` object. #' #' @param current_inits A function that returns a list of initial conditions -#' (such as `create_initial_conditions()`). Only used in `exclude_list` is +#' (such as [create_initial_conditions()]). Only used in `exclude_list` is #' specified. #' #' @param exclude_list A character vector of parameters to not initialise from @@ -274,7 +275,6 @@ extract_stan_param <- function(fit, params = NULL, #' @importFrom rstan extract #' @importFrom utils modifyList #' @export - extract_inits <- function(fit, current_inits, exclude_list = NULL, samples = 50) { diff --git a/R/get.R b/R/get.R index 0f827492f..006351763 100644 --- a/R/get.R +++ b/R/get.R @@ -3,7 +3,7 @@ #' @description `r lifecycle::badge("stable")` #' #' @param results_dir A character string giving the directory in which results -#' are stored (as produced by `regional_rt_pipeline`). +#' are stored (as produced by [regional_rt_pipeline()]). #' #' @return A named character vector containing the results to plot. #' @author Sam Abbott @@ -34,7 +34,7 @@ get_regions <- function(results_dir) { #' @param result_dir Character string giving the location of the target #' directory. #' -#' @return An R object read in from the targeted .rds file +#' @return An R object read in from the targeted `.rds` file #' @author Sam Abbott #' @export get_raw_result <- function(file, region, date, @@ -49,11 +49,11 @@ get_raw_result <- function(file, region, date, #' Summarises results across regions either from input or from disk. See the #' examples for details. #' -#' @param regional_output A list of output as produced by `regional_epinow` and -#' stored in the `regional` list. +#' @param regional_output A list of output as produced by [regional_epinow()] +#' and stored in the `regional` list. #' #' @param results_dir A character string indicating the folder containing the -#' `EpiNow2` results to extract. +#' `{EpiNow2}` results to extract. #' #' @param date A Character string (in the format "yyyy-mm-dd") indicating the #' date to extract data for. Defaults to "latest" which finds the latest @@ -161,9 +161,9 @@ get_regional_results <- function(regional_output, #' @description `r lifecycle::badge("deprecated")` #' #' This function has been deprecated. Please specify a distribution -#' using `dist_spec` instead. +#' using [dist_spec()] instead. #' -#' @param data A `data.table` in the format of `generation_times`. +#' @param data A `` in the format of `generation_times`. #' #' @param disease A character string indicating the disease of interest. #' @@ -177,7 +177,7 @@ get_regional_results <- function(regional_output, #' @return A list defining a distribution #' #' @author Sam Abbott -#' @seealso dist_spec +#' @seealso [dist_spec()] #' @export get_dist <- function(data, disease, source, max_value = 14, fixed = FALSE) { lifecycle::deprecate_warn( @@ -202,12 +202,12 @@ get_dist <- function(data, disease, source, max_value = 14, fixed = FALSE) { #' #' Extracts a literature distribution from `generation_times`. #' This function has been deprecated. Please specify a distribution -#' using `dist_spec` instead. +#' using [dist_spec()] instead. #' #' @inheritParams get_dist #' @inherit get_dist #' @export -#' @seealso dist_spec +#' @seealso [dist_spec()] #' @author Sam Abbott get_generation_time <- function(disease, source, max_value = 14, fixed = FALSE) { @@ -232,13 +232,13 @@ get_generation_time <- function(disease, source, max_value = 14, #' #' Extracts a literature distribution from `generation_times`. #' This function has been deprecated. Please specify a distribution -#' using `dist_spec` instead +#' using [dist_spec()] instead #' #' @inheritParams get_dist #' @inherit get_dist #' @author Sam Abbott #' @export -#' @seealso dist_spec +#' @seealso [dist_spec()] get_incubation_period <- function(disease, source, max_value = 14, fixed = FALSE) { lifecycle::deprecate_warn( @@ -299,8 +299,8 @@ get_regions_with_most_reports <- function(reported_cases, ##' ##' The seeding time is set to the mean of the specified delays, constrained ##' to be at least the maximum generation time -##' @param delays Delays as specified using `dist_spec` -##' @param generation_time Generation time as specified using `dist_spec` +##' @param delays Delays as specified using [dist_spec()] +##' @param generation_time Generation time as specified using [dist_spec()] ##' @return An integer seeding time ##' @author Sebastian Funk get_seeding_time <- function(delays, generation_time) { diff --git a/R/opts.R b/R/opts.R index bad0250e0..d8a965f5b 100644 --- a/R/opts.R +++ b/R/opts.R @@ -13,13 +13,14 @@ #' @param max deprecated; use `dist` instead #' @param fixed deprecated; use `dist` instead #' @param prior_weight deprecated; prior weights are now specified as a -#' model option. Use the `weigh_delay_priors` argument of `estimate_infections` -#' instead. +#' model option. Use the `weigh_delay_priors` argument of +#' [estimate_infections()] instead. #' @return A `` object summarising the input delay #' distributions. #' @author Sebastian Funk #' @author Sam Abbott -#' @seealso convert_to_logmean convert_to_logsd bootstrapped_dist_fit dist_spec +#' @seealso [convert_to_logmean()] [convert_to_logsd()] +#' [bootstrapped_dist_fit()] [dist_spec()] #' @export #' @examples #' # default settings with a fixed generation time of 1 @@ -110,7 +111,8 @@ generation_time_opts <- function(dist = dist_spec(mean = 1), ..., #' @return A `` object summarising the input delay distributions. #' @author Sam Abbott #' @author Sebastian Funk -#' @seealso convert_to_logmean convert_to_logsd bootstrapped_dist_fit dist_spec +#' @seealso [convert_to_logmean()] [convert_to_logsd()] +#' [bootstrapped_dist_fit()] [dist_spec()] #' @export #' @examples #' # no delays @@ -165,7 +167,7 @@ delay_opts <- function(dist = dist_spec(), ..., fixed = FALSE) { #' #' @description `r lifecycle::badge("stable")` #' Returns a truncation distribution formatted for usage by -#' downstream functions. See `estimate_truncation()` for an approach to +#' downstream functions. See [estimate_truncation()] for an approach to #' estimate these distributions. #' #' @param dist A delay distribution or series of delay distributions reflecting @@ -176,7 +178,8 @@ delay_opts <- function(dist = dist_spec(), ..., fixed = FALSE) { #' #' @author Sam Abbott #' @author Sebastian Funk -#' @seealso convert_to_logmean convert_to_logsd bootstrapped_dist_fit dist_spec +#' @seealso [convert_to_logmean()] [convert_to_logsd()] +#' [bootstrapped_dist_fit()] [dist_spec()] #' @export #' @examples #' # no truncation @@ -352,8 +355,8 @@ backcalc_opts <- function(prior = "reports", prior_window = 14, rt_window = 1) { #' \code{inv_gamma(1.499007, 0.057277 * ls_max)}. #' #' @param ls_max Numeric, defaults to 60. The maximum value of the length -#' scale. Updated in `create_gp_data` to be the length of the input data if this -#' is smaller. +#' scale. Updated in [create_gp_data()] to be the length of the input data if +#' this is smaller. #' #' @param ls_min Numeric, defaults to 0. The minimum value of the length scale. #' @@ -499,7 +502,7 @@ obs_opts <- function(family = "negbin", #' #' @description `r lifecycle::badge("stable")` #' Defines a list specifying the arguments passed to -#' `rstan::sampling`. Custom settings can be supplied which override the +#' [rstan::sampling()]. Custom settings can be supplied which override the #' defaults. #' #' @param cores Number of cores to use when executing the chains in parallel, @@ -527,7 +530,7 @@ obs_opts <- function(family = "negbin", #' @param future Logical, defaults to `FALSE`. Should stan chains be run in #' parallel using `future`. This allows users to have chains fail gracefully #' (i.e when combined with `max_execution_time`). Should be combined with a -#' call to `future::plan`. +#' call to [future::plan()]. #' #' @param max_execution_time Numeric, defaults to Inf (seconds). If set wil #' kill off processing of each chain if not finished within the specified @@ -535,9 +538,9 @@ obs_opts <- function(family = "negbin", #' returned. If less than 2 chains return within the allowed time then #' estimation will fail with an informative error. #' -#' @param ... Additional parameters to pass to `rstan::sampling`. +#' @param ... Additional parameters to pass to [rstan::sampling()]. #' @importFrom utils modifyList -#' @return A list of arguments to pass to `rstan::sampling`. +#' @return A list of arguments to pass to [rstan::sampling()]. #' @author Sam Abbott #' @export #' @examples @@ -574,20 +577,20 @@ rstan_sampling_opts <- function(cores = getOption("mc.cores", 1L), #' #' @description `r lifecycle::badge("stable")` #' Defines a list specifying the arguments passed to -#' `rstan::vb`. Custom settings can be supplied which override the defaults. +#' [rstan::vb()]. Custom settings can be supplied which override the defaults. #' #' @param samples Numeric, default 2000. Overall number of approximate posterior #' samples. #' -#' @param trials Numeric, defaults to 10. Number of attempts to use `rstan::vb` -#' before failing. +#' @param trials Numeric, defaults to 10. Number of attempts to use +#' rstan::vb()] before failing. #' #' @param iter Numeric, defaulting to 10000. Number of iterations to use in -#' `rtan::vb`. +#' [rstan::vb()]. #' -#' @param ... Additional parameters to pass to `rstan::vb`. +#' @param ... Additional parameters to pass to [rstan::vb()]. #' -#' @return A list of arguments to pass to `rstan::vb`. +#' @return A list of arguments to pass to [rstan::vb()]. #' @author Sam Abbott #' @export #' @examples @@ -608,14 +611,14 @@ rstan_vb_opts <- function(samples = 2000, #' #' @description `r lifecycle::badge("stable")` #' Defines a list specifying the arguments passed to underlying `rstan` -#' functions via `rstan_sampling_opts()` and `rstan_vb_opts()`.Custom settings +#' functions via [rstan_sampling_opts()] and [rstan_vb_opts()].Custom settings #' can be supplied which override the defaults. #' #' @param object Stan model object. By default uses the compiled package #' default. #' #' @param method A character string, defaulting to sampling. Currently supports -#' `rstan::sampling` ("sampling") or `rstan:vb` ("vb"). +#' [rstan::sampling()] ("sampling") or [rstan:vb()] ("vb"). #' #' @param ... Additional parameters to pass underlying option functions. #' @importFrom rlang arg_match @@ -623,7 +626,7 @@ rstan_vb_opts <- function(samples = 2000, #' @author Sam Abbott #' @export #' @inheritParams rstan_sampling_opts -#' @seealso rstan_sampling_opts rstan_vb_opts +#' @seealso [rstan_sampling_opts()] [rstan_vb_opts()] #' @examples #' rstan_opts(samples = 1000) #' @@ -653,7 +656,7 @@ rstan_opts <- function(object = NULL, #' #' @description `r lifecycle::badge("stable")` #' Defines a list specifying the arguments passed to underlying stan -#' backend functions via `rstan_sampling_opts()` and `rstan_vb_opts()`. Custom +#' backend functions via [rstan_sampling_opts()] and [rstan_vb_opts()]. Custom #' settings can be supplied which override the defaults. #' #' @param backend Character string indicating the backend to use for fitting @@ -666,7 +669,7 @@ rstan_opts <- function(object = NULL, #' character string can be passed with the currently supported option being #' "cumulative". This fits the model to cumulative cases and may be useful for #' certain data sets where the sampler gets stuck or struggles to initialise. -#' See `init_cumulative_fit()` for details. +#' See [init_cumulative_fit()] for details. #' #' This implementation is based on the approach taken in #' [epidemia](https://github.com/ImperialCollegeLondon/epidemia/) authored by @@ -683,9 +686,9 @@ rstan_opts <- function(object = NULL, #' @author Sam Abbott #' @export #' @inheritParams rstan_opts -#' @seealso rstan_opts +#' @seealso [rstan_opts()] #' @examples -#' # using default of rstan::sampling +#' # using default of [rstan::sampling()] #' stan_opts(samples = 1000) #' #' # using vb @@ -716,13 +719,13 @@ stan_opts <- function(samples = 2000, #' Return an _opts List per Region #' #' @description `r lifecycle::badge("maturing")` -#' Define a list of `_opts()` to pass to `regional_epinow` `_opts()` accepting +#' Define a list of `_opts()` to pass to [regional_epinow()] `_opts()` accepting #' arguments. This is useful when different settings are needed between regions -#' within a single `regional_epinow` call. Using `opts_list` the defaults can -#' be applied to all regions present with an override passed to regions as -#' necessary (either within `opts_list` or externally). +#' within a single [regional_epinow()] call. Using [opts_list()] the defaults +#' can be applied to all regions present with an override passed to regions as +#' necessary (either within [opts_list()] or externally). #' -#' @param opts An `_opts()` function call such as `rt_opts()`. +#' @param opts An `_opts()` function call such as [rt_opts()]. #' #' @param reported_cases A data frame containing a `region` variable #' indicating the target regions. @@ -735,7 +738,7 @@ stan_opts <- function(samples = 2000, #' @return A named list of options per region which can be passed to the `_opt` #' accepting arguments of `regional_epinow`. #' @author Sam Abbott -#' @seealso regional_epinow rt_opts +#' @seealso [regional_epinow()] [rt_opts()] #' @export #' @examples #' # uses example case vector diff --git a/R/plot.R b/R/plot.R index 0fe5c4be4..46a8ff19f 100644 --- a/R/plot.R +++ b/R/plot.R @@ -2,16 +2,16 @@ #' #' @description `r lifecycle::badge("stable")` #' Adds lineranges for user specified credible intervals -#' @param plot A `ggplot2` plot +#' @param plot A `{ggplot2}` plot #' #' @param CrIs Numeric list of credible intervals present in the data. As -#' produced by `extract_CrIs` +#' produced by [extract_CrIs()]. #' #' @param alpha Numeric, overall alpha of the target line range #' #' @param linewidth Numeric, line width of the default line range. #' -#' @return A `ggplot2` plot. +#' @return A `{ggplot2}` plot. plot_CrIs <- function(plot, CrIs, alpha, linewidth) { index <- 1 alpha_per_CrI <- alpha / (length(CrIs) - 1) @@ -43,16 +43,16 @@ plot_CrIs <- function(plot, CrIs, alpha, linewidth) { #' Plot Estimates #' #' @description `r lifecycle::badge("questioning")` -#' Allows users to plot the output from `estimate_infections` easily. In future -#' releases it may be depreciated in favour of increasing the functionality of -#' the S3 plot methods. +#' Allows users to plot the output from [estimate_infections()] easily. +#' In future releases it may be depreciated in favour of increasing the +#' functionality of the S3 plot methods. #' -#' @param estimate A data.table of estimates containing the following +#' @param estimate A `` of estimates containing the following #' variables: date, type (must contain "estimate", "estimate based on partial #' data" and optionally "forecast"). #' -#' @param reported A data.table of reported cases with the following variables: -#' date, confirm. +#' @param reported A `` of reported cases with the following +#' variables: date, confirm. #' #' @param ylab Character string, defaulting to "Cases". Title for the plot y #' axis. @@ -232,11 +232,11 @@ plot_estimates <- function(estimate, reported, ylab = "Cases", hline, #' #' @description `r lifecycle::badge("questioning")` #' Used to return a summary plot across regions (using results generated by -#' `summarise_results`). +#' [summarise_results()]). #' #' May be depreciated in later releases in favour of enhanced S3 methods. #' -#' @param summary_results A data.table as returned by `summarise_results` (the +#' @param summary_results A data.table as returned by [summarise_results()] (the #' `data` object). #' #' @param x_lab A character string giving the label for the x axis, defaults to @@ -247,7 +247,7 @@ plot_estimates <- function(estimate, reported, ylab = "Cases", hline, #' #' @param max_cases Numeric, no default. The maximum number of cases to plot. #' -#' @return A `ggplot2` object +#' @return A `{ggplot2}` object #' @export #' @importFrom ggplot2 ggplot aes geom_linerange geom_hline facet_wrap #' @importFrom ggplot2 theme guides labs expand_limits guide_legend @@ -366,7 +366,7 @@ plot_summary <- function(summary_results, #' Plot method for estimate_infections #' #' @description `r lifecycle::badge("maturing")` -#' `plot` method for class "estimate_infections". +#' `plot` method for class ``. #' #' @param x A list of output as produced by `estimate_infections` #' @@ -380,7 +380,7 @@ plot_summary <- function(summary_results, #' @seealso plot report_plots estimate_infections #' @aliases plot #' @method plot estimate_infections -#' @return List of plots as produced by `report_plots` +#' @return List of plots as produced by [report_plots()] #' @export plot.estimate_infections <- function(x, type = "summary", ...) { out <- report_plots( @@ -407,12 +407,12 @@ plot.estimate_infections <- function(x, type = "summary", ...) { #' Plot method for epinow #' #' @description `r lifecycle::badge("maturing")` -#' `plot` method for class "epinow". -#' @param x A list of output as produced by `epinow` +#' `plot` method for class ``. +#' @param x A list of output as produced by [epinow()]. #' @inheritParams plot.estimate_infections #' @seealso plot plot.estimate_infections report_plots estimate_infections #' @method plot epinow -#' @return List of plots as produced by `report_plots` +#' @return List of plots as produced by [report_plots()] #' @export plot.epinow <- function(x, type = "summary", ...) { plot.estimate_infections(x$estimates, type = type, ...) diff --git a/R/regional_epinow.R b/R/regional_epinow.R index 400755637..e85deb4ac 100644 --- a/R/regional_epinow.R +++ b/R/regional_epinow.R @@ -1,26 +1,26 @@ #' Real-time Rt Estimation, Forecasting and Reporting by Region #' #' @description `r lifecycle::badge("maturing")` -#' Efficiently runs `epinow()` across multiple regions in an efficient manner +#' Efficiently runs [epinow()] across multiple regions in an efficient manner #' and conducts basic data checks and cleaning such as removing regions with #' fewer than `non_zero_points` as these are unlikely to produce reasonable #' results whilst consuming significant resources. See the documentation for -#' `epinow` for further information. +#' [epinow()] for further information. #' #' By default all arguments supporting input from `_opts()` functions are #' shared across regions (including delays, truncation, Rt settings, stan #' settings, and gaussian process settings). Region specific settings are #' supported by passing a named list of `_opts()` calls (with an entry per -#' region) to the relevant argument. A helper function (`opts_list`) is +#' region) to the relevant argument. A helper function ([opts_list()]) is #' available to facilitate building this list. #' #' Regions can be estimated in parallel using the `{future}` package (see -#' `setup_future`). The progress of producing estimates across multiple regions -#' is tracked using the `progressr` package. Modify this behaviour using -#' progressr::handlers and enable it in batch by setting +#' [setup_future()]). The progress of producing estimates across multiple +#' regions is tracked using the `{progressr}` package. Modify this behaviour +#' using [progressr::handlers()] and enable it in batch by setting #' `R_PROGRESSR_ENABLE=TRUE` as an environment variable. #' -#' @param reported_cases A data frame of confirmed cases (confirm) by date +#' @param reported_cases A `` of confirmed cases (confirm) by date #' (date), and region (`region`). #' #' @param non_zero_points Numeric, the minimum number of time points with @@ -36,22 +36,22 @@ #' summarised estimates and summary statistics. If `target_folder` is not NULL #' then the default is also to copy all results into a latest folder. #' -#' @param summary_args A list of arguments passed to `regional_summary`. See -#' the `regional_summary` documentation for details. +#' @param summary_args A list of arguments passed to [regional_summary()]. See +#' the [regional_summary()] documentation for details. #' #' @param verbose Logical defaults to FALSE. Outputs verbose progress messages -#' to the console from `epinow`. +#' to the console from [epinow()]. #' -#' @param ... Pass additional arguments to `epinow`. See the documentation for -#' `epinow` for details. +#' @param ... Pass additional arguments to [epinow()]. See the documentation for +#' [epinow()] for details. #' #' @inheritParams epinow #' @inheritParams regional_summary #' @return A list of output stratified at the top level into regional output #' and across region output summary output #' @export -#' @seealso epinow estimate_infections -#' @seealso setup_future regional_summary +#' @seealso [epinow()] [estimate_infections()] [setup_future()] +#' [regional_summary()] #' @importFrom future.apply future_lapply #' @importFrom data.table as.data.table setDT copy setorder #' @importFrom purrr safely map compact keep @@ -247,7 +247,7 @@ regional_epinow <- function(reported_cases, #' Removes regions with insufficient time points, and provides logging #' information on the input. #' -#' @seealso regional_epinow +#' @seealso [regional_epinow()] #' @inheritParams regional_epinow #' @importFrom data.table copy setDT #' @importFrom futile.logger flog.info @@ -295,12 +295,12 @@ clean_regions <- function(reported_cases, non_zero_points) { #' Run epinow with Regional Processing Code #' #' @description `r lifecycle::badge("maturing")` -#' Internal function that handles calling `epinow`. Future work will extend this -#' function to better handle `stan` logs and allow the user to modify settings -#' between regions. +#' Internal function that handles calling [epinow()]. Future work will extend +#' this function to better handle `{stan}` logs and allow the user to modify +#' settings between regions. #' #' @param target_region Character string indicating the region being evaluated -#' @param progress_fn Function as returned by `progressr::progressor`. Allows +#' @param progress_fn Function as returned by [progressr::progressor()]. Allows #' the use of a progress bar. #' #' @param complete_logger Character string indicating the logger to output @@ -309,8 +309,8 @@ clean_regions <- function(reported_cases, non_zero_points) { #' @inheritParams regional_epinow #' @importFrom futile.logger flog.trace flog.warn #' @importFrom purrr quietly -#' @seealso regional_epinow -#' @return A list of processed output as produced by `process_region` +#' @seealso [regional_epinow()] +#' @return A list of processed output as produced by [process_region()] run_region <- function(target_region, generation_time, delays, @@ -389,15 +389,15 @@ run_region <- function(target_region, #' @description `r lifecycle::badge("maturing")` #' Internal function that removes output that is not required, and returns #' logging information. -#' @param out List of output returned by `epinow` +#' @param out List of output returned by [epinow()] #' -#' @param timing Output from `Sys.time` +#' @param timing Output from [Sys.time()] #' #' @param return_timing Logical, should runtime be returned #' #' @inheritParams regional_epinow #' @inheritParams run_region -#' @seealso regional_epinow +#' @seealso [regional_epinow()] #' @importFrom futile.logger flog.info #' @return A list of processed output process_region <- function(out, target_region, timing, @@ -424,15 +424,16 @@ process_region <- function(out, target_region, timing, #' Process all Region Estimates #' #' @description `r lifecycle::badge("stable")` -#' Internal function that processes the output from multiple `epinow` runs, adds -#' summary logging information. -#' @param regional_out A list of output from multiple runs of `regional_epinow` +#' Internal function that processes the output from multiple [epinow()] runs, +#' adds summary logging information. +#' @param regional_out A list of output from multiple runs of +#' [regional_epinow()] #' #' @param regions A character vector identifying the regions that have been run #' #' @importFrom purrr keep map compact #' @importFrom futile.logger flog.trace flog.info -#' @seealso regional_epinow epinow +#' @seealso [regional_epinow()] [epinow()] #' @return A list of all regional estimates and successful regional estimates process_regions <- function(regional_out, regions) { # names on regional_out diff --git a/R/setup.R b/R/setup.R index 591a67a87..ddf381c98 100644 --- a/R/setup.R +++ b/R/setup.R @@ -1,11 +1,11 @@ #' Setup Logging #' #' @description `r lifecycle::badge("questioning")` -#' Sets up `futile.logger` logging, which is integrated into `EpiNow2`. See the -#' documentation for `futile.logger` for full details. By default `EpiNow2` -#' prints all logs at the "INFO" level and returns them to the console. Usage -#' of logging is currently being explored as the current setup cannot log stan -#' errors or progress. +#' Sets up `{futile.logger}` logging, which is integrated into `{EpiNow2}`. +#' See the documentation for `{futile.logger}` for full details. By default +#' `{EpiNow2}` prints all logs at the "INFO" level and returns them to the +#' console. Usage of logging is currently being explored as the current +#' setup cannot log stan errors or progress. #' #' @param threshold Character string indicating the logging level see #' (?futile.logger for details of the available options). Defaults to "INFO". @@ -19,9 +19,9 @@ #' @param name Character string defaulting to EpiNow2. This indicates the name #' of the logger to setup. The default logger for EpiNow2 is called EpiNow2. #' Nested options include: Epinow2.epinow which controls all logging for -#' `epinow` and nested functions, EpiNow2.epinow.estimate_infections (logging in -#' `estimate_infections`), and EpiNow2.epinow.estimate_infections.fit (logging -#' in fitting functions). +#' [epinow()] and nested functions, EpiNow2.epinow.estimate_infections +#' (logging in [estimate_infections()], and +#' EpiNow2.epinow.estimate_infections.fit (logging in fitting functions). #' #' @importFrom futile.logger flog.threshold flog.appender appender.tee #' @importFrom futile.logger appender.file flog.info @@ -66,11 +66,11 @@ setup_logging <- function(threshold = "INFO", file = NULL, #' @param logs Character path indicating the target folder in which to store log #' information. Defaults to the temporary directory if not specified. Default #' logging can be disabled if `logs` is set to NULL. If specifying a custom -#' logging setup then the code for `setup_default_logging` and the -#' `setup_logging` function are a sensible place to start. +#' logging setup then the code for [setup_default_logging()] and the +#' [setup_logging()] function are a sensible place to start. #' #' @param mirror_epinow Logical, defaults to FALSE. Should internal logging be -#' returned from `epinow` to the console. +#' returned from [epinow()] to the console. #' #' @inheritParams setup_target_folder #' @return No return value, called for side effects @@ -114,15 +114,16 @@ setup_default_logging <- function(logs = tempdir(check = TRUE), #' @description `r lifecycle::badge("stable")` #' A utility function that aims to streamline the set up #' of the required future backend with sensible defaults for most users of -#' `regional_epinow`. More advanced users are recommended to setup their own -#' `future` backend based on their available resources. +#' [regional_epinow()]. More advanced users are recommended to setup their own +#' `{future}` backend based on their available resources. #' #' @param strategies A vector length 1 to 2 of strategies to pass to -#' `future::plan`. Nesting of parallelisation is from the top level down. +#' [future::plan()]. Nesting of parallelisation is from the top level down. #' The default is to set up nesting parallelisation with both using -#' `future::multisession` (`future::multicore` will likely be a faster option on -#' supported platforms). For single level parallelisation use a single strategy -#' or `future::plan` directly. See `?future::plan` for options. +#' [future::multisession()] ([future::multicore()] will likely be a faster +#' option on supported platforms). For single level parallelisation use a +#' single strategy or [future::plan()] directly. See [future::plan()] for +#' options. #' #' @param min_cores_per_worker Numeric, the minimum number of cores per worker. #' Defaults to 4 which assumes 4 MCMC chains are in use per region. @@ -182,8 +183,8 @@ setup_future <- function(reported_cases, #' Convert to Data Table #' @description `r lifecycle::badge("stable")` -#' Convenience function that sets the number of `data.table` cores to 1 and -#' maps input to be a `data.table` +#' Convenience function that sets the number of `{data.table}` cores to 1 and +#' maps input to be a `{data.table}` #' @inheritParams estimate_infections #' @return A data table #' @export diff --git a/R/simulate_infections.R b/R/simulate_infections.R index 8adf2db27..081d37f34 100644 --- a/R/simulate_infections.R +++ b/R/simulate_infections.R @@ -5,28 +5,28 @@ #' This function simulates infections using an existing fit to observed cases #' but with a modified time-varying reproduction number. This can be used to #' explore forecast models or past counterfactuals. Simulations can be run in -#' parallel using `future::plan`. +#' parallel using [future::plan()]. #' -#' @param estimates The \code{estimates} element of an \code{epinow} run that +#' @param estimates The \code{estimates} element of an [epinow()] run that #' has been done with output = "fit", or the result of -#' \code{estimate_infections} with \code{return_fit} set to TRUE. +#' [estimate_infections()] with \code{return_fit} set to TRUE. #' -#' @param model A compiled stan model as returned by `rstan::stan_model`. +#' @param model A compiled stan model as returned by [rstan::stan_model()]. #' #' @param R A numeric vector of reproduction numbers; these will overwrite the #' reproduction numbers contained in \code{estimates}, except elements set to -#' NA. Alternatively accepts a data.frame containing at least `date` and `value` -#' (integer) variables and optionally `sample`. More (or fewer) days than in -#' the original fit can be simulated. +#' NA. Alternatively accepts a `` containing at least `date` and +#' `value` (integer) variables and optionally `sample`. More (or fewer) days +#' than in the original fit can be simulated. #' #' @param samples Numeric, number of posterior samples to simulate from. The #' default is to use all samples in the `estimates` input. #' #' @param batch_size Numeric, defaults to 10. Size of batches in which to #' simulate. May decrease run times due to reduced IO costs but this is still -#' being evaluated. If set to NULL then al simulations are done at once. +#' being evaluated. If set to NULL then all simulations are done at once. #' -#' @param verbose Logical defaults to `interactive()`. Should a progress bar +#' @param verbose Logical defaults to [interactive()]. Should a progress bar #' (from `progressr`) be shown. #' @importFrom rstan extract sampling #' @importFrom purrr transpose map safely compact @@ -38,6 +38,9 @@ #' assert_numeric assert_integerish assert_logical #' @return A list of output as returned by [estimate_infections()] but based on #' results from the specified scenario rather than fitting. +#' @seealso [dist_spec()] [generation_time_opts()] [delay_opts()] [rt_opts()] +#' [estimate_infections()] [trunc_opts()] [stan_opts()] [obs_opts()] +#' [gp_opts()] #' @export #' @examples #' \donttest{ diff --git a/R/summarise.R b/R/summarise.R index 100dd9028..09d5d1ef9 100644 --- a/R/summarise.R +++ b/R/summarise.R @@ -7,7 +7,7 @@ #' @param regions An character string containing the list of regions to extract #' results for (must all have results for the same target date). #' -#' @param summaries A list of summary data frames as output by `epinow` +#' @param summaries A list of summary ``s as output by `epinow` #' #' @param results_dir An optional character string indicating the location of #' the results directory to extract results from. @@ -410,8 +410,8 @@ regional_summary <- function(regional_output = NULL, #' Summarise rt and cases #' #' @description `r lifecycle::badge("maturing")` -#' Produces summarised data frames of output across regions. Used internally by -#' `regional_summary`. +#' Produces summarised ``s of output across regions. +#' Used internally by `regional_summary`. #' #' @param regional_results A list of dataframes as produced by #' `get_regional_results` @@ -636,9 +636,11 @@ calc_CrIs <- function(samples, summarise_by = NULL, CrIs = c(0.2, 0.5, 0.9)) { #' Extract Credible Intervals Present #' #' @description `r lifecycle::badge("stable")` -#' Helper function to extract the credible intervals present in a data frame. -#' @param summarised A data frame as processed by `calc_CrIs` -#' @return A numeric vector of credible intervals detected in the data frame. +#' Helper function to extract the credible intervals present in a +#' ``. +#' @param summarised A `` as processed by `calc_CrIs` +#' @return A numeric vector of credible intervals detected in +#' the ``. #' @export #' @examples #' samples <- data.frame(value = 1:10, type = "car") @@ -657,8 +659,8 @@ extract_CrIs <- function(summarised) { #' Calculate Summary Statistics #' #' @description `r lifecycle::badge("stable")` -#' Calculate summary statistics from a data frame by group. Currently supports -#' the mean, median and standard deviation. +#' Calculate summary statistics from a `` by group. +#' Currently supports the mean, median and standard deviation. #' @return A data.table containing the upper and lower bounds for the specified #' credible interval #' @export @@ -686,7 +688,7 @@ calc_summary_stats <- function(samples, summarise_by = NULL) { #' Calculate All Summary Measures #' #' @description `r lifecycle::badge("stable")` -#' Calculate summary statistics and credible intervals from a data frame by +#' Calculate summary statistics and credible intervals from a `` by #' group. #' #' @param order_by A character vector of parameters to order by, defaults to @@ -748,7 +750,7 @@ calc_summary_measures <- function(samples, #' @seealso summary.estimate_infections epinow #' @aliases summary #' @method summary epinow -#' @return Returns a data frame of summary output +#' @return Returns a `` of summary output #' @export summary.epinow <- function(object, output = "estimates", date = NULL, params = NULL, @@ -796,7 +798,7 @@ summary.epinow <- function(object, output = "estimates", #' @importFrom rlang arg_match #' @seealso summary estimate_infections report_summary #' @method summary estimate_infections -#' @return Returns a data frame of summary output +#' @return Returns a `` of summary output #' @export summary.estimate_infections <- function(object, type = "snapshot", date = NULL, params = NULL, ...) { diff --git a/R/utilities.R b/R/utilities.R index 55adb7504..1c9751672 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -106,7 +106,7 @@ map_prob_change <- function(var) { #' #' @description `r lifecycle::badge("questioning")` #' See [here](https://www.medrxiv.org/content/10.1101/2020.01.30.20019877v3.full.pdf) # nolint -#' for justification. Now handled internally by stan so may be removed in +#' for justification. Now handled internally by `{stan}` so may be removed in #' future updates if no user demand. #' @param r Numeric, rate of growth estimates. #' @@ -146,7 +146,7 @@ R_to_growth <- function(R, gamma_mean, gamma_sd) { #' Allocate Delays into Required Stan Format #' #' @description `r lifecycle::badge("stable")` -#' Allocate delays for stan. Used in `delay_opts()`. +#' Allocate delays for `{stan}`. Used in [delay_opts()]. #' @param delay_var List of numeric delays #' @param no_delays Numeric, number of delays #' @return A numeric array @@ -163,7 +163,7 @@ allocate_delays <- function(delay_var, no_delays) { #' #' @description `r lifecycle::badge("stable")` #' Allocate missing parameters to be empty two dimensional arrays. Used -#' internally by `simulate_infections.` +#' internally by [simulate_infections()]. #' @param data A list of parameters #' @param params A character vector of parameters to allocate to #' empty if missing. @@ -236,7 +236,7 @@ match_output_arguments <- function(input_args = NULL, #' Expose internal package stan functions in R #' #' @description `r lifecycle::badge("stable")` -#' his function exposes internal stan functions in R from a user +#' his function exposes internal `{stan}` functions in R from a user #' supplied list of target files. Allows for testing of stan functions in R and #' potentially user use in R code. #' @@ -245,7 +245,7 @@ match_output_arguments <- function(input_args = NULL, #' @param target_dir A character string indicating the target directory for the #' file. #' -#' @param ... Additional arguments passed to `rstan::expose_stan_functions`. +#' @param ... Additional arguments passed to [rstan::expose_stan_functions()]. #' #' @return No return value, called for side effects #' @export @@ -272,7 +272,7 @@ expose_stan_fns <- function(files, target_dir, ...) { #' @description `r lifecycle::badge("stable")` #' Convert from mean and standard deviation to the log mean of the #' lognormal distribution. Useful for defining distributions supported by -#' `estimate_infections`, `epinow`, and `regional_epinow`. +#' [estimate_infections()], [epinow()], and [regional_epinow()]. #' @param mean Numeric, mean of a distribution #' @param sd Numeric, standard deviation of a distribution #' @@ -291,7 +291,7 @@ convert_to_logmean <- function(mean, sd) { #' @description `r lifecycle::badge("stable")` #' Convert from mean and standard deviation to the log standard deviation of the #' lognormal distribution. Useful for defining distributions supported by -#' `estimate_infections`, `epinow`, and `regional_epinow`. +#' [estimate_infections()], [epinow()], and [regional_epinow()]. #' @param mean Numeric, mean of a distribution #' @param sd Numeric, standard deviation of a distribution #' @@ -344,7 +344,7 @@ discretised_gamma_pmf <- function(mean, sd, max_d, zero_pad = 0, #' #' @description `r lifecycle::badge("deprecated")` #' Used to handle updating settings in a list. For example when making -#' changes to `opts_list` output. +#' changes to [opts_list()] output. #' @param defaults A list of default settings #' @param optional A list of optional settings to override defaults #' @importFrom lifecycle deprecate_stop @@ -387,10 +387,10 @@ add_day_of_week <- function(dates, week_effect = 7) { #' Set to Single Threading #' -#' This function sets the threads used by data.table to 1 in the parent function -#' and then restores the initial data.table threads when the function exits. -#' This is primarily used as an internal function inside of other functions -#' and will generally not be used on its own. +#' This function sets the threads used by `{data.table}` to 1 in the parent +#' function and then restores the initial `{data.table}` threads when the +#' function exits. This is primarily used as an internal function inside of +#' other functions and will generally not be used on its own. #' #' @importFrom data.table getDTthreads setDTthreads #' @keywords internal diff --git a/man/adjust_infection_to_report.Rd b/man/adjust_infection_to_report.Rd index 8fb319d8d..cbfb34b19 100644 --- a/man/adjust_infection_to_report.Rd +++ b/man/adjust_infection_to_report.Rd @@ -14,12 +14,12 @@ adjust_infection_to_report( ) } \arguments{ -\item{infections}{\code{data.table} containing a \code{date} variable and a numeric +\item{infections}{\verb{} containing a \code{date} variable and a numeric \code{cases} variable.} \item{delay_defs}{A list of single row data.tables that each defines a delay distribution (model, parameters and maximum delay for each model). -See \code{lognorm_dist_def} for an example of the structure.} +See \code{\link[=lognorm_dist_def]{lognorm_dist_def()}} for an example of the structure.} \item{reporting_model}{A function that takes a single numeric vector as an argument and returns a single numeric vector. Can be used to apply stochastic diff --git a/man/allocate_delays.Rd b/man/allocate_delays.Rd index fb3a7289c..65774cc88 100644 --- a/man/allocate_delays.Rd +++ b/man/allocate_delays.Rd @@ -16,5 +16,5 @@ A numeric array } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Allocate delays for stan. Used in \code{delay_opts()}. +Allocate delays for \code{{stan}}. Used in \code{\link[=delay_opts]{delay_opts()}}. } diff --git a/man/allocate_empty.Rd b/man/allocate_empty.Rd index 60557a548..595d48f62 100644 --- a/man/allocate_empty.Rd +++ b/man/allocate_empty.Rd @@ -20,5 +20,5 @@ A list of parameters some allocated to be empty \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Allocate missing parameters to be empty two dimensional arrays. Used -internally by \code{simulate_infections.} +internally by \code{\link[=simulate_infections]{simulate_infections()}}. } diff --git a/man/bootstrapped_dist_fit.Rd b/man/bootstrapped_dist_fit.Rd index 840b73e35..00a19ff9c 100644 --- a/man/bootstrapped_dist_fit.Rd +++ b/man/bootstrapped_dist_fit.Rd @@ -38,7 +38,7 @@ data. Maximum delay to allow (added to output but does impact fitting).} printed.} } \value{ -A \code{dist_spec} object summarising the bootstrapped distribution +A \verb{} object summarising the bootstrapped distribution } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/c.dist_spec.Rd b/man/c.dist_spec.Rd index c26c47dfa..728fecc9d 100644 --- a/man/c.dist_spec.Rd +++ b/man/c.dist_spec.Rd @@ -10,7 +10,7 @@ \item{...}{The delay distributions (from calls to \code{\link[=dist_spec]{dist_spec()}}) to combine} } \value{ -Combined delay distributions (with class \code{\link[=dist_spec]{dist_spec()}}`) +Combined delay distributions (with class \verb{}) } \description{ This combines the parameters so that they can be fed as multiple delay diff --git a/man/calc_summary_measures.Rd b/man/calc_summary_measures.Rd index 16f1397b0..738010aa4 100644 --- a/man/calc_summary_measures.Rd +++ b/man/calc_summary_measures.Rd @@ -26,7 +26,7 @@ A data.table containing summary statistics by group. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Calculate summary statistics and credible intervals from a data frame by +Calculate summary statistics and credible intervals from a \verb{} by group. } \examples{ diff --git a/man/calc_summary_stats.Rd b/man/calc_summary_stats.Rd index e69c15caf..3633b3d42 100644 --- a/man/calc_summary_stats.Rd +++ b/man/calc_summary_stats.Rd @@ -17,7 +17,7 @@ credible interval } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Calculate summary statistics from a data frame by group. Currently supports +Calculate summary statistics from a \verb{} by group. Currently supports the mean, median and standard deviation. } \examples{ diff --git a/man/clean_regions.Rd b/man/clean_regions.Rd index 83cd513a6..28edeed13 100644 --- a/man/clean_regions.Rd +++ b/man/clean_regions.Rd @@ -7,7 +7,7 @@ clean_regions(reported_cases, non_zero_points) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date), and region (\code{region}).} \item{non_zero_points}{Numeric, the minimum number of time points with @@ -23,5 +23,5 @@ Removes regions with insufficient time points, and provides logging information on the input. } \seealso{ -regional_epinow +\code{\link[=regional_epinow]{regional_epinow()}} } diff --git a/man/convert_to_logmean.Rd b/man/convert_to_logmean.Rd index 327e68c13..f3f166741 100644 --- a/man/convert_to_logmean.Rd +++ b/man/convert_to_logmean.Rd @@ -18,7 +18,7 @@ The log mean of a lognormal distribution \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Convert from mean and standard deviation to the log mean of the lognormal distribution. Useful for defining distributions supported by -\code{estimate_infections}, \code{epinow}, and \code{regional_epinow}. +\code{\link[=estimate_infections]{estimate_infections()}}, \code{\link[=epinow]{epinow()}}, and \code{\link[=regional_epinow]{regional_epinow()}}. } \examples{ diff --git a/man/convert_to_logsd.Rd b/man/convert_to_logsd.Rd index 6d6bec5bf..69233ceb6 100644 --- a/man/convert_to_logsd.Rd +++ b/man/convert_to_logsd.Rd @@ -18,7 +18,7 @@ The log standard deviation of a lognormal distribution \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Convert from mean and standard deviation to the log standard deviation of the lognormal distribution. Useful for defining distributions supported by -\code{estimate_infections}, \code{epinow}, and \code{regional_epinow}. +\code{\link[=estimate_infections]{estimate_infections()}}, \code{\link[=epinow]{epinow()}}, and \code{\link[=regional_epinow]{regional_epinow()}}. } \examples{ diff --git a/man/create_backcalc_data.Rd b/man/create_backcalc_data.Rd index 154db2453..b6c78a59e 100644 --- a/man/create_backcalc_data.Rd +++ b/man/create_backcalc_data.Rd @@ -7,16 +7,16 @@ create_backcalc_data(backcalc = backcalc_opts()) } \arguments{ -\item{backcalc}{A list of options as generated by \code{backcalc_opts()} to -define the back calculation. Defaults to \code{backcalc_opts()}.} +\item{backcalc}{A list of options as generated by \code{\link[=backcalc_opts]{backcalc_opts()}} to +define the back calculation. Defaults to \code{\link[=backcalc_opts]{backcalc_opts()}}.} } \value{ A list of settings defining the Gaussian process } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Takes the output of \code{backcalc_opts()} and converts it into a list understood -by \code{stan}. +Takes the output of \code{\link[=backcalc_opts]{backcalc_opts()}} and converts it into a list understood +by \code{{stan}}. } \examples{ create_backcalc_data(backcalc = backcalc_opts()) diff --git a/man/create_clean_reported_cases.Rd b/man/create_clean_reported_cases.Rd index 245090fa3..fddf60d2c 100644 --- a/man/create_clean_reported_cases.Rd +++ b/man/create_clean_reported_cases.Rd @@ -12,7 +12,7 @@ create_clean_reported_cases( ) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} \item{horizon}{Numeric, defaults to 7. Number of days into the future to diff --git a/man/create_future_rt.Rd b/man/create_future_rt.Rd index 39b3adebc..40593c7ca 100644 --- a/man/create_future_rt.Rd +++ b/man/create_future_rt.Rd @@ -22,8 +22,8 @@ A list containing a logical called fixed and an integer called from } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Converts the \code{future} argument from \code{rt_opts()} into arguments that can be -passed to \code{stan}. +Converts the \code{future} argument from \code{\link[=rt_opts]{rt_opts()}} into arguments that can be +passed to \code{{stan}}. } \author{ Sam Abbott diff --git a/man/create_gp_data.Rd b/man/create_gp_data.Rd index 02cca9276..b742db1aa 100644 --- a/man/create_gp_data.Rd +++ b/man/create_gp_data.Rd @@ -7,8 +7,8 @@ create_gp_data(gp = gp_opts(), data) } \arguments{ -\item{gp}{A list of options as generated by \code{gp_opts()} to define the -Gaussian process. Defaults to \code{gp_opts()}.Set to NULL to disable the +\item{gp}{A list of options as generated by \code{\link[=gp_opts]{gp_opts()}} to define the +Gaussian process. Defaults to \code{\link[=gp_opts]{gp_opts()}}. Set to \code{NULL} to disable the Gaussian process.} \item{data}{A list containing the following numeric values: @@ -19,8 +19,8 @@ A list of settings defining the Gaussian process } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Takes the output of \code{gp_opts()} and converts it into a list understood by -\code{stan}. +Takes the output of \code{\link[=gp_opts]{gp_opts()}} and converts it into a list understood by +\code{{stan}}. } \examples{ # define input data required @@ -40,7 +40,7 @@ create_gp_data(NULL, data) create_gp_data(gp_opts(ls_mean = 14), data) } \seealso{ -gp_opts +\code{\link[=gp_opts]{gp_opts()}} } \author{ Sam Abbott diff --git a/man/create_initial_conditions.Rd b/man/create_initial_conditions.Rd index 96c8ec1fb..36395e40f 100644 --- a/man/create_initial_conditions.Rd +++ b/man/create_initial_conditions.Rd @@ -7,15 +7,15 @@ create_initial_conditions(data) } \arguments{ -\item{data}{A list of data as produced by \code{create_stan_data.}} +\item{data}{A list of data as produced by \code{\link[=create_stan_data]{create_stan_data()}}.} } \value{ An initial condition generating function } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Uses the output of \code{create_stan_data} to create a function which can be used -to sample from the prior distributions (or as close as possible) for -parameters. Used in order to initialise each \code{stan} chain within a range of +Uses the output of \code{\link[=create_stan_data]{create_stan_data()}} to create a function which can be +used to sample from the prior distributions (or as close as possible) for +parameters. Used in order to initialise each \code{{stan}} chain within a range of plausible values. } diff --git a/man/create_obs_model.Rd b/man/create_obs_model.Rd index 335cefd24..c82103a31 100644 --- a/man/create_obs_model.Rd +++ b/man/create_obs_model.Rd @@ -7,19 +7,19 @@ create_obs_model(obs = obs_opts(), dates) } \arguments{ -\item{obs}{A list of options as generated by \code{obs_opts()} defining the -observation model. Defaults to \code{obs_opts()}.} +\item{obs}{A list of options as generated by \code{\link[=obs_opts]{obs_opts()}} defining the +observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} \item{dates}{A vector of dates used to calculate the day of the week.} } \value{ -A list of settings ready to be passed to stan defining +A list of settings ready to be passed to \code{{stan}} defining the Observation Model } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Takes the output of \code{obs_opts()} and converts it into a list understood -by \code{stan}. +Takes the output of \code{\link[=obs_opts]{obs_opts()}} and converts it into a list understood +by \code{{stan}}. } \examples{ dates <- seq(as.Date("2020-03-15"), by = "days", length.out = 15) @@ -38,7 +38,7 @@ create_obs_model( create_obs_model(obs_opts(week_length = 3), dates = dates) } \seealso{ -obs_opts +\code{\link[=obs_opts]{obs_opts()}} } \author{ Sam Abbott diff --git a/man/create_rt_data.Rd b/man/create_rt_data.Rd index 1b73f5618..142d16ac3 100644 --- a/man/create_rt_data.Rd +++ b/man/create_rt_data.Rd @@ -7,8 +7,8 @@ create_rt_data(rt = rt_opts(), breakpoints = NULL, delay = 0, horizon = 0) } \arguments{ -\item{rt}{A list of options as generated by \code{rt_opts()} defining Rt -estimation. Defaults to \code{rt_opts()}. Set to \code{NULL} to switch to using back +\item{rt}{A list of options as generated by \code{\link[=rt_opts]{rt_opts()}} defining Rt +estimation. Defaults to \code{\link[=rt_opts]{rt_opts()}}. Set to \code{NULL} to switch to using back calculation rather than generating infections using Rt.} \item{breakpoints}{An integer vector (binary) indicating the location of @@ -23,8 +23,8 @@ A list of settings defining the time-varying reproduction number } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Takes the output from \code{rt_opts()} and converts it into a list understood by -\code{stan}. +Takes the output from \code{\link[=rt_opts]{rt_opts()}} and converts it into a list understood by +\code{{stan}}. } \examples{ # default Rt data diff --git a/man/create_shifted_cases.Rd b/man/create_shifted_cases.Rd index 4ea38de13..ffbfb3830 100644 --- a/man/create_shifted_cases.Rd +++ b/man/create_shifted_cases.Rd @@ -7,7 +7,7 @@ create_shifted_cases(reported_cases, shift, smoothing_window, horizon) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} \item{shift}{Numeric, mean delay shift to apply.} @@ -19,7 +19,7 @@ to apply. Must be odd in order to be defined as a centred average.} forecast.} } \value{ -A data frame for shifted reported cases +A \verb{} for shifted reported cases } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} @@ -27,8 +27,8 @@ A data frame for shifted reported cases This functions creates a data frame of reported cases that has been smoothed using a centred partial rolling average (with a period set by \code{smoothing_window}) and shifted back in time by some delay. It is used by -\code{estimate_infections} to generate the mean shifted prior on which the back -calculation method (see \code{backcalc_opts()}) is based. +\code{\link[=estimate_infections]{estimate_infections()}} to generate the mean shifted prior on which the back +calculation method (see \code{\link[=backcalc_opts]{backcalc_opts()}}) is based. } \examples{ create_shifted_cases(example_confirmed, 7, 14, 7) diff --git a/man/create_stan_args.Rd b/man/create_stan_args.Rd index 9d7c2583a..ac843d00b 100644 --- a/man/create_stan_args.Rd +++ b/man/create_stan_args.Rd @@ -12,27 +12,27 @@ create_stan_args( ) } \arguments{ -\item{stan}{A list of stan options as generated by \code{stan_opts()}. Defaults -to \code{stan_opts()}. Can be used to override \code{data}, \code{init}, and \code{verbose} +\item{stan}{A list of stan options as generated by \code{\link[=stan_opts]{stan_opts()}}. Defaults +to \code{\link[=stan_opts]{stan_opts()}}. Can be used to override \code{data}, \code{init}, and \code{verbose} settings if desired.} -\item{data}{A list of stan data as created by \code{create_stan_data}} +\item{data}{A list of \code{{stan}} data as created by \code{\link[=create_stan_data]{create_stan_data()}}} -\item{init}{Initial conditions passed to \code{rstan}. Defaults to "random" but -can also be a function (as supplied by \code{create_intitial_conditions}).} +\item{init}{Initial conditions passed to \code{{rstan}}. Defaults to "random" but +can also be a function (as supplied by \code{\link[=create_intitial_conditions]{create_intitial_conditions()}}).} \item{verbose}{Logical, defaults to \code{FALSE}. Should verbose progress messages be returned.} } \value{ -A list of stan arguments +A list of \code{{stan}} arguments } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Generates a list of arguments as required by \code{rstan::sampling} or -\code{rstan::vb} by combining the required options, with data, and type of +Generates a list of arguments as required by \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}} or +\code{\link[rstan:stanmodel-method-vb]{rstan::vb()}} by combining the required options, with data, and type of initialisation. Initialisation defaults to random but it is expected that -\code{create_initial_conditions} will be used. +\code{\link[=create_initial_conditions]{create_initial_conditions()}} will be used. } \examples{ # default settings diff --git a/man/create_stan_data.Rd b/man/create_stan_data.Rd index 361636e29..58f908106 100644 --- a/man/create_stan_data.Rd +++ b/man/create_stan_data.Rd @@ -16,38 +16,39 @@ create_stan_data( ) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} \item{seeding_time}{Integer; seeding time, usually obtained using -\code{get_seeding_time()}} +\code{\link[=get_seeding_time]{get_seeding_time()}}.} -\item{rt}{A list of options as generated by \code{rt_opts()} defining Rt -estimation. Defaults to \code{rt_opts()}. Set to \code{NULL} to switch to using back +\item{rt}{A list of options as generated by \code{\link[=rt_opts]{rt_opts()}} defining Rt +estimation. Defaults to \code{\link[=rt_opts]{rt_opts()}}. Set to \code{NULL} to switch to using back calculation rather than generating infections using Rt.} -\item{gp}{A list of options as generated by \code{gp_opts()} to define the -Gaussian process. Defaults to \code{gp_opts()}.Set to NULL to disable the +\item{gp}{A list of options as generated by \code{\link[=gp_opts]{gp_opts()}} to define the +Gaussian process. Defaults to \code{\link[=gp_opts]{gp_opts()}}. Set to \code{NULL} to disable the Gaussian process.} -\item{obs}{A list of options as generated by \code{obs_opts()} defining the -observation model. Defaults to \code{obs_opts()}.} +\item{obs}{A list of options as generated by \code{\link[=obs_opts]{obs_opts()}} defining the +observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} \item{horizon}{Numeric, forecast horizon.} -\item{backcalc}{A list of options as generated by \code{backcalc_opts()} to -define the back calculation. Defaults to \code{backcalc_opts()}.} +\item{backcalc}{A list of options as generated by \code{\link[=backcalc_opts]{backcalc_opts()}} to +define the back calculation. Defaults to \code{\link[=backcalc_opts]{backcalc_opts()}}.} -\item{shifted_cases}{A dataframe of delay shifted cases} +\item{shifted_cases}{A \verb{} of delay shifted cases} } \value{ A list of stan data } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Takes the output of \code{stan_opts()} and converts it into a list understood by -\code{stan}. Internally calls the other \code{create_} family of functions to -construct a single list for input into stan with all data required present. +Takes the output of \code{\link[=stan_opts]{stan_opts()}} and converts it into a list understood by +\code{{stan}}. Internally calls the other \code{create_} family of functions to +construct a single list for input into \code{{stan}} with all data required +present. } \author{ Sam Abbott diff --git a/man/delay_opts.Rd b/man/delay_opts.Rd index 970635e71..6f6973f58 100644 --- a/man/delay_opts.Rd +++ b/man/delay_opts.Rd @@ -38,7 +38,8 @@ delay_opts(delay) delay_opts(delay + delay) } \seealso{ -convert_to_logmean convert_to_logsd bootstrapped_dist_fit dist_spec +\code{\link[=convert_to_logmean]{convert_to_logmean()}} \code{\link[=convert_to_logsd]{convert_to_logsd()}} +\code{\link[=bootstrapped_dist_fit]{bootstrapped_dist_fit()}} \code{\link[=dist_spec]{dist_spec()}} } \author{ Sam Abbott diff --git a/man/dist_fit.Rd b/man/dist_fit.Rd index d9996675e..9cd352e98 100644 --- a/man/dist_fit.Rd +++ b/man/dist_fit.Rd @@ -33,12 +33,12 @@ also supported.} be printed.} } \value{ -A \code{stan} fit of an interval censored distribution +A \code{{stan}} fit of an interval censored distribution } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Fits an integer adjusted exponential, gamma or lognormal distribution using -\code{stan}. +\code{{stan}}. } \examples{ \donttest{ diff --git a/man/dist_skel.Rd b/man/dist_skel.Rd index a3e7d84f8..37d1aff83 100644 --- a/man/dist_skel.Rd +++ b/man/dist_skel.Rd @@ -49,7 +49,7 @@ A vector of samples or a probability distribution. \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} This function acts as a skeleton for a truncated distribution defined by model type, maximum value and model parameters. It is designed to be used -with the output from \code{get_dist}. +with the output from \code{\link[=get_dist]{get_dist()}}. } \examples{ diff --git a/man/dist_spec.Rd b/man/dist_spec.Rd index 9e03f5690..67dda4677 100644 --- a/man/dist_spec.Rd +++ b/man/dist_spec.Rd @@ -63,7 +63,7 @@ probability mass function of the delay (starting with 0); defaults to an empty vector corresponding to a parametric specification of the distribution (using \code{mean}, \code{sd} and corresponding uncertainties)} -\item{fixed}{Logical, defaults to \code{FALSE}. Should delays be treated +\item{fixed}{Deprecated, use \link{fix_dist() instead} as coming from fixed (vs uncertain) distributions. Overrides any values assigned to \code{mean_sd} and \code{sd_sd} by setting them to zero. reduces compute requirement but may produce spuriously precise estimates.} diff --git a/man/dist_spec_plus.Rd b/man/dist_spec_plus.Rd index ddfe389d5..d04f85078 100644 --- a/man/dist_spec_plus.Rd +++ b/man/dist_spec_plus.Rd @@ -26,7 +26,7 @@ A delay distribution representing the sum of the two delays (with class \code{\link[=dist_spec]{dist_spec()}}) } \description{ -This is done via convolution with \code{stats::convolve()}. Nonparametric delays +This is done via convolution with \code{\link[stats:convolve]{stats::convolve()}}. Nonparametric delays that can be combined are processed together, and their cumulative distribution function is truncated at a specified tolerance level, ensuring numeric stability. diff --git a/man/epinow.Rd b/man/epinow.Rd index 74b6b4bc8..36225af0b 100644 --- a/man/epinow.Rd +++ b/man/epinow.Rd @@ -29,37 +29,37 @@ epinow( ) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} -\item{generation_time}{A call to \code{generation_time_opts()} defining the +\item{generation_time}{A call to \code{\link[=generation_time_opts]{generation_time_opts()}} defining the generation time distribution used. For backwards compatibility a list of summary parameters can also be passed.} -\item{delays}{A call to \code{delay_opts()} defining delay distributions and -options. See the documentation of \code{delay_opts()} and the examples below for +\item{delays}{A call to \code{\link[=delay_opts]{delay_opts()}} defining delay distributions and +options. See the documentation of \code{\link[=delay_opts]{delay_opts()}} and the examples below for details.} -\item{truncation}{A call to \code{trunc_opts()} defining the truncation of -observed data. Defaults to \code{trunc_opts()}. See \code{estimate_truncation()} for +\item{truncation}{A call to \code{\link[=trunc_opts]{trunc_opts()}} defining the truncation of +observed data. Defaults to \code{\link[=trunc_opts]{trunc_opts()}}. See \code{\link[=estimate_truncation]{estimate_truncation()}} for an approach to estimating truncation from data.} -\item{rt}{A list of options as generated by \code{rt_opts()} defining Rt -estimation. Defaults to \code{rt_opts()}. Set to \code{NULL} to switch to using back +\item{rt}{A list of options as generated by \code{\link[=rt_opts]{rt_opts()}} defining Rt +estimation. Defaults to \code{\link[=rt_opts]{rt_opts()}}. Set to \code{NULL} to switch to using back calculation rather than generating infections using Rt.} -\item{backcalc}{A list of options as generated by \code{backcalc_opts()} to -define the back calculation. Defaults to \code{backcalc_opts()}.} +\item{backcalc}{A list of options as generated by \code{\link[=backcalc_opts]{backcalc_opts()}} to +define the back calculation. Defaults to \code{\link[=backcalc_opts]{backcalc_opts()}}.} -\item{gp}{A list of options as generated by \code{gp_opts()} to define the -Gaussian process. Defaults to \code{gp_opts()}.Set to NULL to disable the +\item{gp}{A list of options as generated by \code{\link[=gp_opts]{gp_opts()}} to define the +Gaussian process. Defaults to \code{\link[=gp_opts]{gp_opts()}}. Set to \code{NULL} to disable the Gaussian process.} -\item{obs}{A list of options as generated by \code{obs_opts()} defining the -observation model. Defaults to \code{obs_opts()}.} +\item{obs}{A list of options as generated by \code{\link[=obs_opts]{obs_opts()}} defining the +observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} -\item{stan}{A list of stan options as generated by \code{stan_opts()}. Defaults -to \code{stan_opts()}. Can be used to override \code{data}, \code{init}, and \code{verbose} +\item{stan}{A list of stan options as generated by \code{\link[=stan_opts]{stan_opts()}}. Defaults +to \code{\link[=stan_opts]{stan_opts()}}. Can be used to override \code{data}, \code{init}, and \code{verbose} settings if desired.} \item{horizon}{Numeric, defaults to 7. Number of days into the future to @@ -85,7 +85,7 @@ copying the dated folder into a latest folder (if \code{target_folder} is not null, set using "latest"), and the stan fit ("fit"). The default is to return all options.} -\item{plot_args}{A list of optional arguments passed to \code{plot.epinow()}.} +\item{plot_args}{A list of optional arguments passed to \code{\link[=plot.epinow]{plot.epinow()}}.} \item{target_folder}{Character string specifying where to save results (will create if not present).} @@ -96,11 +96,11 @@ specified.} \item{logs}{Character path indicating the target folder in which to store log information. Defaults to the temporary directory if not specified. Default logging can be disabled if \code{logs} is set to NULL. If specifying a custom -logging setup then the code for \code{setup_default_logging} and the -\code{setup_logging} function are a sensible place to start.} +logging setup then the code for \code{\link[=setup_default_logging]{setup_default_logging()}} and the +\code{\link[=setup_logging]{setup_logging()}} function are a sensible place to start.} \item{id}{A character string used to assign logging information on error. -Used by \code{regional_epinow} to assign errors to regions. Alter the default to +Used by \code{\link[=regional_epinow]{regional_epinow()}} to assign errors to regions. Alter the default to run with error catching.} \item{verbose}{Logical, defaults to \code{TRUE} when used interactively and @@ -114,13 +114,13 @@ summarising results and reporting errors if they have occurred. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -This function wraps the functionality of \code{estimate_infections()} in order +This function wraps the functionality of \code{\link[=estimate_infections]{estimate_infections()}} in order to estimate Rt and cases by date of infection and forecast these infections into the future. In addition to the functionality of -\code{estimate_infections()} it produces additional summary output useful for +\code{\link[=estimate_infections]{estimate_infections()}} it produces additional summary output useful for reporting results and interpreting them as well as error catching and reporting, making it particularly useful for production use e.g. running at -set intervals on a deidcated server. +set intervals on a dedicated server. } \examples{ \donttest{ @@ -177,9 +177,7 @@ options(old_opts) } } \seealso{ -estimate_infections simulate_infections - -regional_epinow +\code{\link[=estimate_infections]{estimate_infections()}} \code{\link[=simulate_infections]{simulate_infections()}} \code{\link[=regional_epinow]{regional_epinow()}} } \author{ Sam Abbott diff --git a/man/estimate_delay.Rd b/man/estimate_delay.Rd index e6edeefc4..cea324b92 100644 --- a/man/estimate_delay.Rd +++ b/man/estimate_delay.Rd @@ -12,12 +12,12 @@ estimate_delay(delays, ...) \item{...}{Arguments to pass to internal methods.} } \value{ -A \code{dist_spec} summarising the bootstrapped distribution +A \verb{} summarising the bootstrapped distribution } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} Estimate a log normal delay distribution from a vector of integer delays. -Currently this function is a simple wrapper for \code{bootstrapped_dist_fit}. +Currently this function is a simple wrapper for \code{\link[=bootstrapped_dist_fit]{bootstrapped_dist_fit()}}. } \examples{ \donttest{ @@ -26,7 +26,7 @@ estimate_delay(delays, samples = 1000, bootstraps = 10) } } \seealso{ -bootstrapped_dist_fit +\code{\link[=bootstrapped_dist_fit]{bootstrapped_dist_fit()}} } \author{ Sam Abbott diff --git a/man/estimate_infections.Rd b/man/estimate_infections.Rd index 2973f9c76..087043752 100644 --- a/man/estimate_infections.Rd +++ b/man/estimate_infections.Rd @@ -25,37 +25,37 @@ estimate_infections( ) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} -\item{generation_time}{A call to \code{generation_time_opts()} defining the +\item{generation_time}{A call to \code{\link[=generation_time_opts]{generation_time_opts()}} defining the generation time distribution used. For backwards compatibility a list of summary parameters can also be passed.} -\item{delays}{A call to \code{delay_opts()} defining delay distributions and -options. See the documentation of \code{delay_opts()} and the examples below for +\item{delays}{A call to \code{\link[=delay_opts]{delay_opts()}} defining delay distributions and +options. See the documentation of \code{\link[=delay_opts]{delay_opts()}} and the examples below for details.} -\item{truncation}{A call to \code{trunc_opts()} defining the truncation of -observed data. Defaults to \code{trunc_opts()}. See \code{estimate_truncation()} for +\item{truncation}{A call to \code{\link[=trunc_opts]{trunc_opts()}} defining the truncation of +observed data. Defaults to \code{\link[=trunc_opts]{trunc_opts()}}. See \code{\link[=estimate_truncation]{estimate_truncation()}} for an approach to estimating truncation from data.} -\item{rt}{A list of options as generated by \code{rt_opts()} defining Rt -estimation. Defaults to \code{rt_opts()}. Set to \code{NULL} to switch to using back +\item{rt}{A list of options as generated by \code{\link[=rt_opts]{rt_opts()}} defining Rt +estimation. Defaults to \code{\link[=rt_opts]{rt_opts()}}. Set to \code{NULL} to switch to using back calculation rather than generating infections using Rt.} -\item{backcalc}{A list of options as generated by \code{backcalc_opts()} to -define the back calculation. Defaults to \code{backcalc_opts()}.} +\item{backcalc}{A list of options as generated by \code{\link[=backcalc_opts]{backcalc_opts()}} to +define the back calculation. Defaults to \code{\link[=backcalc_opts]{backcalc_opts()}}.} -\item{gp}{A list of options as generated by \code{gp_opts()} to define the -Gaussian process. Defaults to \code{gp_opts()}.Set to NULL to disable the +\item{gp}{A list of options as generated by \code{\link[=gp_opts]{gp_opts()}} to define the +Gaussian process. Defaults to \code{\link[=gp_opts]{gp_opts()}}. Set to \code{NULL} to disable the Gaussian process.} -\item{obs}{A list of options as generated by \code{obs_opts()} defining the -observation model. Defaults to \code{obs_opts()}.} +\item{obs}{A list of options as generated by \code{\link[=obs_opts]{obs_opts()}} defining the +observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} -\item{stan}{A list of stan options as generated by \code{stan_opts()}. Defaults -to \code{stan_opts()}. Can be used to override \code{data}, \code{init}, and \code{verbose} +\item{stan}{A list of stan options as generated by \code{\link[=stan_opts]{stan_opts()}}. Defaults +to \code{\link[=stan_opts]{stan_opts()}}. Can be used to override \code{data}, \code{init}, and \code{verbose} settings if desired.} \item{horizon}{Numeric, defaults to 7. Number of days into the future to @@ -79,7 +79,7 @@ preventing the posteriors from shifting. If FALSE, no weight will be applied, i.e. delay distributions will be treated as a single parameters.} \item{id}{A character string used to assign logging information on error. -Used by \code{regional_epinow} to assign errors to regions. Alter the default to +Used by \code{\link[=regional_epinow]{regional_epinow()}} to assign errors to regions. Alter the default to run with error catching.} \item{verbose}{Logical, defaults to \code{TRUE} when used interactively and @@ -160,7 +160,8 @@ options(old_opts) } } \seealso{ -epinow regional_epinow simulate_infections +\code{\link[=epinow]{epinow()}} \code{\link[=regional_epinow]{regional_epinow()}} \code{\link[=simulate_infections]{simulate_infections()}} +\code{\link[=estimate_truncation]{estimate_truncation()}} } \author{ Sam Abbott diff --git a/man/estimate_secondary.Rd b/man/estimate_secondary.Rd index 0b8bf8eb8..dd005bfb2 100644 --- a/man/estimate_secondary.Rd +++ b/man/estimate_secondary.Rd @@ -21,26 +21,26 @@ estimate_secondary( ) } \arguments{ -\item{reports}{A data frame containing the \code{date} of report and both +\item{reports}{A \verb{} containing the \code{date} of report and both \code{primary} and \code{secondary} reports.} -\item{secondary}{A call to \code{secondary_opts()} or a list containing the +\item{secondary}{A call to \code{\link[=secondary_opts]{secondary_opts()}} or a list containing the following binary variables: cumulative, historic, primary_hist_additive, current, primary_current_additive. These parameters control the structure of -the secondary model, see \code{secondary_opts()} for details.} +the secondary model, see \code{\link[=secondary_opts]{secondary_opts()}} for details.} \item{delays}{A call to \code{\link[=delay_opts]{delay_opts()}} defining delay distributions between -primary and secondary observations See the documentation of \code{delay_opts()} +primary and secondary observations See the documentation of \code{\link[=delay_opts]{delay_opts()}} for details. By default a diffuse prior is assumed with a mean of 14 days and standard deviation of 7 days (with a standard deviation of 0.5 and 0.25 respectively on the log scale).} -\item{truncation}{A call to \code{trunc_opts()} defining the truncation of -observed data. Defaults to \code{trunc_opts()}. See \code{estimate_truncation()} for +\item{truncation}{A call to \code{\link[=trunc_opts]{trunc_opts()}} defining the truncation of +observed data. Defaults to \code{\link[=trunc_opts]{trunc_opts()}}. See \code{\link[=estimate_truncation]{estimate_truncation()}} for an approach to estimating truncation from data.} -\item{obs}{A list of options as generated by \code{obs_opts()} defining the -observation model. Defaults to \code{obs_opts()}.} +\item{obs}{A list of options as generated by \code{\link[=obs_opts]{obs_opts()}} defining the +observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} \item{burn_in}{Integer, defaults to 14 days. The number of data points to use for estimation but not to fit to at the beginning of the time series. @@ -48,7 +48,7 @@ This must be less than the number of observations.} \item{CrIs}{Numeric vector of credible intervals to calculate.} -\item{priors}{A \code{data.frame} of named priors to be used in model fitting +\item{priors}{A \verb{} of named priors to be used in model fitting rather than the defaults supplied from other arguments. This is typically useful if wanting to inform an estimate from the posterior of another model fit.} @@ -64,12 +64,12 @@ be applied, i.e. delay distributions will be treated as a single parameters.} \item{verbose}{Logical, should model fitting progress be returned. Defaults -to \code{interactive()}.} +to \code{\link[=interactive]{interactive()}}.} -\item{...}{Additional parameters to pass to \code{rstan::sampling}.} +\item{...}{Additional parameters to pass to \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}.} } \value{ -A list containing: \code{predictions} (a data frame ordered by date with +A list containing: \code{predictions} (a \verb{} ordered by date with the primary, and secondary observations, and a summary of the model estimated secondary observations), \code{posterior} which contains a summary of the entire model posterior, \code{data} (a list of data used to fit the @@ -79,7 +79,7 @@ model), and \code{fit} (the \code{stanfit} object). \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Estimates the relationship between a primary and secondary observation, for example hospital admissions and deaths or hospital admissions and bed -occupancy. See \code{secondary_opts()} for model structure options. See parameter +occupancy. See \code{\link[=secondary_opts]{secondary_opts()}} for model structure options. See parameter documentation for model defaults and options. See the examples for case studies using synthetic data and \href{https://gist.github.com/seabbs/4f09d7609df298db7a86c31612ff9d17}{here} diff --git a/man/estimate_truncation.Rd b/man/estimate_truncation.Rd index 2c166ad04..3ab811610 100644 --- a/man/estimate_truncation.Rd +++ b/man/estimate_truncation.Rd @@ -18,7 +18,7 @@ estimate_truncation( ) } \arguments{ -\item{obs}{A list of data frames each containing a date variable +\item{obs}{A list of \verb{}s each containing a date variable and a confirm (integer) variable. Each data set should be a snapshot of the reported data over time. All data sets must contain a complete vector of dates.} @@ -29,8 +29,8 @@ of dates.} \item{trunc_dist}{Deprecated; use \code{truncation} instead.} -\item{truncation}{A call to \code{trunc_opts()} defining the truncation of -observed data. Defaults to \code{trunc_opts()}. See \code{estimate_truncation()} for +\item{truncation}{A call to \code{\link[=trunc_opts]{trunc_opts()}} defining the truncation of +observed data. Defaults to \code{\link[=trunc_opts]{trunc_opts()}}. See \code{\link[=estimate_truncation]{estimate_truncation()}} for an approach to estimating truncation from data.} \item{model}{A compiled stan model to override the default model. May be @@ -47,14 +47,14 @@ parameters.} \item{verbose}{Logical, should model fitting progress be returned.} -\item{...}{Additional parameters to pass to \code{rstan::sampling}.} +\item{...}{Additional parameters to pass to \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}.} } \value{ A list containing: the summary parameters of the truncation distribution (\code{dist}), the estimated CMF of the truncation distribution -(\code{cmf}, can be used to adjusted new data), a data frame containing the +(\code{cmf}, can be used to adjusted new data), a \verb{} containing the observed truncated data, latest observed data and the adjusted for -truncation observations (\code{obs}), a data frame containing the last +truncation observations (\code{obs}), a \verb{} containing the last observed data (\code{last_obs}, useful for plotting and validation), the data used for fitting (\code{data}) and the fit object (\code{fit}). } @@ -62,7 +62,7 @@ used for fitting (\code{data}) and the fit object (\code{fit}). \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Estimates a truncation distribution from multiple snapshots of the same data source over time. This distribution can then be used in -\code{regional_epinow}, \code{epinow}, and \code{estimate_infections} to adjust for +\code{\link[=regional_epinow]{regional_epinow()}}, \code{\link[=epinow]{epinow()}}, and \code{\link[=estimate_infections]{estimate_infections()}} to adjust for truncated data. See \href{https://gist.github.com/seabbs/176b0c7f83eab1a7192a25b28bbd116a}{here} for an example of using this approach on Covid-19 data in England. The diff --git a/man/expose_stan_fns.Rd b/man/expose_stan_fns.Rd index 68cbd00c4..f468cc293 100644 --- a/man/expose_stan_fns.Rd +++ b/man/expose_stan_fns.Rd @@ -12,14 +12,14 @@ expose_stan_fns(files, target_dir, ...) \item{target_dir}{A character string indicating the target directory for the file.} -\item{...}{Additional arguments passed to \code{rstan::expose_stan_functions}.} +\item{...}{Additional arguments passed to \code{\link[rstan:expose_stan_functions]{rstan::expose_stan_functions()}}.} } \value{ No return value, called for side effects } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -his function exposes internal stan functions in R from a user +his function exposes internal \code{{stan}} functions in R from a user supplied list of target files. Allows for testing of stan functions in R and potentially user use in R code. } diff --git a/man/extract_CrIs.Rd b/man/extract_CrIs.Rd index e7da018d0..8f41bf0b0 100644 --- a/man/extract_CrIs.Rd +++ b/man/extract_CrIs.Rd @@ -7,14 +7,15 @@ extract_CrIs(summarised) } \arguments{ -\item{summarised}{A data frame as processed by \code{calc_CrIs}} +\item{summarised}{A \verb{} as processed by \code{calc_CrIs}} } \value{ -A numeric vector of credible intervals detected in the data frame. +A numeric vector of credible intervals detected in the \verb{}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Helper function to extract the credible intervals present in a data frame. +Helper function to extract the credible intervals present in a +\verb{}. } \examples{ samples <- data.frame(value = 1:10, type = "car") diff --git a/man/extract_inits.Rd b/man/extract_inits.Rd index cf761fec3..f03f7dc1e 100644 --- a/man/extract_inits.Rd +++ b/man/extract_inits.Rd @@ -7,10 +7,10 @@ extract_inits(fit, current_inits, exclude_list = NULL, samples = 50) } \arguments{ -\item{fit}{A stanfit object.} +\item{fit}{A \verb{} object.} \item{current_inits}{A function that returns a list of initial conditions -(such as \code{create_initial_conditions()}). Only used in \code{exclude_list} is +(such as \code{\link[=create_initial_conditions]{create_initial_conditions()}}). Only used in \code{exclude_list} is specified.} \item{exclude_list}{A character vector of parameters to not initialise from @@ -26,8 +26,8 @@ named list. \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} Extracts posterior samples to use to initialise a full model fit. This may be useful for certain data sets where the sampler gets stuck or cannot -easily be initialised. In \code{estimate_infections()}, \code{epinow()} and\ -\code{regional_epinow()} this option can be engaged by setting +easily be initialised. In \code{\link[=estimate_infections]{estimate_infections()}}, \code{\link[=epinow]{epinow()}} and +\code{\link[=regional_epinow]{regional_epinow()}} this option can be engaged by setting \verb{stan_opts(init_fit = )}. This implementation is based on the approach taken in diff --git a/man/extract_parameter.Rd b/man/extract_parameter.Rd index f16325eaf..989b96dd2 100644 --- a/man/extract_parameter.Rd +++ b/man/extract_parameter.Rd @@ -9,19 +9,19 @@ extract_parameter(param, samples, dates) \arguments{ \item{param}{Character string indicating the parameter to extract} -\item{samples}{Extracted stan model (using \code{rstan::extract})} +\item{samples}{Extracted stan model (using \code{\link[rstan:stanfit-method-extract]{rstan::extract()}})} \item{dates}{A vector identifying the dimensionality of the parameter to extract. Generally this will be a date.} } \value{ -A data frame containing the parameter name, date, sample id and +A \verb{} containing the parameter name, date, sample id and sample value. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Extracts a single from a list of \code{stan} output and returns it as a -\code{data.table}. +Extracts a single from a list of \code{{stan}} output and returns it as a +\verb{}. } \author{ Sam Abbott diff --git a/man/extract_parameter_samples.Rd b/man/extract_parameter_samples.Rd index f6684d0e2..811420e02 100644 --- a/man/extract_parameter_samples.Rd +++ b/man/extract_parameter_samples.Rd @@ -14,9 +14,9 @@ extract_parameter_samples( ) } \arguments{ -\item{stan_fit}{A fit Stan model as returned by \code{rstan:sampling}.} +\item{stan_fit}{A fit Stan model as returned by \code{\link[=rstan:sampling]{rstan:sampling()}}.} -\item{data}{A list of the data supplied to the \code{rstan::sampling} call.} +\item{data}{A list of the data supplied to the \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}} call.} \item{reported_dates}{A vector of dates to report estimates for.} @@ -30,11 +30,12 @@ if it is off length 1; this is necessary when processing simulation results.} extracted from data.} } \value{ -A list of dataframes each containing the posterior of a parameter +A list of \verb{}'s each containing the posterior of a +parameter } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Extracts a custom set of parameters from a stan object and adds +Extracts a custom set of parameters from a \code{{stan}} object and adds stratification and dates where appropriate. } \author{ diff --git a/man/extract_stan_param.Rd b/man/extract_stan_param.Rd index 6a16b30c1..a5beed183 100644 --- a/man/extract_stan_param.Rd +++ b/man/extract_stan_param.Rd @@ -12,7 +12,7 @@ extract_stan_param( ) } \arguments{ -\item{fit}{A \code{stanfit} objec.} +\item{fit}{A \verb{} objec.} \item{params}{A character vector of parameters to extract. Defaults to all parameters.} @@ -23,7 +23,7 @@ parameters.} Automatically set to TRUE if multiple parameters are to be extracted.} } \value{ -A \code{data.table} summarising parameter posteriors. Contains a +A \verb{} summarising parameter posteriors. Contains a following variables: \code{variable}, \code{mean}, \code{mean_se}, \code{sd}, \code{median}, and \code{lower_}, \code{upper_} followed by credible interval labels indicating the credible intervals present. @@ -31,8 +31,8 @@ credible intervals present. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Extracts summarised parameter posteriors from a \code{stanfit} object using -\code{rstan::summary} in a format consistent with other summary functions in -\code{EpiNow2}. +\code{rstan::summary()} in a format consistent with other summary functions +in \code{{EpiNow2}}. } \author{ Sam Abbott diff --git a/man/extract_static_parameter.Rd b/man/extract_static_parameter.Rd index 6d80f1d86..f0a4c0a5c 100644 --- a/man/extract_static_parameter.Rd +++ b/man/extract_static_parameter.Rd @@ -9,10 +9,10 @@ extract_static_parameter(param, samples) \arguments{ \item{param}{Character string indicating the parameter to extract} -\item{samples}{Extracted stan model (using \code{rstan::extract})} +\item{samples}{Extracted stan model (using \code{\link[rstan:stanfit-method-extract]{rstan::extract()}})} } \value{ -A data frame containing the parameter name, sample id and sample +A \verb{} containing the parameter name, sample id and sample value } \description{ diff --git a/man/fit_model_with_nuts.Rd b/man/fit_model_with_nuts.Rd index e926d034f..93b50bd09 100644 --- a/man/fit_model_with_nuts.Rd +++ b/man/fit_model_with_nuts.Rd @@ -22,7 +22,7 @@ execution time per chain in seconds. Results will still be returned as long as at least 2 chains complete successfully within the timelimit.} \item{id}{A character string used to assign logging information on error. -Used by \code{regional_epinow} to assign errors to regions. Alter the default to +Used by \code{\link[=regional_epinow]{regional_epinow()}} to assign errors to regions. Alter the default to run with error catching.} } \value{ @@ -30,7 +30,7 @@ A stan model object } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -Fits a stan model using \code{rstan::sampling}. Provides the optional ability to +Fits a stan model using \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}. Provides the optional ability to run chains using \code{future} with error catching, timeouts and merging of completed chains. } diff --git a/man/fit_model_with_vb.Rd b/man/fit_model_with_vb.Rd index 0739804c8..2c3897d3b 100644 --- a/man/fit_model_with_vb.Rd +++ b/man/fit_model_with_vb.Rd @@ -13,7 +13,7 @@ fit_model_with_vb(args, future = FALSE, id = "stan") stan chains in parallel.} \item{id}{A character string used to assign logging information on error. -Used by \code{regional_epinow} to assign errors to regions. Alter the default to +Used by \code{\link[=regional_epinow]{regional_epinow()}} to assign errors to regions. Alter the default to run with error catching.} } \value{ diff --git a/man/fix_dist.Rd b/man/fix_dist.Rd index 79689b253..565d59d8e 100644 --- a/man/fix_dist.Rd +++ b/man/fix_dist.Rd @@ -2,22 +2,22 @@ % Please edit documentation in R/dist.R \name{fix_dist} \alias{fix_dist} -\title{Fix the parameters of a \code{dist_spec}} +\title{Fix the parameters of a \verb{} object} \usage{ fix_dist(x, strategy = c("mean", "sample")) } \arguments{ -\item{x}{A \link{dist_spec} object} +\item{x}{A \verb{} object} \item{strategy}{Character; either "mean" (use the mean estimates of the mean and standard deviation) or "sample" (randomly sample mean and -standard deviation from uncertainty given in the \code{dist_spec})} +standard deviation from uncertainty given in the \verb{}} } \value{ -A \code{dist_spec} object without uncertainty +A \verb{} object without uncertainty } \description{ -If the given \code{dist_spec} has any uncertainty, it is removed and the +If the given \verb{} has any uncertainty, it is removed and the corresponding distribution converted into a fixed one. } \author{ diff --git a/man/forecast_secondary.Rd b/man/forecast_secondary.Rd index 554bcfff4..256445fb3 100644 --- a/man/forecast_secondary.Rd +++ b/man/forecast_secondary.Rd @@ -16,21 +16,21 @@ forecast_secondary( } \arguments{ \item{estimate}{An object of class "estimate_secondary" as produced by -\code{estimate_secondary()}.} +\code{\link[=estimate_secondary]{estimate_secondary()}}.} -\item{primary}{A data.frame containing at least \code{date} and \code{value} (integer) -variables and optionally \code{sample}. Used as the primary observation used to -forecast the secondary observations. Alternatively, this may be an object of -class "estimate_infections" as produced by \code{estimate_infections()}. If -\code{primary} is of class "estimate_infections" then the internal samples will +\item{primary}{A \verb{} containing at least \code{date} and \code{value} +(integer) variables and optionally \code{sample}. Used as the primary observation +used to forecast the secondary observations. Alternatively, this may be an +object of class "estimate_infections" as produced by \code{estimate_infections()}. +If \code{primary} is of class "estimate_infections" then the internal samples will be filtered to have a minimum date ahead of those observed in the \code{estimate} object.} \item{primary_variable}{A character string indicating the primary variable, defaulting to "reported_cases". Only used when primary is of class -"estimate_infections".} +\verb{}.} -\item{model}{A compiled stan model as returned by \code{rstan::stan_model}.} +\item{model}{A compiled stan model as returned by \code{\link[rstan:stan_model]{rstan::stan_model()}}.} \item{samples}{Numeric, number of posterior samples to simulate from. The default is to use all samples in the \code{primary} input when present. If not @@ -42,27 +42,27 @@ and not just those in the forecast horizon be returned.} \item{CrIs}{Numeric vector of credible intervals to calculate.} } \value{ -A list containing: \code{predictions} (a data frame ordered by date with -the primary, and secondary observations, and a summary of the forecast +A list containing: \code{predictions} (a \verb{} ordered by date +with the primary, and secondary observations, and a summary of the forecast secondary observations. For primary observations in the forecast horizon -when uncertainty is present the median is used), \code{samples} a data frame of -forecast secondary observation posterior samples, and \code{forecast} a summary +when uncertainty is present the median is used), \code{samples} a \verb{} +of forecast secondary observation posterior samples, and \code{forecast} a summary of the forecast secondary observation posterior. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} This function forecasts secondary observations using the output of -\code{estimate_secondary()} and either observed primary data or a forecast of -primary observations. See the examples of \code{estimate_secondary()} -for one use case. It can also be combined with \code{estimate_infections()} t +\code{\link[=estimate_secondary]{estimate_secondary()}} and either observed primary data or a forecast of +primary observations. See the examples of \code{\link[=estimate_secondary]{estimate_secondary()}} +for one use case. It can also be combined with \code{\link[=estimate_infections]{estimate_infections()}} to produce a forecast for a secondary observation from a forecast of a primary -observation. See the examples of \code{estimate_secondary()} for +observation. See the examples of \code{\link[=estimate_secondary]{estimate_secondary()}} for example use cases on synthetic data. See \href{https://gist.github.com/seabbs/4f09d7609df298db7a86c31612ff9d17}{here} for an example of forecasting Covid-19 deaths from Covid-19 cases. } \seealso{ -estimate_secondary +\code{\link[=estimate_secondary]{estimate_secondary()}} } \author{ Sam Abbott diff --git a/man/format_fit.Rd b/man/format_fit.Rd index a312c19f5..cd4263ae5 100644 --- a/man/format_fit.Rd +++ b/man/format_fit.Rd @@ -8,7 +8,7 @@ format_fit(posterior_samples, horizon, shift, burn_in, start_date, CrIs) } \arguments{ \item{posterior_samples}{A list of posterior samples as returned by -\code{extract_parameter_samples}.} +\code{\link[=extract_parameter_samples]{extract_parameter_samples()}}.} \item{horizon}{Numeric, forecast horizon.} diff --git a/man/gamma_dist_def.Rd b/man/gamma_dist_def.Rd index 215e640da..7fa2af023 100644 --- a/man/gamma_dist_def.Rd +++ b/man/gamma_dist_def.Rd @@ -40,12 +40,12 @@ Samples outside of this range are resampled.} \item{samples}{Numeric, number of sample distributions to generate.} } \value{ -A data.table defining the distribution as used by \code{dist_skel} +A \verb{} defining the distribution as used by \code{\link[=dist_skel]{dist_skel()}} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#soft-deprecated}{\figure{lifecycle-soft-deprecated.svg}{options: alt='[Soft-deprecated]'}}}{\strong{[Soft-deprecated]}} Generates a distribution definition when only parameter estimates -are available for gamma distributed parameters. See \code{rgamma} for +are available for gamma distributed parameters. See \code{\link[=rgamma]{rgamma()}} for distribution information. } \examples{ diff --git a/man/generation_time_opts.Rd b/man/generation_time_opts.Rd index b86907108..1b14e2885 100644 --- a/man/generation_time_opts.Rd +++ b/man/generation_time_opts.Rd @@ -30,8 +30,8 @@ using \code{\link[=dist_spec]{dist_spec()}}. If no distribution is given a fixed \item{fixed}{deprecated; use \code{dist} instead} \item{prior_weight}{deprecated; prior weights are now specified as a -model option. Use the \code{weigh_delay_priors} argument of \code{estimate_infections} -instead.} +model option. Use the \code{weigh_delay_priors} argument of +\code{\link[=estimate_infections]{estimate_infections()}} instead.} } \value{ A \verb{} object summarising the input delay @@ -57,7 +57,8 @@ generation_time_opts( generation_time_opts(example_generation_time) } \seealso{ -convert_to_logmean convert_to_logsd bootstrapped_dist_fit dist_spec +\code{\link[=convert_to_logmean]{convert_to_logmean()}} \code{\link[=convert_to_logsd]{convert_to_logsd()}} +\code{\link[=bootstrapped_dist_fit]{bootstrapped_dist_fit()}} \code{\link[=dist_spec]{dist_spec()}} } \author{ Sebastian Funk diff --git a/man/get_dist.Rd b/man/get_dist.Rd index 20514390e..fb00282f9 100644 --- a/man/get_dist.Rd +++ b/man/get_dist.Rd @@ -7,7 +7,7 @@ get_dist(data, disease, source, max_value = 14, fixed = FALSE) } \arguments{ -\item{data}{A \code{data.table} in the format of \code{generation_times}.} +\item{data}{A \verb{} in the format of \code{generation_times}.} \item{disease}{A character string indicating the disease of interest.} @@ -25,10 +25,10 @@ A list defining a distribution \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} This function has been deprecated. Please specify a distribution -using \code{dist_spec} instead. +using \code{\link[=dist_spec]{dist_spec()}} instead. } \seealso{ -dist_spec +\code{\link[=dist_spec]{dist_spec()}} } \author{ Sam Abbott diff --git a/man/get_generation_time.Rd b/man/get_generation_time.Rd index 48f4211e8..cff27d564 100644 --- a/man/get_generation_time.Rd +++ b/man/get_generation_time.Rd @@ -24,10 +24,10 @@ A list defining a distribution Extracts a literature distribution from \code{generation_times}. This function has been deprecated. Please specify a distribution -using \code{dist_spec} instead. +using \code{\link[=dist_spec]{dist_spec()}} instead. } \seealso{ -dist_spec +\code{\link[=dist_spec]{dist_spec()}} } \author{ Sam Abbott diff --git a/man/get_incubation_period.Rd b/man/get_incubation_period.Rd index 4cbcb3a30..56897967f 100644 --- a/man/get_incubation_period.Rd +++ b/man/get_incubation_period.Rd @@ -24,10 +24,10 @@ A list defining a distribution Extracts a literature distribution from \code{generation_times}. This function has been deprecated. Please specify a distribution -using \code{dist_spec} instead +using \code{\link[=dist_spec]{dist_spec()}} instead } \seealso{ -dist_spec +\code{\link[=dist_spec]{dist_spec()}} } \author{ Sam Abbott diff --git a/man/get_raw_result.Rd b/man/get_raw_result.Rd index bb1156a95..ce925261d 100644 --- a/man/get_raw_result.Rd +++ b/man/get_raw_result.Rd @@ -17,7 +17,7 @@ get_raw_result(file, region, date, result_dir) directory.} } \value{ -An R object read in from the targeted .rds file +An R object read in from the targeted \code{.rds} file } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/get_regional_results.Rd b/man/get_regional_results.Rd index 765f0bd05..d3b4a4d0b 100644 --- a/man/get_regional_results.Rd +++ b/man/get_regional_results.Rd @@ -13,11 +13,11 @@ get_regional_results( ) } \arguments{ -\item{regional_output}{A list of output as produced by \code{regional_epinow} and -stored in the \code{regional} list.} +\item{regional_output}{A list of output as produced by \code{\link[=regional_epinow]{regional_epinow()}} +and stored in the \code{regional} list.} \item{results_dir}{A character string indicating the folder containing the -\code{EpiNow2} results to extract.} +\code{{EpiNow2}} results to extract.} \item{date}{A Character string (in the format "yyyy-mm-dd") indicating the date to extract data for. Defaults to "latest" which finds the latest diff --git a/man/get_regions.Rd b/man/get_regions.Rd index b38645430..a4b04eea8 100644 --- a/man/get_regions.Rd +++ b/man/get_regions.Rd @@ -8,7 +8,7 @@ get_regions(results_dir) } \arguments{ \item{results_dir}{A character string giving the directory in which results -are stored (as produced by \code{regional_rt_pipeline}).} +are stored (as produced by \code{\link[=regional_rt_pipeline]{regional_rt_pipeline()}}).} } \value{ A named character vector containing the results to plot. diff --git a/man/get_regions_with_most_reports.Rd b/man/get_regions_with_most_reports.Rd index e3cec779b..85a791fde 100644 --- a/man/get_regions_with_most_reports.Rd +++ b/man/get_regions_with_most_reports.Rd @@ -7,7 +7,7 @@ get_regions_with_most_reports(reported_cases, time_window = 7, no_regions = 6) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date), and region (\code{region}).} \item{time_window}{Numeric, number of days to include from latest date in diff --git a/man/get_seeding_time.Rd b/man/get_seeding_time.Rd index 77c7f51b6..16cdc814b 100644 --- a/man/get_seeding_time.Rd +++ b/man/get_seeding_time.Rd @@ -7,9 +7,9 @@ get_seeding_time(delays, generation_time) } \arguments{ -\item{delays}{Delays as specified using \code{dist_spec}} +\item{delays}{Delays as specified using \code{\link[=dist_spec]{dist_spec()}}} -\item{generation_time}{Generation time as specified using \code{dist_spec}} +\item{generation_time}{Generation time as specified using \code{\link[=dist_spec]{dist_spec()}}} } \value{ An integer seeding time diff --git a/man/gp_opts.Rd b/man/gp_opts.Rd index eb0c69eb0..cec05a340 100644 --- a/man/gp_opts.Rd +++ b/man/gp_opts.Rd @@ -39,8 +39,8 @@ process length scale will be used with recommended parameters \item{ls_min}{Numeric, defaults to 0. The minimum value of the length scale.} \item{ls_max}{Numeric, defaults to 60. The maximum value of the length -scale. Updated in \code{create_gp_data} to be the length of the input data if this -is smaller.} +scale. Updated in \code{\link[=create_gp_data]{create_gp_data()}} to be the length of the input data if +this is smaller.} \item{alpha_sd}{Numeric, defaults to 0.05. The standard deviation of the magnitude parameter of the Gaussian process kernel. Should be approximately diff --git a/man/growth_to_R.Rd b/man/growth_to_R.Rd index 8403d965c..3ee2cf0bc 100644 --- a/man/growth_to_R.Rd +++ b/man/growth_to_R.Rd @@ -20,7 +20,7 @@ Numeric vector of reproduction number estimates \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} See \href{https://www.medrxiv.org/content/10.1101/2020.01.30.20019877v3.full.pdf}{here} # nolint -for justification. Now handled internally by stan so may be removed in +for justification. Now handled internally by \code{{stan}} so may be removed in future updates if no user demand. } \examples{ diff --git a/man/init_cumulative_fit.Rd b/man/init_cumulative_fit.Rd index a72d9c033..5fea3e2f2 100644 --- a/man/init_cumulative_fit.Rd +++ b/man/init_cumulative_fit.Rd @@ -20,7 +20,7 @@ init_cumulative_fit( \item{warmup}{Numeric, defaults to 50. Number of warmup samples.} \item{id}{A character string used to assign logging information on error. -Used by \code{regional_epinow} to assign errors to regions. Alter the default to +Used by \code{\link[=regional_epinow]{regional_epinow()}} to assign errors to regions. Alter the default to run with error catching.} \item{verbose}{Logical, should fitting progress be returned. Defaults to diff --git a/man/lognorm_dist_def.Rd b/man/lognorm_dist_def.Rd index 92a8746bc..56e3aa4a2 100644 --- a/man/lognorm_dist_def.Rd +++ b/man/lognorm_dist_def.Rd @@ -23,12 +23,12 @@ Samples outside of this range are resampled.} \item{to_log}{Logical, should parameters be logged before use.} } \value{ -A data.table defining the distribution as used by \code{dist_skel} +A \verb{} defining the distribution as used by \code{\link[=dist_skel]{dist_skel()}} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#soft-deprecated}{\figure{lifecycle-soft-deprecated.svg}{options: alt='[Soft-deprecated]'}}}{\strong{[Soft-deprecated]}} Generates a distribution definition when only parameter estimates -are available for log normal distributed parameters. See \code{rlnorm} for +are available for log normal distributed parameters. See \code{\link[=rlnorm]{rlnorm()}} for distribution information. } \examples{ diff --git a/man/mean.dist_spec.Rd b/man/mean.dist_spec.Rd index a0513b8eb..af1a9ce4e 100644 --- a/man/mean.dist_spec.Rd +++ b/man/mean.dist_spec.Rd @@ -7,7 +7,7 @@ \method{mean}{dist_spec}(x, ...) } \arguments{ -\item{x}{The \code{\link[=dist_spec]{dist_spec()}} to use} +\item{x}{The \verb{} to use} \item{...}{Not used} } diff --git a/man/opts_list.Rd b/man/opts_list.Rd index 60d7f3200..2c6884e8a 100644 --- a/man/opts_list.Rd +++ b/man/opts_list.Rd @@ -7,7 +7,7 @@ opts_list(opts, reported_cases, ...) } \arguments{ -\item{opts}{An \verb{_opts()} function call such as \code{rt_opts()}.} +\item{opts}{An \verb{_opts()} function call such as \code{\link[=rt_opts]{rt_opts()}}.} \item{reported_cases}{A data frame containing a \code{region} variable indicating the target regions.} @@ -21,11 +21,11 @@ accepting arguments of \code{regional_epinow}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -Define a list of \verb{_opts()} to pass to \code{regional_epinow} \verb{_opts()} accepting +Define a list of \verb{_opts()} to pass to \code{\link[=regional_epinow]{regional_epinow()}} \verb{_opts()} accepting arguments. This is useful when different settings are needed between regions -within a single \code{regional_epinow} call. Using \code{opts_list} the defaults can -be applied to all regions present with an override passed to regions as -necessary (either within \code{opts_list} or externally). +within a single \code{\link[=regional_epinow]{regional_epinow()}} call. Using \code{\link[=opts_list]{opts_list()}} the defaults +can be applied to all regions present with an override passed to regions as +necessary (either within \code{\link[=opts_list]{opts_list()}} or externally). } \examples{ # uses example case vector @@ -47,7 +47,7 @@ rt$realland$rw <- 7 rt } \seealso{ -regional_epinow rt_opts +\code{\link[=regional_epinow]{regional_epinow()}} \code{\link[=rt_opts]{rt_opts()}} } \author{ Sam Abbott diff --git a/man/plot.dist_spec.Rd b/man/plot.dist_spec.Rd index 82e0e4613..c7eeef97e 100644 --- a/man/plot.dist_spec.Rd +++ b/man/plot.dist_spec.Rd @@ -7,13 +7,13 @@ \method{plot}{dist_spec}(x, ...) } \arguments{ -\item{x}{A \link{dist_spec} object} +\item{x}{A \verb{} object} -\item{...}{Additional arguments to pass to \code{ggplot}} +\item{...}{Additional arguments to pass to \code{{ggplot}}.} } \description{ -This function takes a \link{dist_spec} object and plots its probability mass -function (PMF) and cumulative distribution function (CDF) using \link{ggplot2}. +This function takes a \verb{} object and plots its probability mass +function (PMF) and cumulative distribution function (CDF) using \code{{ggplot2}}. Note that currently uncertainty in distributions is not plot. } \examples{ diff --git a/man/plot.epinow.Rd b/man/plot.epinow.Rd index 472b6dba6..bf3bc651d 100644 --- a/man/plot.epinow.Rd +++ b/man/plot.epinow.Rd @@ -7,7 +7,7 @@ \method{plot}{epinow}(x, type = "summary", ...) } \arguments{ -\item{x}{A list of output as produced by \code{epinow}} +\item{x}{A list of output as produced by \code{\link[=epinow]{epinow()}}.} \item{type}{A character vector indicating the name of plots to return. Defaults to "summary" with supported options being "infections", "reports", @@ -16,11 +16,11 @@ Defaults to "summary" with supported options being "infections", "reports", \item{...}{Pass additional arguments to report_plots} } \value{ -List of plots as produced by \code{report_plots} +List of plots as produced by \code{\link[=report_plots]{report_plots()}} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -\code{plot} method for class "epinow". +\code{plot} method for class \verb{}. } \seealso{ plot plot.estimate_infections report_plots estimate_infections diff --git a/man/plot.estimate_infections.Rd b/man/plot.estimate_infections.Rd index 6f396bb44..0ddc45459 100644 --- a/man/plot.estimate_infections.Rd +++ b/man/plot.estimate_infections.Rd @@ -17,11 +17,11 @@ Defaults to "summary" with supported options being "infections", "reports", \item{...}{Pass additional arguments to report_plots} } \value{ -List of plots as produced by \code{report_plots} +List of plots as produced by \code{\link[=report_plots]{report_plots()}} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -\code{plot} method for class "estimate_infections". +\code{plot} method for class \verb{}. } \seealso{ plot report_plots estimate_infections diff --git a/man/plot.estimate_secondary.Rd b/man/plot.estimate_secondary.Rd index 32a0bf077..4cc93e6c5 100644 --- a/man/plot.estimate_secondary.Rd +++ b/man/plot.estimate_secondary.Rd @@ -16,7 +16,7 @@ be plot?} \item{to}{Date object indicating when to plot up to.} -\item{new_obs}{A data.frame containing the columns \code{date} and \code{secondary} +\item{new_obs}{A \verb{} containing the columns \code{date} and \code{secondary} which replace the secondary observations stored in the \code{estimate_secondary} output.} diff --git a/man/plot.estimate_truncation.Rd b/man/plot.estimate_truncation.Rd index e5c62006c..1b7bdf404 100644 --- a/man/plot.estimate_truncation.Rd +++ b/man/plot.estimate_truncation.Rd @@ -7,7 +7,7 @@ \method{plot}{estimate_truncation}(x, ...) } \arguments{ -\item{x}{A list of output as produced by \code{estimate_truncation}} +\item{x}{A list of output as produced by \code{\link[=estimate_truncation]{estimate_truncation()}}} \item{...}{Pass additional arguments to plot function. Not currently in use.} } @@ -16,7 +16,7 @@ } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -\code{plot} method for class "estimate_truncation". Returns +\code{\link[=plot]{plot()}} method for class \verb{}. Returns a plot faceted over each dataset used in fitting with the latest observations as columns, the data observed at the time (and so truncated) as dots and the truncation adjusted estimates as a ribbon. diff --git a/man/plot_CrIs.Rd b/man/plot_CrIs.Rd index ce18d436f..dd77722ce 100644 --- a/man/plot_CrIs.Rd +++ b/man/plot_CrIs.Rd @@ -7,17 +7,17 @@ plot_CrIs(plot, CrIs, alpha, linewidth) } \arguments{ -\item{plot}{A \code{ggplot2} plot} +\item{plot}{A \code{{ggplot2}} plot} \item{CrIs}{Numeric list of credible intervals present in the data. As -produced by \code{extract_CrIs}} +produced by \code{\link[=extract_CrIs]{extract_CrIs()}}.} \item{alpha}{Numeric, overall alpha of the target line range} \item{linewidth}{Numeric, line width of the default line range.} } \value{ -A \code{ggplot2} plot. +A \code{{ggplot2}} plot. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/plot_estimates.Rd b/man/plot_estimates.Rd index ad2c12d12..eeb802d97 100644 --- a/man/plot_estimates.Rd +++ b/man/plot_estimates.Rd @@ -15,12 +15,12 @@ plot_estimates( ) } \arguments{ -\item{estimate}{A data.table of estimates containing the following +\item{estimate}{A \verb{} of estimates containing the following variables: date, type (must contain "estimate", "estimate based on partial data" and optionally "forecast").} -\item{reported}{A data.table of reported cases with the following variables: -date, confirm.} +\item{reported}{A \verb{} of reported cases with the following +variables: date, confirm.} \item{ylab}{Character string, defaulting to "Cases". Title for the plot y axis.} @@ -44,9 +44,9 @@ A \code{ggplot2} object } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} -Allows users to plot the output from \code{estimate_infections} easily. In future -releases it may be depreciated in favour of increasing the functionality of -the S3 plot methods. +Allows users to plot the output from \code{\link[=estimate_infections]{estimate_infections()}} easily. +In future releases it may be depreciated in favour of increasing the +functionality of the S3 plot methods. } \examples{ # get example model results diff --git a/man/plot_summary.Rd b/man/plot_summary.Rd index 075fb558d..d835f53e7 100644 --- a/man/plot_summary.Rd +++ b/man/plot_summary.Rd @@ -7,7 +7,7 @@ plot_summary(summary_results, x_lab = "Region", log_cases = FALSE, max_cases) } \arguments{ -\item{summary_results}{A data.table as returned by \code{summarise_results} (the +\item{summary_results}{A data.table as returned by \code{\link[=summarise_results]{summarise_results()}} (the \code{data} object).} \item{x_lab}{A character string giving the label for the x axis, defaults to @@ -19,12 +19,12 @@ to \code{FALSE}.} \item{max_cases}{Numeric, no default. The maximum number of cases to plot.} } \value{ -A \code{ggplot2} object +A \code{{ggplot2}} object } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} Used to return a summary plot across regions (using results generated by -\code{summarise_results}). +\code{\link[=summarise_results]{summarise_results()}}). May be depreciated in later releases in favour of enhanced S3 methods. } diff --git a/man/plus-.dist_spec.Rd b/man/plus-.dist_spec.Rd index 9e737ff78..c917d175e 100644 --- a/man/plus-.dist_spec.Rd +++ b/man/plus-.dist_spec.Rd @@ -18,7 +18,7 @@ A delay distribution representing the sum of the two delays (with class \code{\link[=dist_spec]{dist_spec()}}) } \description{ -This is done via convolution with \code{stats::convolve()}. Nonparametric delays +This is done via convolution with \code{\link[stats:convolve]{stats::convolve()}}. Nonparametric delays that can be combined are processed together, and their cumulative distribution function is truncated at a specified tolerance level, ensuring numeric stability. diff --git a/man/print.dist_spec.Rd b/man/print.dist_spec.Rd index f1e4f01bd..ef8c10487 100644 --- a/man/print.dist_spec.Rd +++ b/man/print.dist_spec.Rd @@ -7,7 +7,7 @@ \method{print}{dist_spec}(x, ...) } \arguments{ -\item{x}{The \code{\link[=dist_spec]{dist_spec()}} to use} +\item{x}{The \verb{} to use} \item{...}{Not used} } diff --git a/man/process_region.Rd b/man/process_region.Rd index 3b7a5dbe6..590b1610f 100644 --- a/man/process_region.Rd +++ b/man/process_region.Rd @@ -14,11 +14,11 @@ process_region( ) } \arguments{ -\item{out}{List of output returned by \code{epinow}} +\item{out}{List of output returned by \code{\link[=epinow]{epinow()}}} \item{target_region}{Character string indicating the region being evaluated} -\item{timing}{Output from \code{Sys.time}} +\item{timing}{Output from \code{\link[=Sys.time]{Sys.time()}}} \item{return_output}{Logical, defaults to FALSE. Should output be returned, this automatically updates to TRUE if no directory for saving is specified.} @@ -37,5 +37,5 @@ Internal function that removes output that is not required, and returns logging information. } \seealso{ -regional_epinow +\code{\link[=regional_epinow]{regional_epinow()}} } diff --git a/man/process_regions.Rd b/man/process_regions.Rd index 021b6df5f..47161d458 100644 --- a/man/process_regions.Rd +++ b/man/process_regions.Rd @@ -7,7 +7,8 @@ process_regions(regional_out, regions) } \arguments{ -\item{regional_out}{A list of output from multiple runs of \code{regional_epinow}} +\item{regional_out}{A list of output from multiple runs of +\code{\link[=regional_epinow]{regional_epinow()}}} \item{regions}{A character vector identifying the regions that have been run} } @@ -16,9 +17,9 @@ A list of all regional estimates and successful regional estimates } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Internal function that processes the output from multiple \code{epinow} runs, adds -summary logging information. +Internal function that processes the output from multiple \code{\link[=epinow]{epinow()}} runs, +adds summary logging information. } \seealso{ -regional_epinow epinow +\code{\link[=regional_epinow]{regional_epinow()}} \code{\link[=epinow]{epinow()}} } diff --git a/man/regional_epinow.Rd b/man/regional_epinow.Rd index df49b3c95..d031486f8 100644 --- a/man/regional_epinow.Rd +++ b/man/regional_epinow.Rd @@ -28,37 +28,37 @@ regional_epinow( ) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date), and region (\code{region}).} -\item{generation_time}{A call to \code{generation_time_opts()} defining the +\item{generation_time}{A call to \code{\link[=generation_time_opts]{generation_time_opts()}} defining the generation time distribution used. For backwards compatibility a list of summary parameters can also be passed.} -\item{delays}{A call to \code{delay_opts()} defining delay distributions and -options. See the documentation of \code{delay_opts()} and the examples below for +\item{delays}{A call to \code{\link[=delay_opts]{delay_opts()}} defining delay distributions and +options. See the documentation of \code{\link[=delay_opts]{delay_opts()}} and the examples below for details.} -\item{truncation}{A call to \code{trunc_opts()} defining the truncation of -observed data. Defaults to \code{trunc_opts()}. See \code{estimate_truncation()} for +\item{truncation}{A call to \code{\link[=trunc_opts]{trunc_opts()}} defining the truncation of +observed data. Defaults to \code{\link[=trunc_opts]{trunc_opts()}}. See \code{\link[=estimate_truncation]{estimate_truncation()}} for an approach to estimating truncation from data.} -\item{rt}{A list of options as generated by \code{rt_opts()} defining Rt -estimation. Defaults to \code{rt_opts()}. Set to \code{NULL} to switch to using back +\item{rt}{A list of options as generated by \code{\link[=rt_opts]{rt_opts()}} defining Rt +estimation. Defaults to \code{\link[=rt_opts]{rt_opts()}}. Set to \code{NULL} to switch to using back calculation rather than generating infections using Rt.} -\item{backcalc}{A list of options as generated by \code{backcalc_opts()} to -define the back calculation. Defaults to \code{backcalc_opts()}.} +\item{backcalc}{A list of options as generated by \code{\link[=backcalc_opts]{backcalc_opts()}} to +define the back calculation. Defaults to \code{\link[=backcalc_opts]{backcalc_opts()}}.} -\item{gp}{A list of options as generated by \code{gp_opts()} to define the -Gaussian process. Defaults to \code{gp_opts()}.Set to NULL to disable the +\item{gp}{A list of options as generated by \code{\link[=gp_opts]{gp_opts()}} to define the +Gaussian process. Defaults to \code{\link[=gp_opts]{gp_opts()}}. Set to \code{NULL} to disable the Gaussian process.} -\item{obs}{A list of options as generated by \code{obs_opts()} defining the -observation model. Defaults to \code{obs_opts()}.} +\item{obs}{A list of options as generated by \code{\link[=obs_opts]{obs_opts()}} defining the +observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} -\item{stan}{A list of stan options as generated by \code{stan_opts()}. Defaults -to \code{stan_opts()}. Can be used to override \code{data}, \code{init}, and \code{verbose} +\item{stan}{A list of stan options as generated by \code{\link[=stan_opts]{stan_opts()}}. Defaults +to \code{\link[=stan_opts]{stan_opts()}}. Can be used to override \code{data}, \code{init}, and \code{verbose} settings if desired.} \item{horizon}{Numeric, defaults to 7. Number of days into the future to @@ -88,20 +88,20 @@ then the default is also to copy all results into a latest folder.} \item{return_output}{Logical, defaults to FALSE. Should output be returned, this automatically updates to TRUE if no directory for saving is specified.} -\item{summary_args}{A list of arguments passed to \code{regional_summary}. See -the \code{regional_summary} documentation for details.} +\item{summary_args}{A list of arguments passed to \code{\link[=regional_summary]{regional_summary()}}. See +the \code{\link[=regional_summary]{regional_summary()}} documentation for details.} \item{verbose}{Logical defaults to FALSE. Outputs verbose progress messages -to the console from \code{epinow}.} +to the console from \code{\link[=epinow]{epinow()}}.} \item{logs}{Character path indicating the target folder in which to store log information. Defaults to the temporary directory if not specified. Default logging can be disabled if \code{logs} is set to NULL. If specifying a custom -logging setup then the code for \code{setup_default_logging} and the -\code{setup_logging} function are a sensible place to start.} +logging setup then the code for \code{\link[=setup_default_logging]{setup_default_logging()}} and the +\code{\link[=setup_logging]{setup_logging()}} function are a sensible place to start.} -\item{...}{Pass additional arguments to \code{epinow}. See the documentation for -\code{epinow} for details.} +\item{...}{Pass additional arguments to \code{\link[=epinow]{epinow()}}. See the documentation for +\code{\link[=epinow]{epinow()}} for details.} } \value{ A list of output stratified at the top level into regional output @@ -109,23 +109,23 @@ and across region output summary output } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -Efficiently runs \code{epinow()} across multiple regions in an efficient manner +Efficiently runs \code{\link[=epinow]{epinow()}} across multiple regions in an efficient manner and conducts basic data checks and cleaning such as removing regions with fewer than \code{non_zero_points} as these are unlikely to produce reasonable results whilst consuming significant resources. See the documentation for -\code{epinow} for further information. +\code{\link[=epinow]{epinow()}} for further information. By default all arguments supporting input from \verb{_opts()} functions are shared across regions (including delays, truncation, Rt settings, stan settings, and gaussian process settings). Region specific settings are supported by passing a named list of \verb{_opts()} calls (with an entry per -region) to the relevant argument. A helper function (\code{opts_list}) is +region) to the relevant argument. A helper function (\code{\link[=opts_list]{opts_list()}}) is available to facilitate building this list. Regions can be estimated in parallel using the \code{{future}} package (see -\code{setup_future}). The progress of producing estimates across multiple regions -is tracked using the \code{progressr} package. Modify this behaviour using -progressr::handlers and enable it in batch by setting +\code{\link[=setup_future]{setup_future()}}). The progress of producing estimates across multiple regions +is tracked using the \code{{progressr}} package. Modify this behaviour using +\code{\link[progressr:handlers]{progressr::handlers()}} and enable it in batch by setting \code{R_PROGRESSR_ENABLE=TRUE} as an environment variable. } \examples{ @@ -159,7 +159,6 @@ options(old_opts) } } \seealso{ -epinow estimate_infections - -setup_future regional_summary +\code{\link[=epinow]{epinow()}} \code{\link[=estimate_infections]{estimate_infections()}} \code{\link[=setup_future]{setup_future()}} +\code{\link[=regional_summary]{regional_summary()}} } diff --git a/man/regional_runtimes.Rd b/man/regional_runtimes.Rd index 50481cb46..45d683b8b 100644 --- a/man/regional_runtimes.Rd +++ b/man/regional_runtimes.Rd @@ -12,8 +12,8 @@ regional_runtimes( ) } \arguments{ -\item{regional_output}{A list of output as produced by \code{regional_epinow} and -stored in the \code{regional} list.} +\item{regional_output}{A list of output as produced by \code{\link[=regional_epinow]{regional_epinow()}} +and stored in the \code{regional} list.} \item{target_folder}{Character string specifying where to save results (will create if not present).} diff --git a/man/regional_summary.Rd b/man/regional_summary.Rd index 0e37486bc..ae9c44e2a 100644 --- a/man/regional_summary.Rd +++ b/man/regional_summary.Rd @@ -19,10 +19,10 @@ regional_summary( ) } \arguments{ -\item{regional_output}{A list of output as produced by \code{regional_epinow} and -stored in the \code{regional} list.} +\item{regional_output}{A list of output as produced by \code{\link[=regional_epinow]{regional_epinow()}} +and stored in the \code{regional} list.} -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date), and region (\code{region}).} \item{results_dir}{An optional character string indicating the location of diff --git a/man/report_cases.Rd b/man/report_cases.Rd index 008e47e75..e7d13a026 100644 --- a/man/report_cases.Rd +++ b/man/report_cases.Rd @@ -21,8 +21,8 @@ variables: date, sample, cases} variables: date, sample, cases. If not supplied the default is not to incorporate forecasts.} -\item{delays}{A call to \code{delay_opts()} defining delay distributions and -options. See the documentation of \code{delay_opts()} and the examples below for +\item{delays}{A call to \code{\link[=delay_opts]{delay_opts()}} defining delay distributions and +options. See the documentation of \code{\link[=delay_opts]{delay_opts()}} and the examples below for details.} \item{type}{Character string indicating the method to use to transform diff --git a/man/report_plots.Rd b/man/report_plots.Rd index 978095bf1..91c2b318e 100644 --- a/man/report_plots.Rd +++ b/man/report_plots.Rd @@ -13,8 +13,8 @@ the following variables: variable, median, bottom, and top. It should also contain the following estimates: R, infections, reported_cases_rt, and r (rate of growth).} -\item{reported}{A data.table of reported cases with the following variables: -date, confirm.} +\item{reported}{A \verb{} of reported cases with the following +variables: date, confirm.} \item{target_folder}{Character string specifying where to save results (will create if not present).} diff --git a/man/rstan_opts.Rd b/man/rstan_opts.Rd index df5f82798..5d2342507 100644 --- a/man/rstan_opts.Rd +++ b/man/rstan_opts.Rd @@ -14,7 +14,7 @@ default.} When using multiple chains iterations per chain is samples / chains.} \item{method}{A character string, defaulting to sampling. Currently supports -\code{rstan::sampling} ("sampling") or \code{rstan:vb} ("vb").} +\code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}} ("sampling") or \code{\link[=rstan:vb]{rstan:vb()}} ("vb").} \item{...}{Additional parameters to pass underlying option functions.} } @@ -24,7 +24,7 @@ A list of arguments to pass to the appropriate rstan functions. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Defines a list specifying the arguments passed to underlying \code{rstan} -functions via \code{rstan_sampling_opts()} and \code{rstan_vb_opts()}.Custom settings +functions via \code{\link[=rstan_sampling_opts]{rstan_sampling_opts()}} and \code{\link[=rstan_vb_opts]{rstan_vb_opts()}}.Custom settings can be supplied which override the defaults. } \examples{ @@ -34,7 +34,7 @@ rstan_opts(samples = 1000) rstan_opts(method = "vb") } \seealso{ -rstan_sampling_opts rstan_vb_opts +\code{\link[=rstan_sampling_opts]{rstan_sampling_opts()}} \code{\link[=rstan_vb_opts]{rstan_vb_opts()}} } \author{ Sam Abbott diff --git a/man/rstan_sampling_opts.Rd b/man/rstan_sampling_opts.Rd index 34f7645ff..62a00ffcb 100644 --- a/man/rstan_sampling_opts.Rd +++ b/man/rstan_sampling_opts.Rd @@ -43,7 +43,7 @@ of sampling process.} \item{future}{Logical, defaults to \code{FALSE}. Should stan chains be run in parallel using \code{future}. This allows users to have chains fail gracefully (i.e when combined with \code{max_execution_time}). Should be combined with a -call to \code{future::plan}.} +call to \code{\link[future:plan]{future::plan()}}.} \item{max_execution_time}{Numeric, defaults to Inf (seconds). If set wil kill off processing of each chain if not finished within the specified @@ -51,15 +51,15 @@ timeout. When more than 2 chains finish successfully estimates will still be returned. If less than 2 chains return within the allowed time then estimation will fail with an informative error.} -\item{...}{Additional parameters to pass to \code{rstan::sampling}.} +\item{...}{Additional parameters to pass to \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}.} } \value{ -A list of arguments to pass to \code{rstan::sampling}. +A list of arguments to pass to \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Defines a list specifying the arguments passed to -\code{rstan::sampling}. Custom settings can be supplied which override the +\code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}. Custom settings can be supplied which override the defaults. } \examples{ diff --git a/man/rstan_vb_opts.Rd b/man/rstan_vb_opts.Rd index 44a987c66..bafe58b24 100644 --- a/man/rstan_vb_opts.Rd +++ b/man/rstan_vb_opts.Rd @@ -10,21 +10,21 @@ rstan_vb_opts(samples = 2000, trials = 10, iter = 10000, ...) \item{samples}{Numeric, default 2000. Overall number of approximate posterior samples.} -\item{trials}{Numeric, defaults to 10. Number of attempts to use \code{rstan::vb} -before failing.} +\item{trials}{Numeric, defaults to 10. Number of attempts to use +rstan::vb()] before failing.} \item{iter}{Numeric, defaulting to 10000. Number of iterations to use in -\code{rtan::vb}.} +\code{\link[rstan:stanmodel-method-vb]{rstan::vb()}}.} -\item{...}{Additional parameters to pass to \code{rstan::vb}.} +\item{...}{Additional parameters to pass to \code{\link[rstan:stanmodel-method-vb]{rstan::vb()}}.} } \value{ -A list of arguments to pass to \code{rstan::vb}. +A list of arguments to pass to \code{\link[rstan:stanmodel-method-vb]{rstan::vb()}}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Defines a list specifying the arguments passed to -\code{rstan::vb}. Custom settings can be supplied which override the defaults. +\code{\link[rstan:stanmodel-method-vb]{rstan::vb()}}. Custom settings can be supplied which override the defaults. } \examples{ rstan_vb_opts(samples = 1000) diff --git a/man/run_region.Rd b/man/run_region.Rd index eb76fc82f..8f8a85eb9 100644 --- a/man/run_region.Rd +++ b/man/run_region.Rd @@ -30,34 +30,34 @@ run_region( \arguments{ \item{target_region}{Character string indicating the region being evaluated} -\item{generation_time}{A call to \code{generation_time_opts()} defining the +\item{generation_time}{A call to \code{\link[=generation_time_opts]{generation_time_opts()}} defining the generation time distribution used. For backwards compatibility a list of summary parameters can also be passed.} -\item{delays}{A call to \code{delay_opts()} defining delay distributions and -options. See the documentation of \code{delay_opts()} and the examples below for +\item{delays}{A call to \code{\link[=delay_opts]{delay_opts()}} defining delay distributions and +options. See the documentation of \code{\link[=delay_opts]{delay_opts()}} and the examples below for details.} -\item{truncation}{A call to \code{trunc_opts()} defining the truncation of -observed data. Defaults to \code{trunc_opts()}. See \code{estimate_truncation()} for +\item{truncation}{A call to \code{\link[=trunc_opts]{trunc_opts()}} defining the truncation of +observed data. Defaults to \code{\link[=trunc_opts]{trunc_opts()}}. See \code{\link[=estimate_truncation]{estimate_truncation()}} for an approach to estimating truncation from data.} -\item{rt}{A list of options as generated by \code{rt_opts()} defining Rt -estimation. Defaults to \code{rt_opts()}. Set to \code{NULL} to switch to using back +\item{rt}{A list of options as generated by \code{\link[=rt_opts]{rt_opts()}} defining Rt +estimation. Defaults to \code{\link[=rt_opts]{rt_opts()}}. Set to \code{NULL} to switch to using back calculation rather than generating infections using Rt.} -\item{backcalc}{A list of options as generated by \code{backcalc_opts()} to -define the back calculation. Defaults to \code{backcalc_opts()}.} +\item{backcalc}{A list of options as generated by \code{\link[=backcalc_opts]{backcalc_opts()}} to +define the back calculation. Defaults to \code{\link[=backcalc_opts]{backcalc_opts()}}.} -\item{gp}{A list of options as generated by \code{gp_opts()} to define the -Gaussian process. Defaults to \code{gp_opts()}.Set to NULL to disable the +\item{gp}{A list of options as generated by \code{\link[=gp_opts]{gp_opts()}} to define the +Gaussian process. Defaults to \code{\link[=gp_opts]{gp_opts()}}. Set to \code{NULL} to disable the Gaussian process.} -\item{obs}{A list of options as generated by \code{obs_opts()} defining the -observation model. Defaults to \code{obs_opts()}.} +\item{obs}{A list of options as generated by \code{\link[=obs_opts]{obs_opts()}} defining the +observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} -\item{stan}{A list of stan options as generated by \code{stan_opts()}. Defaults -to \code{stan_opts()}. Can be used to override \code{data}, \code{init}, and \code{verbose} +\item{stan}{A list of stan options as generated by \code{\link[=stan_opts]{stan_opts()}}. Defaults +to \code{\link[=stan_opts]{stan_opts()}}. Can be used to override \code{data}, \code{init}, and \code{verbose} settings if desired.} \item{horizon}{Numeric, defaults to 7. Number of days into the future to @@ -65,7 +65,7 @@ forecast.} \item{CrIs}{Numeric vector of credible intervals to calculate.} -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date), and region (\code{region}).} \item{target_folder}{Character string specifying where to save results (will @@ -90,23 +90,23 @@ then the default is also to copy all results into a latest folder.} the completion of estimation to.} \item{verbose}{Logical defaults to FALSE. Outputs verbose progress messages -to the console from \code{epinow}.} +to the console from \code{\link[=epinow]{epinow()}}.} -\item{progress_fn}{Function as returned by \code{progressr::progressor}. Allows +\item{progress_fn}{Function as returned by \code{\link[progressr:progressor]{progressr::progressor()}}. Allows the use of a progress bar.} -\item{...}{Pass additional arguments to \code{epinow}. See the documentation for -\code{epinow} for details.} +\item{...}{Pass additional arguments to \code{\link[=epinow]{epinow()}}. See the documentation for +\code{\link[=epinow]{epinow()}} for details.} } \value{ -A list of processed output as produced by \code{process_region} +A list of processed output as produced by \code{\link[=process_region]{process_region()}} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -Internal function that handles calling \code{epinow}. Future work will extend this -function to better handle \code{stan} logs and allow the user to modify settings -between regions. +Internal function that handles calling \code{\link[=epinow]{epinow()}}. Future work will extend +this function to better handle \code{{stan}} logs and allow the user to modify +settings between regions. } \seealso{ -regional_epinow +\code{\link[=regional_epinow]{regional_epinow()}} } diff --git a/man/sample_approx_dist.Rd b/man/sample_approx_dist.Rd index 302e6e180..7d2e07b8c 100644 --- a/man/sample_approx_dist.Rd +++ b/man/sample_approx_dist.Rd @@ -15,7 +15,7 @@ sample_approx_dist( ) } \arguments{ -\item{cases}{A dataframe of cases (in date order) with the following +\item{cases}{A \verb{} of cases (in date order) with the following variables: \code{date} and \code{cases}.} \item{dist_fn}{Function that takes two arguments with the first being @@ -39,12 +39,12 @@ would shift by the median of the distribution.} after the first date reported in the data. Defaults to \code{TRUE}.} } \value{ -A \code{data.table} of cases by date of onset +A \verb{} of cases by date of onset } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#soft-deprecated}{\figure{lifecycle-soft-deprecated.svg}{options: alt='[Soft-deprecated]'}}}{\strong{[Soft-deprecated]}} Convolves cases by a PMF function. This function will soon be removed or -replaced with a more robust \code{stan} implementation. +replaced with a more robust \code{{stan}} implementation. } \examples{ \donttest{ diff --git a/man/save_input.Rd b/man/save_input.Rd index dfe26ad2b..1b6adf692 100644 --- a/man/save_input.Rd +++ b/man/save_input.Rd @@ -7,7 +7,7 @@ save_input(reported_cases, target_folder) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} \item{target_folder}{Character string specifying where to save results (will diff --git a/man/secondary_opts.Rd b/man/secondary_opts.Rd index 31bb22242..11b42902e 100644 --- a/man/secondary_opts.Rd +++ b/man/secondary_opts.Rd @@ -24,20 +24,20 @@ hospital admissions. options that can be passed.} } \value{ -A \verb{} object of binary options summarising secondary -model used in \code{estimate_secondary()}. Options returned are \code{cumulative} -(should the secondary report be cumulative), \code{historic} (should a -convolution of primary reported cases be used to predict secondary reported -cases), \code{primary_hist_additive} (should the historic convolution of primary -reported cases be additive or subtractive), \code{current} (should currently -observed primary reported cases contribute to current secondary reported -cases), \code{primary_current_additive} (should current primary reported cases be +A list of binary options summarising secondary model used in +\code{\link[=estimate_secondary]{estimate_secondary()}}. Options returned are \code{cumulative} (should the +secondary report be cumulative), \code{historic} (should a convolution of primary +reported cases be used to predict secondary reported cases), +\code{primary_hist_additive} (should the historic convolution of primary reported +cases be additive or subtractive), \code{current} (should currently observed +primary reported cases contribute to current secondary reported cases), +\code{primary_current_additive} (should current primary reported cases be additive or subtractive). } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Returns a list of options defining the secondary model used in -\code{estimate_secondary()}. This model is a combination of a convolution of +\code{\link[=estimate_secondary]{estimate_secondary()}}. This model is a combination of a convolution of previously observed primary reports combined with current primary reports (either additive or subtractive). It can optionally be cumulative. See the documentation of \code{type} for sensible options to cover most use cases and the diff --git a/man/set_dt_single_thread.Rd b/man/set_dt_single_thread.Rd index 9d3355459..990265f51 100644 --- a/man/set_dt_single_thread.Rd +++ b/man/set_dt_single_thread.Rd @@ -10,10 +10,10 @@ set_dt_single_thread() an environment in the parent frame named "dt_settings" } \description{ -This function sets the threads used by data.table to 1 in the parent function -and then restores the initial data.table threads when the function exits. -This is primarily used as an internal function inside of other functions -and will generally not be used on its own. +This function sets the threads used by \code{{data.table}} to 1 in the parent +function and then restores the initial \code{{data.table}} threads when the +function exits. This is primarily used as an internal function inside of +other functions and will generally not be used on its own. } \examples{ \donttest{ diff --git a/man/setup_default_logging.Rd b/man/setup_default_logging.Rd index 4a32b0e20..5633cc767 100644 --- a/man/setup_default_logging.Rd +++ b/man/setup_default_logging.Rd @@ -14,11 +14,11 @@ setup_default_logging( \item{logs}{Character path indicating the target folder in which to store log information. Defaults to the temporary directory if not specified. Default logging can be disabled if \code{logs} is set to NULL. If specifying a custom -logging setup then the code for \code{setup_default_logging} and the -\code{setup_logging} function are a sensible place to start.} +logging setup then the code for \code{\link[=setup_default_logging]{setup_default_logging()}} and the +\code{\link[=setup_logging]{setup_logging()}} function are a sensible place to start.} \item{mirror_epinow}{Logical, defaults to FALSE. Should internal logging be -returned from \code{epinow} to the console.} +returned from \code{\link[=epinow]{epinow()}} to the console.} \item{target_date}{Date, defaults to maximum found in the data if not specified.} diff --git a/man/setup_dt.Rd b/man/setup_dt.Rd index ee79fb62e..cd2b8de6d 100644 --- a/man/setup_dt.Rd +++ b/man/setup_dt.Rd @@ -7,7 +7,7 @@ setup_dt(reported_cases) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} } \value{ @@ -15,6 +15,6 @@ A data table } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Convenience function that sets the number of \code{data.table} cores to 1 and -maps input to be a \code{data.table} +Convenience function that sets the number of \code{{data.table}} cores to 1 and +maps input to be a \code{{data.table}} } diff --git a/man/setup_future.Rd b/man/setup_future.Rd index 648a05a98..6e52f3940 100644 --- a/man/setup_future.Rd +++ b/man/setup_future.Rd @@ -11,15 +11,16 @@ setup_future( ) } \arguments{ -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date), and region (\code{region}).} \item{strategies}{A vector length 1 to 2 of strategies to pass to -\code{future::plan}. Nesting of parallelisation is from the top level down. +\code{\link[future:plan]{future::plan()}}. Nesting of parallelisation is from the top level down. The default is to set up nesting parallelisation with both using -\code{future::multisession} (\code{future::multicore} will likely be a faster option on -supported platforms). For single level parallelisation use a single strategy -or \code{future::plan} directly. See \code{?future::plan} for options.} +\code{\link[future:multisession]{future::multisession()}} (\code{\link[future:multicore]{future::multicore()}} will likely be a faster +option on supported platforms). For single level parallelisation use a +single strategy or \code{\link[future:plan]{future::plan()}} directly. See \code{\link[future:plan]{future::plan()}} for +options.} \item{min_cores_per_worker}{Numeric, the minimum number of cores per worker. Defaults to 4 which assumes 4 MCMC chains are in use per region.} @@ -33,6 +34,6 @@ Numeric number of cores to use per worker. If greater than 1 pass to \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} A utility function that aims to streamline the set up of the required future backend with sensible defaults for most users of -\code{regional_epinow}. More advanced users are recommended to setup their own -\code{future} backend based on their available resources. +\code{\link[=regional_epinow]{regional_epinow()}}. More advanced users are recommended to setup their own +\code{{future}} backend based on their available resources. } diff --git a/man/setup_logging.Rd b/man/setup_logging.Rd index 8fa3d6537..5ad5d01b0 100644 --- a/man/setup_logging.Rd +++ b/man/setup_logging.Rd @@ -24,8 +24,8 @@ file should they also be duplicated in the console.} \item{name}{Character string defaulting to EpiNow2. This indicates the name of the logger to setup. The default logger for EpiNow2 is called EpiNow2. Nested options include: Epinow2.epinow which controls all logging for -\code{epinow} and nested functions, EpiNow2.epinow.estimate_infections (logging in -\code{estimate_infections}), and EpiNow2.epinow.estimate_infections.fit (logging +\code{\link[=epinow]{epinow()}} and nested functions, EpiNow2.epinow.estimate_infections (logging in +\code{\link[=estimate_infections]{estimate_infections()}}, and EpiNow2.epinow.estimate_infections.fit (logging in fitting functions).} } \value{ @@ -33,9 +33,9 @@ Nothing } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} -Sets up \code{futile.logger} logging, which is integrated into \code{EpiNow2}. See the -documentation for \code{futile.logger} for full details. By default \code{EpiNow2} -prints all logs at the "INFO" level and returns them to the console. Usage -of logging is currently being explored as the current setup cannot log stan -errors or progress. +Sets up \code{{futile.logger}} logging, which is integrated into \code{{EpiNow2}}. +See the documentation for \code{{futile.logger}} for full details. By default +\code{{EpiNow2}} prints all logs at the "INFO" level and returns them to the +console. Usage of logging is currently being explored as the current +setup cannot log stan errors or progress. } diff --git a/man/simulate_infections.Rd b/man/simulate_infections.Rd index 046dd83fa..4b3046c6e 100644 --- a/man/simulate_infections.Rd +++ b/man/simulate_infections.Rd @@ -15,26 +15,26 @@ simulate_infections( ) } \arguments{ -\item{estimates}{The \code{estimates} element of an \code{epinow} run that +\item{estimates}{The \code{estimates} element of an \code{\link[=epinow]{epinow()}} run that has been done with output = "fit", or the result of -\code{estimate_infections} with \code{return_fit} set to TRUE.} +\code{\link[=estimate_infections]{estimate_infections()}} with \code{return_fit} set to TRUE.} \item{R}{A numeric vector of reproduction numbers; these will overwrite the reproduction numbers contained in \code{estimates}, except elements set to -NA. Alternatively accepts a data.frame containing at least \code{date} and \code{value} -(integer) variables and optionally \code{sample}. More (or fewer) days than in -the original fit can be simulated.} +NA. Alternatively accepts a \verb{} containing at least \code{date} and +\code{value} (integer) variables and optionally \code{sample}. More (or fewer) days +than in the original fit can be simulated.} -\item{model}{A compiled stan model as returned by \code{rstan::stan_model}.} +\item{model}{A compiled stan model as returned by \code{\link[rstan:stan_model]{rstan::stan_model()}}.} \item{samples}{Numeric, number of posterior samples to simulate from. The default is to use all samples in the \code{estimates} input.} \item{batch_size}{Numeric, defaults to 10. Size of batches in which to simulate. May decrease run times due to reduced IO costs but this is still -being evaluated. If set to NULL then al simulations are done at once.} +being evaluated. If set to NULL then all simulations are done at once.} -\item{verbose}{Logical defaults to \code{interactive()}. Should a progress bar +\item{verbose}{Logical defaults to \code{\link[=interactive]{interactive()}}. Should a progress bar (from \code{progressr}) be shown.} } \value{ @@ -46,7 +46,7 @@ results from the specified scenario rather than fitting. This function simulates infections using an existing fit to observed cases but with a modified time-varying reproduction number. This can be used to explore forecast models or past counterfactuals. Simulations can be run in -parallel using \code{future::plan}. +parallel using \code{\link[future:plan]{future::plan()}}. } \examples{ \donttest{ @@ -95,3 +95,8 @@ plot(sims) options(old_opts) } } +\seealso{ +\code{\link[=dist_spec]{dist_spec()}} \code{\link[=generation_time_opts]{generation_time_opts()}} \code{\link[=delay_opts]{delay_opts()}} \code{\link[=rt_opts]{rt_opts()}} +\code{\link[=estimate_infections]{estimate_infections()}} \code{\link[=trunc_opts]{trunc_opts()}} \code{\link[=stan_opts]{stan_opts()}} \code{\link[=obs_opts]{obs_opts()}} +\code{\link[=gp_opts]{gp_opts()}} +} diff --git a/man/simulate_secondary.Rd b/man/simulate_secondary.Rd index a75f498dc..f926807d7 100644 --- a/man/simulate_secondary.Rd +++ b/man/simulate_secondary.Rd @@ -13,7 +13,7 @@ simulate_secondary( ) } \arguments{ -\item{data}{A data frame containing the \code{date} of report and \code{primary} +\item{data}{A \verb{} containing the \code{date} of report and \code{primary} cases as a numeric vector.} \item{type}{A character string indicating the type of observation the @@ -40,7 +40,7 @@ the convolution model.} \code{rnbinom} or \code{rpois}).} } \value{ -A data frame containing simulated data in the format required by +A \verb{} containing simulated data in the format required by \code{\link[=estimate_secondary]{estimate_secondary()}}. } \description{ diff --git a/man/stan_opts.Rd b/man/stan_opts.Rd index c6d02adba..be49eb8d2 100644 --- a/man/stan_opts.Rd +++ b/man/stan_opts.Rd @@ -26,7 +26,7 @@ national level fit to parametrise regional level fits. Optionally a character string can be passed with the currently supported option being "cumulative". This fits the model to cumulative cases and may be useful for certain data sets where the sampler gets stuck or struggles to initialise. -See \code{init_cumulative_fit()} for details. +See \code{\link[=init_cumulative_fit]{init_cumulative_fit()}} for details. This implementation is based on the approach taken in \href{https://github.com/ImperialCollegeLondon/epidemia/}{epidemia} authored by @@ -44,18 +44,18 @@ rstan functions. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Defines a list specifying the arguments passed to underlying stan -backend functions via \code{rstan_sampling_opts()} and \code{rstan_vb_opts()}. Custom +backend functions via \code{\link[=rstan_sampling_opts]{rstan_sampling_opts()}} and \code{\link[=rstan_vb_opts]{rstan_vb_opts()}}. Custom settings can be supplied which override the defaults. } \examples{ -# using default of rstan::sampling +# using default of [rstan::sampling()] stan_opts(samples = 1000) # using vb stan_opts(method = "vb") } \seealso{ -rstan_opts +\code{\link[=rstan_opts]{rstan_opts()}} } \author{ Sam Abbott diff --git a/man/summarise_key_measures.Rd b/man/summarise_key_measures.Rd index 771e04fe2..940571381 100644 --- a/man/summarise_key_measures.Rd +++ b/man/summarise_key_measures.Rd @@ -35,7 +35,7 @@ date of report } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -Produces summarised data frames of output across regions. Used internally by +Produces summarised \verb{}s of output across regions. Used internally by \code{regional_summary}. } \seealso{ diff --git a/man/summarise_results.Rd b/man/summarise_results.Rd index 1db5c29c9..a317277eb 100644 --- a/man/summarise_results.Rd +++ b/man/summarise_results.Rd @@ -16,7 +16,7 @@ summarise_results( \item{regions}{An character string containing the list of regions to extract results for (must all have results for the same target date).} -\item{summaries}{A list of summary data frames as output by \code{epinow}} +\item{summaries}{A list of summary \verb{}s as output by \code{epinow}} \item{results_dir}{An optional character string indicating the location of the results directory to extract results from.} diff --git a/man/summary.epinow.Rd b/man/summary.epinow.Rd index 7fced965c..5ae6ffef5 100644 --- a/man/summary.epinow.Rd +++ b/man/summary.epinow.Rd @@ -20,7 +20,7 @@ \item{...}{Pass additional summary arguments to lower level methods} } \value{ -Returns a data frame of summary output +Returns a \verb{} of summary output } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/summary.estimate_infections.Rd b/man/summary.estimate_infections.Rd index 71940df28..15622e751 100644 --- a/man/summary.estimate_infections.Rd +++ b/man/summary.estimate_infections.Rd @@ -24,7 +24,7 @@ samples.} \item{...}{Pass additional arguments to \code{report_summary}} } \value{ -Returns a data frame of summary output +Returns a \verb{} of summary output } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/trunc_opts.Rd b/man/trunc_opts.Rd index 504078016..a449cede4 100644 --- a/man/trunc_opts.Rd +++ b/man/trunc_opts.Rd @@ -18,7 +18,7 @@ distribution. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Returns a truncation distribution formatted for usage by -downstream functions. See \code{estimate_truncation()} for an approach to +downstream functions. See \code{\link[=estimate_truncation]{estimate_truncation()}} for an approach to estimate these distributions. } \examples{ @@ -29,7 +29,8 @@ trunc_opts() trunc_opts(dist = dist_spec(mean = 3, sd = 2, max = 10)) } \seealso{ -convert_to_logmean convert_to_logsd bootstrapped_dist_fit dist_spec +\code{\link[=convert_to_logmean]{convert_to_logmean()}} \code{\link[=convert_to_logsd]{convert_to_logsd()}} +\code{\link[=bootstrapped_dist_fit]{bootstrapped_dist_fit()}} \code{\link[=dist_spec]{dist_spec()}} } \author{ Sam Abbott diff --git a/man/update_horizon.Rd b/man/update_horizon.Rd index f2ca919c7..c34538fd5 100644 --- a/man/update_horizon.Rd +++ b/man/update_horizon.Rd @@ -13,7 +13,7 @@ forecast.} \item{target_date}{Date, defaults to maximum found in the data if not specified.} -\item{reported_cases}{A data frame of confirmed cases (confirm) by date +\item{reported_cases}{A \verb{} of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.} } \value{ diff --git a/man/update_list.Rd b/man/update_list.Rd index 86d86e28a..4ef385d1b 100644 --- a/man/update_list.Rd +++ b/man/update_list.Rd @@ -17,5 +17,5 @@ A list \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Used to handle updating settings in a list. For example when making -changes to \code{opts_list} output. +changes to \code{\link[=opts_list]{opts_list()}} output. } diff --git a/man/update_secondary_args.Rd b/man/update_secondary_args.Rd index 232c29928..14c4344ba 100644 --- a/man/update_secondary_args.Rd +++ b/man/update_secondary_args.Rd @@ -9,12 +9,12 @@ update_secondary_args(data, priors, verbose = TRUE) \arguments{ \item{data}{A list of data and arguments as returned by \code{create_stan_data()}.} -\item{priors}{A \code{data.frame} of named priors to be used in model fitting +\item{priors}{A \verb{} of named priors to be used in model fitting rather than the defaults supplied from other arguments. This is typically useful if wanting to inform a estimate from the posterior of another model fit. Priors that are currently use to update the defaults are the scaling fraction ("frac_obs"), the mean delay ("delay_mean"), and standard deviation -of the delay ("delay_sd"). The \code{data.frame} should have the following +of the delay ("delay_sd"). The \verb{} should have the following variables: \code{variable}, \code{mean}, and \code{sd}.} \item{verbose}{Logical, defaults to \code{FALSE}. Should verbose progress @@ -26,8 +26,8 @@ A list as produced by \code{create_stan_data()}. \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} This functions allows the user to more easily specify data driven or model -based priors for \code{estimate_secondary()} from example from previous model fits -using a \code{data.frame} to overwrite other default settings. Note that default +based priors for \code{\link[=estimate_secondary]{estimate_secondary()}} from example from previous model fits +using a \verb{} to overwrite other default settings. Note that default settings are still required. } \examples{ From 6adba0182fd76a549fd8f340e80db6a30e47f3b3 Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Tue, 14 Nov 2023 15:29:10 +0000 Subject: [PATCH 2/8] Fix doc of secondary_opts() --- R/estimate_secondary.R | 4 ++-- man/calc_summary_stats.Rd | 4 ++-- man/estimate_secondary.Rd | 4 ++-- man/extract_CrIs.Rd | 3 ++- man/regional_epinow.Rd | 6 +++--- man/secondary_opts.Rd | 18 +++++++++--------- man/setup_logging.Rd | 6 +++--- man/summarise_key_measures.Rd | 4 ++-- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/R/estimate_secondary.R b/R/estimate_secondary.R index 3a139eab5..b29e3d34c 100644 --- a/R/estimate_secondary.R +++ b/R/estimate_secondary.R @@ -252,9 +252,9 @@ estimate_secondary <- function(reports, #' @param ... Overwrite options defined by type. See the returned values for all #' options that can be passed. #' @importFrom rlang arg_match -#' @seealso estimate_secondary +#' @seealso [estimate_secondary()] #' @return A `` object of binary options summarising secondary -#' model used in `estimate_secondary()`. Options returned are `cumulative` +#' model used in [estimate_secondary()]. Options returned are `cumulative` #' (should the secondary report be cumulative), `historic` (should a #' convolution of primary reported cases be used to predict secondary reported #' cases), `primary_hist_additive` (should the historic convolution of primary diff --git a/man/calc_summary_stats.Rd b/man/calc_summary_stats.Rd index 3633b3d42..844667586 100644 --- a/man/calc_summary_stats.Rd +++ b/man/calc_summary_stats.Rd @@ -17,8 +17,8 @@ credible interval } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Calculate summary statistics from a \verb{} by group. Currently supports -the mean, median and standard deviation. +Calculate summary statistics from a \verb{} by group. +Currently supports the mean, median and standard deviation. } \examples{ samples <- data.frame(value = 1:10, type = "car") diff --git a/man/estimate_secondary.Rd b/man/estimate_secondary.Rd index dd005bfb2..688ff020a 100644 --- a/man/estimate_secondary.Rd +++ b/man/estimate_secondary.Rd @@ -69,8 +69,8 @@ to \code{\link[=interactive]{interactive()}}.} \item{...}{Additional parameters to pass to \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}.} } \value{ -A list containing: \code{predictions} (a \verb{} ordered by date with -the primary, and secondary observations, and a summary of the model +A list containing: \code{predictions} (a \verb{} ordered by date +with the primary, and secondary observations, and a summary of the model estimated secondary observations), \code{posterior} which contains a summary of the entire model posterior, \code{data} (a list of data used to fit the model), and \code{fit} (the \code{stanfit} object). diff --git a/man/extract_CrIs.Rd b/man/extract_CrIs.Rd index 8f41bf0b0..9ce7cb0aa 100644 --- a/man/extract_CrIs.Rd +++ b/man/extract_CrIs.Rd @@ -10,7 +10,8 @@ extract_CrIs(summarised) \item{summarised}{A \verb{} as processed by \code{calc_CrIs}} } \value{ -A numeric vector of credible intervals detected in the \verb{}. +A numeric vector of credible intervals detected in +the \verb{}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/regional_epinow.Rd b/man/regional_epinow.Rd index d031486f8..52ef5dd4a 100644 --- a/man/regional_epinow.Rd +++ b/man/regional_epinow.Rd @@ -123,9 +123,9 @@ region) to the relevant argument. A helper function (\code{\link[=opts_list]{opt available to facilitate building this list. Regions can be estimated in parallel using the \code{{future}} package (see -\code{\link[=setup_future]{setup_future()}}). The progress of producing estimates across multiple regions -is tracked using the \code{{progressr}} package. Modify this behaviour using -\code{\link[progressr:handlers]{progressr::handlers()}} and enable it in batch by setting +\code{\link[=setup_future]{setup_future()}}). The progress of producing estimates across multiple +regions is tracked using the \code{{progressr}} package. Modify this behaviour +using \code{\link[progressr:handlers]{progressr::handlers()}} and enable it in batch by setting \code{R_PROGRESSR_ENABLE=TRUE} as an environment variable. } \examples{ diff --git a/man/secondary_opts.Rd b/man/secondary_opts.Rd index 11b42902e..46442bb32 100644 --- a/man/secondary_opts.Rd +++ b/man/secondary_opts.Rd @@ -24,14 +24,14 @@ hospital admissions. options that can be passed.} } \value{ -A list of binary options summarising secondary model used in -\code{\link[=estimate_secondary]{estimate_secondary()}}. Options returned are \code{cumulative} (should the -secondary report be cumulative), \code{historic} (should a convolution of primary -reported cases be used to predict secondary reported cases), -\code{primary_hist_additive} (should the historic convolution of primary reported -cases be additive or subtractive), \code{current} (should currently observed -primary reported cases contribute to current secondary reported cases), -\code{primary_current_additive} (should current primary reported cases be +A \verb{} object of binary options summarising secondary +model used in \code{\link[=estimate_secondary]{estimate_secondary()}}. Options returned are \code{cumulative} +(should the secondary report be cumulative), \code{historic} (should a +convolution of primary reported cases be used to predict secondary reported +cases), \code{primary_hist_additive} (should the historic convolution of primary +reported cases be additive or subtractive), \code{current} (should currently +observed primary reported cases contribute to current secondary reported +cases), \code{primary_current_additive} (should current primary reported cases be additive or subtractive). } \description{ @@ -51,7 +51,7 @@ secondary_opts("incidence") secondary_opts("prevalence") } \seealso{ -estimate_secondary +\code{\link[=estimate_secondary]{estimate_secondary()}} } \author{ Sam Abbott diff --git a/man/setup_logging.Rd b/man/setup_logging.Rd index 5ad5d01b0..56cc75e51 100644 --- a/man/setup_logging.Rd +++ b/man/setup_logging.Rd @@ -24,9 +24,9 @@ file should they also be duplicated in the console.} \item{name}{Character string defaulting to EpiNow2. This indicates the name of the logger to setup. The default logger for EpiNow2 is called EpiNow2. Nested options include: Epinow2.epinow which controls all logging for -\code{\link[=epinow]{epinow()}} and nested functions, EpiNow2.epinow.estimate_infections (logging in -\code{\link[=estimate_infections]{estimate_infections()}}, and EpiNow2.epinow.estimate_infections.fit (logging -in fitting functions).} +\code{\link[=epinow]{epinow()}} and nested functions, EpiNow2.epinow.estimate_infections +(logging in \code{\link[=estimate_infections]{estimate_infections()}}, and +EpiNow2.epinow.estimate_infections.fit (logging in fitting functions).} } \value{ Nothing diff --git a/man/summarise_key_measures.Rd b/man/summarise_key_measures.Rd index 940571381..913911229 100644 --- a/man/summarise_key_measures.Rd +++ b/man/summarise_key_measures.Rd @@ -35,8 +35,8 @@ date of report } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} -Produces summarised \verb{}s of output across regions. Used internally by -\code{regional_summary}. +Produces summarised \verb{}s of output across regions. +Used internally by \code{regional_summary}. } \seealso{ regional_summary From f237fc16d2ec8d826238f2d77e722e22d3c7314a Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Wed, 15 Nov 2023 10:11:35 +0000 Subject: [PATCH 3/8] Fix wrong function links --- R/dist.R | 2 +- R/extract.R | 2 +- R/opts.R | 2 +- man/dist_spec.Rd | 2 +- man/extract_parameter_samples.Rd | 2 +- man/rstan_opts.Rd | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/dist.R b/R/dist.R index 8a3dc42d0..ca107cdb8 100644 --- a/R/dist.R +++ b/R/dist.R @@ -884,7 +884,7 @@ tune_inv_gamma <- function(lower = 2, upper = 21) { #' empty vector corresponding to a parametric specification of the distribution #' (using \code{mean}, \code{sd} and corresponding uncertainties) #' -#' @param fixed Deprecated, use [fix_dist() instead] +#' @param fixed Deprecated, use [fix_dist()] instead #' as coming from fixed (vs uncertain) distributions. Overrides any values #' assigned to \code{mean_sd} and \code{sd_sd} by setting them to zero. #' reduces compute requirement but may produce spuriously precise estimates. diff --git a/R/extract.R b/R/extract.R index dc743e17a..edeb11a40 100644 --- a/R/extract.R +++ b/R/extract.R @@ -60,7 +60,7 @@ extract_static_parameter <- function(param, samples) { #' Extracts a custom set of parameters from a `{stan}` object and adds #' stratification and dates where appropriate. #' -#' @param stan_fit A fit Stan model as returned by [rstan:sampling()]. +#' @param stan_fit A fit `{stan}` model as returned by [rstan::sampling()]. #' #' @param data A list of the data supplied to the [rstan::sampling()] call. #' diff --git a/R/opts.R b/R/opts.R index d8a965f5b..9c02cbaa3 100644 --- a/R/opts.R +++ b/R/opts.R @@ -618,7 +618,7 @@ rstan_vb_opts <- function(samples = 2000, #' default. #' #' @param method A character string, defaulting to sampling. Currently supports -#' [rstan::sampling()] ("sampling") or [rstan:vb()] ("vb"). +#' [rstan::sampling()] ("sampling") or [rstan::vb()] ("vb"). #' #' @param ... Additional parameters to pass underlying option functions. #' @importFrom rlang arg_match diff --git a/man/dist_spec.Rd b/man/dist_spec.Rd index 67dda4677..09ff18824 100644 --- a/man/dist_spec.Rd +++ b/man/dist_spec.Rd @@ -63,7 +63,7 @@ probability mass function of the delay (starting with 0); defaults to an empty vector corresponding to a parametric specification of the distribution (using \code{mean}, \code{sd} and corresponding uncertainties)} -\item{fixed}{Deprecated, use \link{fix_dist() instead} +\item{fixed}{Deprecated, use \code{\link[=fix_dist]{fix_dist()}} instead as coming from fixed (vs uncertain) distributions. Overrides any values assigned to \code{mean_sd} and \code{sd_sd} by setting them to zero. reduces compute requirement but may produce spuriously precise estimates.} diff --git a/man/extract_parameter_samples.Rd b/man/extract_parameter_samples.Rd index 811420e02..ed0d509cd 100644 --- a/man/extract_parameter_samples.Rd +++ b/man/extract_parameter_samples.Rd @@ -14,7 +14,7 @@ extract_parameter_samples( ) } \arguments{ -\item{stan_fit}{A fit Stan model as returned by \code{\link[=rstan:sampling]{rstan:sampling()}}.} +\item{stan_fit}{A fit \code{{stan}} model as returned by \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}.} \item{data}{A list of the data supplied to the \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}} call.} diff --git a/man/rstan_opts.Rd b/man/rstan_opts.Rd index 5d2342507..fa9f76cbb 100644 --- a/man/rstan_opts.Rd +++ b/man/rstan_opts.Rd @@ -14,7 +14,7 @@ default.} When using multiple chains iterations per chain is samples / chains.} \item{method}{A character string, defaulting to sampling. Currently supports -\code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}} ("sampling") or \code{\link[=rstan:vb]{rstan:vb()}} ("vb").} +\code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}} ("sampling") or \code{\link[rstan:stanmodel-method-vb]{rstan::vb()}} ("vb").} \item{...}{Additional parameters to pass underlying option functions.} } From 02297760fe0d7b39a4dca7eaa127dc2da14a9d9f Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Wed, 15 Nov 2023 23:23:04 +0000 Subject: [PATCH 4/8] Linting: Use == instead of %in% to check for scalars of length 1 --- R/adjust.R | 2 +- R/get.R | 2 +- R/utilities.R | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/adjust.R b/R/adjust.R index fc19ee611..4858eafc1 100644 --- a/R/adjust.R +++ b/R/adjust.R @@ -142,7 +142,7 @@ adjust_infection_to_report <- function(infections, delay_defs, } ## Truncate reported cases by maximum infection date - if (type %in% "sample" && truncate_future) { + if (type == "sample" && truncate_future) { report <- report[date <= max(infections$date)] } return(report) diff --git a/R/get.R b/R/get.R index 006351763..081498609 100644 --- a/R/get.R +++ b/R/get.R @@ -16,7 +16,7 @@ get_regions <- function(results_dir) { ) # put into alphabetical order - regions <- regions[!(regions %in% "runtimes.csv")] + regions <- regions[!(regions == "runtimes.csv")] regions <- sort(regions) names(regions) <- regions return(regions) diff --git a/R/utilities.R b/R/utilities.R index 1c9751672..24d319973 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -200,9 +200,9 @@ match_output_arguments <- function(input_args = NULL, supported_args = NULL, logger = NULL, level = "info") { - if (level %in% "info") { + if (level == "info") { flog_fn <- futile.logger::flog.info - } else if (level %in% "debug") { + } else if (level == "debug") { flog_fn <- futile.logger::flog.debug } # make supported args a logical vector From 00c1165b5d67eb46914b086b118fe0f74d8c9d13 Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Wed, 15 Nov 2023 23:24:32 +0000 Subject: [PATCH 5/8] Linting: switch logic of ifelse statement for readability --- R/utilities.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/utilities.R b/R/utilities.R index 24d319973..2b2c3cee9 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -62,8 +62,8 @@ make_conf <- function(value, CrI = 90, reverse = FALSE) { ) conf <- paste0( value$median, " (", - ifelse(!reverse, CrI$lower, CrI$upper), " -- ", - ifelse(!reverse, CrI$upper, CrI$lower), ")" + ifelse(reverse, CrI$upper, CrI$lower), " -- ", + ifelse(reverse, CrI$lower, CrI$upper), ")" ) return(conf) } From ca87a067a65268d8770cdb7cedeb42f2aaad0d83 Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Thu, 16 Nov 2023 12:40:59 +0000 Subject: [PATCH 6/8] Fix broken function link --- R/create.R | 2 +- man/create_stan_args.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/create.R b/R/create.R index 73c066650..1aa68bff9 100644 --- a/R/create.R +++ b/R/create.R @@ -611,7 +611,7 @@ create_initial_conditions <- function(data) { #' @param data A list of `{stan}` data as created by [create_stan_data()] #' #' @param init Initial conditions passed to `{rstan}`. Defaults to "random" but -#' can also be a function (as supplied by [create_intitial_conditions()]). +#' can also be a function (as supplied by [create_initial_conditions()]). #' #' @param verbose Logical, defaults to `FALSE`. Should verbose progress #' messages be returned. diff --git a/man/create_stan_args.Rd b/man/create_stan_args.Rd index ac843d00b..9718fe5e5 100644 --- a/man/create_stan_args.Rd +++ b/man/create_stan_args.Rd @@ -19,7 +19,7 @@ settings if desired.} \item{data}{A list of \code{{stan}} data as created by \code{\link[=create_stan_data]{create_stan_data()}}} \item{init}{Initial conditions passed to \code{{rstan}}. Defaults to "random" but -can also be a function (as supplied by \code{\link[=create_intitial_conditions]{create_intitial_conditions()}}).} +can also be a function (as supplied by \code{\link[=create_initial_conditions]{create_initial_conditions()}}).} \item{verbose}{Logical, defaults to \code{FALSE}. Should verbose progress messages be returned.} From 65a9cf03172939ddfbe6b2f2e48c26a1df372939 Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Thu, 16 Nov 2023 15:10:51 +0000 Subject: [PATCH 7/8] Fix a wrong function reference and link --- R/get.R | 2 +- man/get_regions.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/get.R b/R/get.R index 081498609..ef4fbb859 100644 --- a/R/get.R +++ b/R/get.R @@ -3,7 +3,7 @@ #' @description `r lifecycle::badge("stable")` #' #' @param results_dir A character string giving the directory in which results -#' are stored (as produced by [regional_rt_pipeline()]). +#' are stored (as produced by [regional_epinow()]). #' #' @return A named character vector containing the results to plot. #' @author Sam Abbott diff --git a/man/get_regions.Rd b/man/get_regions.Rd index a4b04eea8..56f6d55b6 100644 --- a/man/get_regions.Rd +++ b/man/get_regions.Rd @@ -8,7 +8,7 @@ get_regions(results_dir) } \arguments{ \item{results_dir}{A character string giving the directory in which results -are stored (as produced by \code{\link[=regional_rt_pipeline]{regional_rt_pipeline()}}).} +are stored (as produced by \code{\link[=regional_epinow]{regional_epinow()}}).} } \value{ A named character vector containing the results to plot. From 5921c926751924ca11f1397baa16582d0e192c12 Mon Sep 17 00:00:00 2001 From: James Azam Date: Mon, 20 Nov 2023 14:20:16 +0000 Subject: [PATCH 8/8] Reformat {stan} to stan --- R/create.R | 22 +++++++++++----------- R/dist.R | 6 +++--- R/extract.R | 6 +++--- R/regional_epinow.R | 2 +- R/utilities.R | 6 +++--- man/allocate_delays.Rd | 2 +- man/create_backcalc_data.Rd | 2 +- man/create_future_rt.Rd | 2 +- man/create_gp_data.Rd | 2 +- man/create_initial_conditions.Rd | 2 +- man/create_obs_model.Rd | 4 ++-- man/create_rt_data.Rd | 2 +- man/create_stan_args.Rd | 4 ++-- man/create_stan_data.Rd | 4 ++-- man/dist_fit.Rd | 4 ++-- man/expose_stan_fns.Rd | 2 +- man/extract_parameter.Rd | 2 +- man/extract_parameter_samples.Rd | 4 ++-- man/growth_to_R.Rd | 2 +- man/run_region.Rd | 2 +- man/sample_approx_dist.Rd | 2 +- 21 files changed, 42 insertions(+), 42 deletions(-) diff --git a/R/create.R b/R/create.R index 1aa68bff9..7c99baaca 100644 --- a/R/create.R +++ b/R/create.R @@ -145,7 +145,7 @@ create_shifted_cases <- function(reported_cases, shift, #' #' @description `r lifecycle::badge("stable")` #' Converts the `future` argument from [rt_opts()] into arguments that can be -#' passed to `{stan}`. +#' passed to stan. #' #' @param future A character string or integer. This argument indicates how to #' set future Rt values. Supported options are to project using the Rt model @@ -185,7 +185,7 @@ create_future_rt <- function(future = "latest", delay = 0) { #' #' @description `r lifecycle::badge("stable")` #' Takes the output from [rt_opts()] and converts it into a list understood by -#' `{stan}`. +#' stan. #' @param rt A list of options as generated by [rt_opts()] defining Rt #' estimation. Defaults to [rt_opts()]. Set to `NULL` to switch to using back #' calculation rather than generating infections using Rt. @@ -257,7 +257,7 @@ create_rt_data <- function(rt = rt_opts(), breakpoints = NULL, #' #' @description `r lifecycle::badge("stable")` #' Takes the output of [backcalc_opts()] and converts it into a list understood -#' by `{stan}`. +#' by stan. #' #' @param backcalc A list of options as generated by [backcalc_opts()] to #' define the back calculation. Defaults to [backcalc_opts()]. @@ -285,7 +285,7 @@ create_backcalc_data <- function(backcalc = backcalc_opts()) { #' #' @description `r lifecycle::badge("stable")` #' Takes the output of [gp_opts()] and converts it into a list understood by -#' `{stan}`. +#' stan. #' @param gp A list of options as generated by [gp_opts()] to define the #' Gaussian process. Defaults to [gp_opts()]. Set to `NULL` to disable the #' Gaussian process. @@ -357,12 +357,12 @@ create_gp_data <- function(gp = gp_opts(), data) { #' #' @description `r lifecycle::badge("stable")` #' Takes the output of [obs_opts()] and converts it into a list understood -#' by `{stan}`. +#' by stan. #' @param obs A list of options as generated by [obs_opts()] defining the #' observation model. Defaults to [obs_opts()]. #' @param dates A vector of dates used to calculate the day of the week. #' @seealso [obs_opts()] -#' @return A list of settings ready to be passed to `{stan}` defining +#' @return A list of settings ready to be passed to stan defining #' the Observation Model #' @export #' @author Sam Abbott @@ -409,8 +409,8 @@ create_obs_model <- function(obs = obs_opts(), dates) { #' #' @description`r lifecycle::badge("stable")` #' Takes the output of [stan_opts()] and converts it into a list understood by -#' `{stan}`. Internally calls the other `create_` family of functions to -#' construct a single list for input into `{stan}` with all data required +#' stan. Internally calls the other `create_` family of functions to +#' construct a single list for input into stan with all data required #' present. #' #' @param shifted_cases A `` of delay shifted cases @@ -500,7 +500,7 @@ create_stan_data <- function(reported_cases, seeding_time, #' @description `r lifecycle::badge("stable")` #' Uses the output of [create_stan_data()] to create a function which can be #' used to sample from the prior distributions (or as close as possible) for -#' parameters. Used in order to initialise each `{stan}` chain within a range of +#' parameters. Used in order to initialise each stan chain within a range of #' plausible values. #' @param data A list of data as produced by [create_stan_data()]. #' @return An initial condition generating function @@ -608,7 +608,7 @@ create_initial_conditions <- function(data) { #' to [stan_opts()]. Can be used to override `data`, `init`, and `verbose` #' settings if desired. #' -#' @param data A list of `{stan}` data as created by [create_stan_data()] +#' @param data A list of stan data as created by [create_stan_data()] #' #' @param init Initial conditions passed to `{rstan}`. Defaults to "random" but #' can also be a function (as supplied by [create_initial_conditions()]). @@ -618,7 +618,7 @@ create_initial_conditions <- function(data) { #' #' @importFrom utils modifyList #' -#' @return A list of `{stan}` arguments +#' @return A list of stan arguments #' @author Sam Abbott #' @export #' @examples diff --git a/R/dist.R b/R/dist.R index ca107cdb8..5f76cc462 100644 --- a/R/dist.R +++ b/R/dist.R @@ -177,7 +177,7 @@ dist_skel <- function(n, dist = FALSE, cum = TRUE, model, #' #' @description `r lifecycle::badge("stable")` #' Fits an integer adjusted exponential, gamma or lognormal distribution using -#' `{stan}`. +#' stan. #' @param values Numeric vector of values #' #' @param samples Numeric, number of samples to take. Must be >= 1000. @@ -196,7 +196,7 @@ dist_skel <- function(n, dist = FALSE, cum = TRUE, model, #' @param verbose Logical, defaults to FALSE. Should verbose progress messages #' be printed. #' -#' @return A `{stan}` fit of an interval censored distribution +#' @return A stan fit of an interval censored distribution #' @author Sam Abbott #' @export #' @examples @@ -614,7 +614,7 @@ estimate_delay <- function(delays, ...) { #' #' @description `r lifecycle::badge("soft-deprecated")` #' Convolves cases by a PMF function. This function will soon be removed or -#' replaced with a more robust `{stan}` implementation. +#' replaced with a more robust stan implementation. #' #' @param cases A `` of cases (in date order) with the following #' variables: `date` and `cases`. diff --git a/R/extract.R b/R/extract.R index edeb11a40..20f1a277f 100644 --- a/R/extract.R +++ b/R/extract.R @@ -1,7 +1,7 @@ #' Extract Samples for a Parameter from a Stan model #' #' @description `r lifecycle::badge("stable")` -#' Extracts a single from a list of `{stan}` output and returns it as a +#' Extracts a single from a list of stan output and returns it as a #' ``. # #' @param param Character string indicating the parameter to extract @@ -57,10 +57,10 @@ extract_static_parameter <- function(param, samples) { #' Extract Parameter Samples from a Stan Model #' #' @description `r lifecycle::badge("stable")` -#' Extracts a custom set of parameters from a `{stan}` object and adds +#' Extracts a custom set of parameters from a stan object and adds #' stratification and dates where appropriate. #' -#' @param stan_fit A fit `{stan}` model as returned by [rstan::sampling()]. +#' @param stan_fit A fit stan model as returned by [rstan::sampling()]. #' #' @param data A list of the data supplied to the [rstan::sampling()] call. #' diff --git a/R/regional_epinow.R b/R/regional_epinow.R index e85deb4ac..b58f971b7 100644 --- a/R/regional_epinow.R +++ b/R/regional_epinow.R @@ -296,7 +296,7 @@ clean_regions <- function(reported_cases, non_zero_points) { #' #' @description `r lifecycle::badge("maturing")` #' Internal function that handles calling [epinow()]. Future work will extend -#' this function to better handle `{stan}` logs and allow the user to modify +#' this function to better handle stan logs and allow the user to modify #' settings between regions. #' #' @param target_region Character string indicating the region being evaluated diff --git a/R/utilities.R b/R/utilities.R index 2b2c3cee9..9c2a590cc 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -106,7 +106,7 @@ map_prob_change <- function(var) { #' #' @description `r lifecycle::badge("questioning")` #' See [here](https://www.medrxiv.org/content/10.1101/2020.01.30.20019877v3.full.pdf) # nolint -#' for justification. Now handled internally by `{stan}` so may be removed in +#' for justification. Now handled internally by stan so may be removed in #' future updates if no user demand. #' @param r Numeric, rate of growth estimates. #' @@ -146,7 +146,7 @@ R_to_growth <- function(R, gamma_mean, gamma_sd) { #' Allocate Delays into Required Stan Format #' #' @description `r lifecycle::badge("stable")` -#' Allocate delays for `{stan}`. Used in [delay_opts()]. +#' Allocate delays for stan. Used in [delay_opts()]. #' @param delay_var List of numeric delays #' @param no_delays Numeric, number of delays #' @return A numeric array @@ -236,7 +236,7 @@ match_output_arguments <- function(input_args = NULL, #' Expose internal package stan functions in R #' #' @description `r lifecycle::badge("stable")` -#' his function exposes internal `{stan}` functions in R from a user +#' his function exposes internal stan functions in R from a user #' supplied list of target files. Allows for testing of stan functions in R and #' potentially user use in R code. #' diff --git a/man/allocate_delays.Rd b/man/allocate_delays.Rd index 65774cc88..beacd41a3 100644 --- a/man/allocate_delays.Rd +++ b/man/allocate_delays.Rd @@ -16,5 +16,5 @@ A numeric array } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Allocate delays for \code{{stan}}. Used in \code{\link[=delay_opts]{delay_opts()}}. +Allocate delays for stan. Used in \code{\link[=delay_opts]{delay_opts()}}. } diff --git a/man/create_backcalc_data.Rd b/man/create_backcalc_data.Rd index b6c78a59e..7f5af3b4c 100644 --- a/man/create_backcalc_data.Rd +++ b/man/create_backcalc_data.Rd @@ -16,7 +16,7 @@ A list of settings defining the Gaussian process \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Takes the output of \code{\link[=backcalc_opts]{backcalc_opts()}} and converts it into a list understood -by \code{{stan}}. +by stan. } \examples{ create_backcalc_data(backcalc = backcalc_opts()) diff --git a/man/create_future_rt.Rd b/man/create_future_rt.Rd index 40593c7ca..133df3d8e 100644 --- a/man/create_future_rt.Rd +++ b/man/create_future_rt.Rd @@ -23,7 +23,7 @@ A list containing a logical called fixed and an integer called from \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Converts the \code{future} argument from \code{\link[=rt_opts]{rt_opts()}} into arguments that can be -passed to \code{{stan}}. +passed to stan. } \author{ Sam Abbott diff --git a/man/create_gp_data.Rd b/man/create_gp_data.Rd index b742db1aa..9d8807576 100644 --- a/man/create_gp_data.Rd +++ b/man/create_gp_data.Rd @@ -20,7 +20,7 @@ A list of settings defining the Gaussian process \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Takes the output of \code{\link[=gp_opts]{gp_opts()}} and converts it into a list understood by -\code{{stan}}. +stan. } \examples{ # define input data required diff --git a/man/create_initial_conditions.Rd b/man/create_initial_conditions.Rd index 36395e40f..140d8cf5d 100644 --- a/man/create_initial_conditions.Rd +++ b/man/create_initial_conditions.Rd @@ -16,6 +16,6 @@ An initial condition generating function \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Uses the output of \code{\link[=create_stan_data]{create_stan_data()}} to create a function which can be used to sample from the prior distributions (or as close as possible) for -parameters. Used in order to initialise each \code{{stan}} chain within a range of +parameters. Used in order to initialise each stan chain within a range of plausible values. } diff --git a/man/create_obs_model.Rd b/man/create_obs_model.Rd index c82103a31..18190aa8a 100644 --- a/man/create_obs_model.Rd +++ b/man/create_obs_model.Rd @@ -13,13 +13,13 @@ observation model. Defaults to \code{\link[=obs_opts]{obs_opts()}}.} \item{dates}{A vector of dates used to calculate the day of the week.} } \value{ -A list of settings ready to be passed to \code{{stan}} defining +A list of settings ready to be passed to stan defining the Observation Model } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Takes the output of \code{\link[=obs_opts]{obs_opts()}} and converts it into a list understood -by \code{{stan}}. +by stan. } \examples{ dates <- seq(as.Date("2020-03-15"), by = "days", length.out = 15) diff --git a/man/create_rt_data.Rd b/man/create_rt_data.Rd index 142d16ac3..35fce8dea 100644 --- a/man/create_rt_data.Rd +++ b/man/create_rt_data.Rd @@ -24,7 +24,7 @@ A list of settings defining the time-varying reproduction number \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Takes the output from \code{\link[=rt_opts]{rt_opts()}} and converts it into a list understood by -\code{{stan}}. +stan. } \examples{ # default Rt data diff --git a/man/create_stan_args.Rd b/man/create_stan_args.Rd index 9718fe5e5..43688ee30 100644 --- a/man/create_stan_args.Rd +++ b/man/create_stan_args.Rd @@ -16,7 +16,7 @@ create_stan_args( to \code{\link[=stan_opts]{stan_opts()}}. Can be used to override \code{data}, \code{init}, and \code{verbose} settings if desired.} -\item{data}{A list of \code{{stan}} data as created by \code{\link[=create_stan_data]{create_stan_data()}}} +\item{data}{A list of stan data as created by \code{\link[=create_stan_data]{create_stan_data()}}} \item{init}{Initial conditions passed to \code{{rstan}}. Defaults to "random" but can also be a function (as supplied by \code{\link[=create_initial_conditions]{create_initial_conditions()}}).} @@ -25,7 +25,7 @@ can also be a function (as supplied by \code{\link[=create_initial_conditions]{c messages be returned.} } \value{ -A list of \code{{stan}} arguments +A list of stan arguments } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/create_stan_data.Rd b/man/create_stan_data.Rd index 58f908106..b47ca066e 100644 --- a/man/create_stan_data.Rd +++ b/man/create_stan_data.Rd @@ -46,8 +46,8 @@ A list of stan data \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Takes the output of \code{\link[=stan_opts]{stan_opts()}} and converts it into a list understood by -\code{{stan}}. Internally calls the other \code{create_} family of functions to -construct a single list for input into \code{{stan}} with all data required +stan. Internally calls the other \code{create_} family of functions to +construct a single list for input into stan with all data required present. } \author{ diff --git a/man/dist_fit.Rd b/man/dist_fit.Rd index 9cd352e98..902f3d383 100644 --- a/man/dist_fit.Rd +++ b/man/dist_fit.Rd @@ -33,12 +33,12 @@ also supported.} be printed.} } \value{ -A \code{{stan}} fit of an interval censored distribution +A stan fit of an interval censored distribution } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} Fits an integer adjusted exponential, gamma or lognormal distribution using -\code{{stan}}. +stan. } \examples{ \donttest{ diff --git a/man/expose_stan_fns.Rd b/man/expose_stan_fns.Rd index f468cc293..4609ee5c6 100644 --- a/man/expose_stan_fns.Rd +++ b/man/expose_stan_fns.Rd @@ -19,7 +19,7 @@ No return value, called for side effects } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -his function exposes internal \code{{stan}} functions in R from a user +his function exposes internal stan functions in R from a user supplied list of target files. Allows for testing of stan functions in R and potentially user use in R code. } diff --git a/man/extract_parameter.Rd b/man/extract_parameter.Rd index 989b96dd2..ddfd9ddbf 100644 --- a/man/extract_parameter.Rd +++ b/man/extract_parameter.Rd @@ -20,7 +20,7 @@ sample value. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Extracts a single from a list of \code{{stan}} output and returns it as a +Extracts a single from a list of stan output and returns it as a \verb{}. } \author{ diff --git a/man/extract_parameter_samples.Rd b/man/extract_parameter_samples.Rd index ed0d509cd..ef35695b6 100644 --- a/man/extract_parameter_samples.Rd +++ b/man/extract_parameter_samples.Rd @@ -14,7 +14,7 @@ extract_parameter_samples( ) } \arguments{ -\item{stan_fit}{A fit \code{{stan}} model as returned by \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}.} +\item{stan_fit}{A fit stan model as returned by \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}}.} \item{data}{A list of the data supplied to the \code{\link[rstan:stanmodel-method-sampling]{rstan::sampling()}} call.} @@ -35,7 +35,7 @@ parameter } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Extracts a custom set of parameters from a \code{{stan}} object and adds +Extracts a custom set of parameters from a stan object and adds stratification and dates where appropriate. } \author{ diff --git a/man/growth_to_R.Rd b/man/growth_to_R.Rd index 3ee2cf0bc..8403d965c 100644 --- a/man/growth_to_R.Rd +++ b/man/growth_to_R.Rd @@ -20,7 +20,7 @@ Numeric vector of reproduction number estimates \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#questioning}{\figure{lifecycle-questioning.svg}{options: alt='[Questioning]'}}}{\strong{[Questioning]}} See \href{https://www.medrxiv.org/content/10.1101/2020.01.30.20019877v3.full.pdf}{here} # nolint -for justification. Now handled internally by \code{{stan}} so may be removed in +for justification. Now handled internally by stan so may be removed in future updates if no user demand. } \examples{ diff --git a/man/run_region.Rd b/man/run_region.Rd index 8f8a85eb9..8b2c7b2af 100644 --- a/man/run_region.Rd +++ b/man/run_region.Rd @@ -104,7 +104,7 @@ A list of processed output as produced by \code{\link[=process_region]{process_r \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} Internal function that handles calling \code{\link[=epinow]{epinow()}}. Future work will extend -this function to better handle \code{{stan}} logs and allow the user to modify +this function to better handle stan logs and allow the user to modify settings between regions. } \seealso{ diff --git a/man/sample_approx_dist.Rd b/man/sample_approx_dist.Rd index 7d2e07b8c..817fbca38 100644 --- a/man/sample_approx_dist.Rd +++ b/man/sample_approx_dist.Rd @@ -44,7 +44,7 @@ A \verb{} of cases by date of onset \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#soft-deprecated}{\figure{lifecycle-soft-deprecated.svg}{options: alt='[Soft-deprecated]'}}}{\strong{[Soft-deprecated]}} Convolves cases by a PMF function. This function will soon be removed or -replaced with a more robust \code{{stan}} implementation. +replaced with a more robust stan implementation. } \examples{ \donttest{