Skip to contents

Simulate from the copula's own seeded Mersenne Twister stream, mapped through the attached marginals to the data scale when both margin_x and margin_y were supplied; on the unit square otherwise. A given seed reproduces the same draws bit-for-bit in R, Python, and the upstream C# library.

Usage

copula_random(cop, n, seed = NULL)

Arguments

cop

a corehydro_copula.

n

number of draws.

seed

integer seed for reproducible draws; NULL (the default) seeds from the clock.

Value

an n x 2 numeric matrix.

Examples

cop <- copula("Clayton", theta = 2,
              margin_x = distribution("Normal", c(0, 1)),
              margin_y = distribution("Normal", c(0, 1)))
copula_random(cop, 5, seed = 12345)
#>            [,1]       [,2]
#> [1,] -2.0287713 -1.9702747
#> [2,]  0.5478119 -0.1658230
#> [3,]  1.5574503  1.3289577
#> [4,] -0.1575245 -0.3397421
#> [5,] -0.5158970  1.2308813