Sampler for the Conway-Maxwell-Poisson as described in Algorithm 2 - Benson & Friel (2021)
Usage
com_sampler(mu, nu, n = 1, ndraws = FALSE)
Arguments
- mu
Location parameter
- nu
Shape parameter
- n
Number of draws (default = 1)
- ndraws
Optional: Return the number of draws required to generate the n samples.
Value
A list or numeric if ndraws = FALSE:
- sample
Values sampled from the distribution
- drawsa
Number of draws required in the rejection sampler
- log_Bf
Log of the boundary of the rejection sampler
Examples
com_sampler(2, 0.2, n = 10, ndraws = TRUE)
#> $samples
#> [1] 2 3 0 15 4 4 5 1 15 5
#>
#> $draws
#> [1] 17
#>
#> $log_Bf
#> [1] 2.464226
#>
com_sampler(1, 2)
#> [1] 1