simulate_combined_observations: Simulate a series of observations from a course of...

View source: R/simulate.R

simulate_combined_observationsR Documentation

Simulate a series of observations from a course of infections, combining some partially-delayed and some fully-delayed observations.

Description

The infections that are observed as partially-delayed observations cannot be observed a second time as fully-delayed observations, meaning that they do not show up a second time in the "fully-delayed" column of the result. However, a partially-delayed observation can only be "registered" (included in the "partially-delayed" column) if it is has been virtually observed as a fully-delayed observation first.

Usage

simulate_combined_observations(
  infections,
  delay_until_partial,
  delay_until_final_report,
  prob_partial_observation,
  noise = list(type = "noiseless")
)

Arguments

infections

Positive integer vector. Course of infections through time.

delay_until_partial

Single delay or list of delays. Each delay can be one of:

  • a list representing a distribution object

  • a discretized delay distribution vector

  • a discretized delay distribution matrix

  • a dataframe containing empirical delay data

delay_until_final_report

Single delay or list of delays. Each delay can be one of:

  • a list representing a distribution object

  • a discretized delay distribution vector

  • a discretized delay distribution matrix

  • a dataframe containing empirical delay data

prob_partial_observation

Numeric value between 0 and 1. Probability of an infection to be observed as a partially-delayed observation, instead of as a fully-delayed observation.

noise

List specifying the type of noise and its parameters, if applicable.

Value

A dataframe containing two columns: a column "partially_delayed" containing partially-delayed observations and a column "fully_delayed" containing fully-delayed observations.

Examples

## Basic use of simulate_combined_observations
# Simulating combined observations, assuming two gamma delays between infection
# and symptom onset, and symptom onset and case report respectively. It is assumed
# that 20% of the cases are observed as partially-delayed observations.

Re_evolution <- c(rep(2.3, 100))
incidence <- simulate_infections(Re_evolution)

shape_incubation = 3.2
scale_incubation = 1.3
delay_incubation <- list(name="gamma", shape = shape_incubation, scale = scale_incubation)

shape_onset_to_report = 2.7
scale_onset_to_report = 1.6
delay_onset_to_report <- list(name="gamma",
                              shape = shape_onset_to_report,
                              scale = scale_onset_to_report)
simulated_combined_observations_1 <- simulate_combined_observations(
  incidence,
  delay_until_partial = delay_incubation,
  delay_until_final_report = delay_onset_to_report,
  prob_partial_observation = 0.2
)

## Advanced use of simulate_combined_observations
# Adding gaussian noise to the combined observations simulated above.
simulated_combined_observations_2 <- simulate_combined_observations(
  incidence,
  delay_until_partial = delay_incubation,
  delay_until_final_report = delay_onset_to_report,
  prob_partial_observation = 0.2,
  noise = list(type = 'gaussian', sd = 0.8)
)


covid-19-Re/estimateR documentation built on Sept. 14, 2024, 5:49 a.m.