si {WhiteLabRt}R Documentation

Calculate a Serial Interval Distribution

Description

This function computes the probability distribution function (PDF) of the serial interval using a gamma distribution with specified shape and rate parameters. The serial interval is defined as the time between successive cases in a chain of transmission. This implementation generates a discrete PDF at the daily level.

Usage

si(ndays, shape, rate, leading0 = TRUE)

Arguments

ndays

Integer, the number of days over which to calculate the serial interval distribution.

shape

Numeric, the shape parameter of the gamma distribution.

rate

Numeric, the rate parameter of the gamma distribution.

leading0

Logical, should a leading 0 be added to indicate t0?

Details

The function uses the pgamma function to calculate cumulative probabilities for each day up to ndays and then differences these to get daily probabilities. The resulting probabilities are normalized to sum to 1, ensuring that they represent a valid probability distribution.

Value

Numeric vector representing the serial interval probabilities for each of the first ndays days. The probabilities are normalized so that their sum is 1.

Examples

si(ndays = 14, shape = 4.29, rate = 1.18)

[Package WhiteLabRt version 1.0.1 Index]