Skip to contents

Draw a seeded random sample from a model at its current parameter values. The draws come from the same Mersenne Twister stream as the upstream C# library, so a given seed reproduces the C# values bit-for-bit and matches corehydropy exactly.

Usage

model_simulate(model, n, seed = 12345L)

Arguments

model

a corehydro_model from one of the model_*() constructors.

n

number of values to draw.

seed

integer seed.

Value

A numeric vector of length n. For a bivariate model the draw is an n by 2 matrix.

Examples

peaks <- c(12500, 15300, 8900, 22100, 18700, 14200, 9800, 28500, 17400, 11600)
model_simulate(model_univariate("Normal", peaks), n = 5, seed = 12345)
#> [1] 24775.732 23295.860 13020.488  9132.623 10473.516