sample_Rt_single_piece: Sample a single Rt value corresponding to a single piecewise-...

View source: R/sampling.R

sample_Rt_single_pieceR Documentation

Sample a single Rt value corresponding to a single piecewise- constant element of an Rt vector

Description

Sample a single Rt value corresponding to a single piecewise- constant element of an Rt vector

Usage

sample_Rt_single_piece(
  Rt_piece_index,
  cases_history_df,
  Rt_prior_parameters,
  serial_parameters,
  kappa = NULL,
  serial_max = 40,
  ndraws = 1,
  maximise = FALSE,
  is_negative_binomial = FALSE,
  nresamples = 100
)

Arguments

Rt_piece_index

the index of the Rt piece being sampled

cases_history_df

a tibble with three columns: time_onset, cases_true and Rt_index

Rt_prior_parameters

a list with elements 'shape' and 'rate' describing the gamma prior for Rt

serial_parameters

named list of 'mean' and 'sd' of gamma distribution characterising the serial interval distribution

kappa

overdispersion parameter

serial_max

maximum point at which to truncate sum in renewal process

ndraws

number of draws of Rt

maximise

rather than sample a case count give the case count with the maximum probability (by default is FALSE)

is_negative_binomial

if negative-binomial renewal model specified (defaults to FALSE)

nresamples

number of importance resamples of Rt to perform if assuming a negative binomial model

Value

a draw (or draws) for Rt


ben18785/incidenceinflation documentation built on Feb. 8, 2024, 2:36 a.m.