Sample from a Skellam distribution given predictions and variance
Source:R/sample_methods.R
sample_skellam.RdGenerates samples from a Skellam distribution (difference of two Poissons)
with the given predictions as means and the estimated variance.
This is the sampling counterpart to fit_skellam().
The Skellam distribution is parameterized by λ₁ and λ₂ where:
Mean = λ₁ - λ₂ = pred
Variance = λ₁ + λ₂ = uncertainty_params
The individual parameters are recovered as:
λ₁ = (pred + variance) / 2
λ₂ = (variance - pred) / 2
See also
Other sample_distribution:
sample_normal()
Examples
pred <- c(3.2, -1.5, 0.8)
variance <- 10
samples <- sample_skellam(pred, uncertainty_params = variance)
samples
#> [1] 1 -6 4