Learn R Programming

RCTRecruit (version 0.2.0)

GetWeekPredCI: Calculate median recruitment with 95% CI for the next 104 weeks (two years)

Description

Calculate median recruitment with 95% CI for the next 104 weeks (two years)

Usage

GetWeekPredCI(
  nSim = 10000L,
  fillGaps = FALSE,
  cauchyWt = FALSE,
  efficiencyFactor = 1
)

Value

An object of RCTPredCI class with 5 elements.

  1. predCI: An 104x3 matrix with the 2.5%, 50% and 97.5% weekly percentiles

  2. pargs:
    An environment which contains objects and functions used to construct
    the plot with base::plot(). For internal use only.

  3. call.: The call (deparsed) that created the object

  4. cargs: A list with the arguments of the call that created the object
    including the default arguments

Arguments

nSim

Number of simulations to run (default = 1e4L). Accepted values are in the
range of 1 to 10,000.

fillGaps

Whether to fill recruitment gaps in the data (default = FALSE).
Recruitment gaps are defined as any full week (Monday through Sunday) with
no dates recorded in the loaded data. If at least one date is present within
a given week, that week will not be considered a gap in recruitment.

cauchyWt

Whether to use Cauchy weights for sampling. If FALSE (default),
binomial weights are used.

efficiencyFactor

An efficiency coefficient to apply to the recruitment rate (default = 1).
If the efficiency of the recruitment process is expected to match
the provided data, this value should be set to 1. If the recruitment
process is expected to be slower, this value should less than 1. Finally,
if the recruitment process is expected to proceed faster, this value should be
greater than 1. Accepted values range from 0.1 to 2:

  • 0.1: Indicates that the recruitment rate is expected to be 10% of the original rate.

  • 2.0: Indicates that the recruitment rate is expected to be double the original rate.

See Also

Other Links: GetDistance(), LoadData(), RCTRecruit-package, Time2Nsubjects(), gripsYR1, gripsYR2, gripsYR2Weekly, plot.RCTPredCI()

Examples

Run this code
LoadData(gripsYR1, ScreenDt, Enrolled)
(res <- GetWeekPredCI(fillGaps = TRUE, efficiencyFactor = 1.5))
scenarios <- list(
  sc1 = GetWeekPredCI(),
  sc2 = GetWeekPredCI(cauchyWt = TRUE),
  sc3 = GetWeekPredCI(fillGaps = TRUE),
  sc4 = GetWeekPredCI(fillGaps = TRUE, efficiencyFactor = 1.2)
)
maxY <- sapply(scenarios, \(x) x$pargs$maxY) |> max()
defaultGraphicParams <- par(no.readonly = TRUE)
graphics::par(mfrow = c(2, 2), cex.main = 1)
for (x in scenarios) plot(x, yMax = maxY, main = x$call.)
do.call(par, defaultGraphicParams)

Run the code above in your browser using DataLab