Skip to contents

Generates samples from a normal distribution with the given predictions as means and the estimated variance, rounded to integers for use with count data. This is the sampling counterpart to fit_normal().

Usage

sample_normal(pred, uncertainty_params)

Arguments

pred

Vector of predictions (means).

uncertainty_params

Vector of variance parameters. If length 1, the same variance is used for all predictions.

Value

Integer vector of samples of the same length as pred.

See also

Other sample_distribution: sample_skellam()

Examples

pred <- c(3.2, 4.6, 5.1)
variance <- 2.5
samples <- sample_normal(pred, uncertainty_params = variance)
samples
#> [1] 1 5 1