dchainbinom {chainbinomial} | R Documentation |
The Chain Binomial distribution
Description
Probability mass function, expected value, and random generation, for the chain binomial distribution, with parameters s0, sar, i0, and number of generations, for the number of infected cases in a population of size s0 after a given number of generations.
Usage
dchainbinom(x, s0, sar, i0 = 1, generations = Inf)
rchainbinom(n, s0, sar, i0 = 1, generations = Inf)
echainbinom(s0, sar, i0 = 1, generations = Inf)
Arguments
x |
numeric vector of the number of infected. |
s0 |
the number of initial susceptibles. |
sar |
the secondary attack rate, or the per person risk of infection by an infected. |
i0 |
the number of primary cases. |
generations |
the number of generations. Default is Inf, which represents the entire epidemic. |
n |
number of observations. If length(n) > 1, the length is taken to be the number required. |
Value
dchainbinom
gives the probability of x infected, given s0, i0, sar and generations. echainbinom
gives the expected value.
rchainbinom
generates random data.
Examples
dchainbinom(x = 0:5, s0 = 5, sar = 0.2, i0 = 1, generations = Inf)
rchainbinom(n = 10, s0 = 5, sar = 0.2, i0 = 1, generations = Inf)
echainbinom(s0 = 5, sar = 0.2, i0 = 1, generations = Inf)