plus-.dist_spec: Creates a delay distribution as the sum of two other delay...

+.dist_specR Documentation

Creates a delay distribution as the sum of two other delay distributions

Description

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.

Usage

## S3 method for class 'dist_spec'
e1 + e2

Arguments

e1

The first delay distribution (from a call to dist_spec()) to combine.

e2

The second delay distribution (from a call to dist_spec()) to combine.

Value

A delay distribution representing the sum of the two delays (with class dist_spec())

Author(s)

Sebastian Funk

Examples

# A fixed lognormal distribution with mean 5 and sd 1.
lognormal <- dist_spec(
  mean = 1.6, sd = 1, max = 20, distribution = "lognormal"
)
lognormal + lognormal

# An uncertain gamma distribution with mean 3 and sd 2
gamma <- dist_spec(
  mean = 3, sd = 2, mean_sd = 0.5, sd_sd = 0.5, max = 20,
  distribution = "gamma"
)
lognormal + gamma

# Using tolerance parameter
EpiNow2:::dist_spec_plus(lognormal, lognormal, tolerance = 0.5)

EpiNow2 documentation built on Sept. 26, 2023, 5:11 p.m.