Skip to contents

Thin extender over copula::rCopula that generates \(n\) draws on \([0, 1]^d\) from a specified copula.

Usage

morie_copula_sample(n, copula, ...)

Arguments

n

Integer; the number of multivariate observations to draw.

copula

A copula object specifying the dependence structure (e.g. copula::normalCopula(), copula::claytonCopula()).

...

Further arguments forwarded to copula::rCopula.

Value

A list with $method = "copula::rCopula" and $raw (a numeric matrix of dimension \(n \times d\) with values in \([0, 1]\)).

Examples

# \donttest{
  if (requireNamespace("copula", quietly = TRUE)) {
    set.seed(1)
    morie_copula_sample(100, copula::claytonCopula(2, dim = 3))
  }
#> $method
#> [1] "copula::rCopula"
#> 
#> $raw
#>              [,1]       [,2]       [,3]
#>   [1,] 0.56940087 0.77481802 0.57049253
#>   [2,] 0.50595791 0.49630249 0.42757640
#>   [3,] 0.26938377 0.17956613 0.24889353
#>   [4,] 0.25268625 0.68710265 0.07053888
#>   [5,] 0.13092847 0.24009178 0.12681963
#>   [6,] 0.69494772 0.24661940 0.36367072
#>   [7,] 0.84042389 0.25046329 0.43853582
#>   [8,] 0.14050248 0.10573903 0.06371790
#>   [9,] 0.60995677 0.88127891 0.40971219
#>  [10,] 0.26308098 0.53624707 0.62008925
#>  [11,] 0.24585987 0.89902001 0.84905925
#>  [12,] 0.80090232 0.95317900 0.75771247
#>  [13,] 0.85509793 0.70543692 0.88924180
#>  [14,] 0.76063429 0.78089628 0.98026053
#>  [15,] 0.80542973 0.44936438 0.84087571
#>  [16,] 0.10034110 0.04041909 0.07742643
#>  [17,] 0.82068347 0.81952953 0.78319965
#>  [18,] 0.99771964 0.66241518 0.98681604
#>  [19,] 0.70747950 0.73878715 0.97643006
#>  [20,] 0.32097935 0.24671653 0.16156136
#>  [21,] 0.84603444 0.97674159 0.33584219
#>  [22,] 0.28421195 0.40316316 0.26533329
#>  [23,] 0.25840611 0.20137052 0.16228878
#>  [24,] 0.15037943 0.16331983 0.25802695
#>  [25,] 0.59786594 0.85028756 0.95013533
#>  [26,] 0.68794421 0.72097195 0.74841574
#>  [27,] 0.37330089 0.71412829 0.58301351
#>  [28,] 0.62498133 0.53060266 0.40889615
#>  [29,] 0.73734357 0.31829766 0.40013196
#>  [30,] 0.09683294 0.13897466 0.24640474
#>  [31,] 0.84891746 0.87905593 0.80014707
#>  [32,] 0.17132212 0.07745254 0.08697934
#>  [33,] 0.72152604 0.43226673 0.66214319
#>  [34,] 0.23457921 0.42581781 0.41894551
#>  [35,] 0.96372993 0.98534317 0.85095800
#>  [36,] 0.10058110 0.08913215 0.10466955
#>  [37,] 0.76090271 0.59494200 0.67821906
#>  [38,] 0.49390391 0.72655102 0.74125178
#>  [39,] 0.70405784 0.97718236 0.52284889
#>  [40,] 0.14627105 0.16689364 0.15467820
#>  [41,] 0.79863376 0.69035902 0.47651234
#>  [42,] 0.80654866 0.78392163 0.77249138
#>  [43,] 0.89903025 0.64710362 0.95737181
#>  [44,] 0.28024405 0.18958227 0.15895122
#>  [45,] 0.03375745 0.04786716 0.02869992
#>  [46,] 0.69682957 0.46875960 0.35421171
#>  [47,] 0.46032316 0.60585992 0.73757878
#>  [48,] 0.24981738 0.37981339 0.15427023
#>  [49,] 0.75449566 0.39301614 0.58869858
#>  [50,] 0.78001066 0.89258068 0.95217735
#>  [51,] 0.69863662 0.76904982 0.84946383
#>  [52,] 0.36580935 0.19485134 0.49946934
#>  [53,] 0.82594774 0.78376414 0.83759741
#>  [54,] 0.02930594 0.03906271 0.04889145
#>  [55,] 0.19795605 0.36745618 0.36046145
#>  [56,] 0.25393165 0.29173565 0.25868075
#>  [57,] 0.56575139 0.67839831 0.52888277
#>  [58,] 0.43298200 0.23521428 0.42275548
#>  [59,] 0.20797640 0.11978524 0.13620588
#>  [60,] 0.58125261 0.47819662 0.93365089
#>  [61,] 0.97104079 0.73839554 0.83647797
#>  [62,] 0.37862185 0.80571982 0.38926029
#>  [63,] 0.06647707 0.06530402 0.05188554
#>  [64,] 0.14818969 0.30086325 0.30631596
#>  [65,] 0.75843201 0.90587308 0.78877321
#>  [66,] 0.79326412 0.84989078 0.74879546
#>  [67,] 0.49972673 0.28608926 0.28657351
#>  [68,] 0.21170077 0.10632678 0.20613186
#>  [69,] 0.29375724 0.64767872 0.57324752
#>  [70,] 0.92262679 0.64216125 0.54810538
#>  [71,] 0.04012910 0.06137374 0.02505490
#>  [72,] 0.76163426 0.76291462 0.31363647
#>  [73,] 0.26915932 0.58952846 0.28127447
#>  [74,] 0.59320172 0.62321801 0.50118750
#>  [75,] 0.66550957 0.61558330 0.57262659
#>  [76,] 0.84485417 0.84873139 0.38355159
#>  [77,] 0.96140216 0.89551873 0.75314664
#>  [78,] 0.83409489 0.93692241 0.74674220
#>  [79,] 0.86008778 0.76671074 0.70136198
#>  [80,] 0.66996857 0.49293889 0.33410976
#>  [81,] 0.63073430 0.55679150 0.36491539
#>  [82,] 0.73903491 0.44477589 0.62392511
#>  [83,] 0.37283213 0.74231938 0.73290486
#>  [84,] 0.27498275 0.34352209 0.29191666
#>  [85,] 0.57629979 0.71648579 0.20874333
#>  [86,] 0.38992230 0.38297407 0.35567761
#>  [87,] 0.19453931 0.21490615 0.10806851
#>  [88,] 0.64331179 0.90658052 0.66601872
#>  [89,] 0.75291077 0.98460822 0.68995942
#>  [90,] 0.55836346 0.77056178 0.60704161
#>  [91,] 0.33743979 0.59211325 0.33164084
#>  [92,] 0.37093642 0.56881759 0.42669313
#>  [93,] 0.32597863 0.14977340 0.85954191
#>  [94,] 0.18663164 0.24372669 0.06516409
#>  [95,] 0.92957989 0.74661565 0.83695482
#>  [96,] 0.67631306 0.51583529 0.57651906
#>  [97,] 0.55643812 0.37150507 0.36397254
#>  [98,] 0.41363234 0.71715459 0.28201146
#>  [99,] 0.89550828 0.65234484 0.47041588
#> [100,] 0.64530830 0.77092889 0.91113671
#> 
# }