# Univariate numeric samples
dist <- dist_sample(x = list(rnorm(100), rnorm(100, 10)))
dist
#> <distribution[2]>
#> [1] sample[100] sample[100]
mean(dist)
#> [1] -0.07202645 10.08024671
variance(dist)
#> [1] 0.6775247 0.9756715
skewness(dist)
#> [1] 0.008113983 0.135510505
generate(dist, 10)
#> [[1]]
#> [1] 0.5620251 0.1910260 0.8322193 0.2683600 -0.5882615 0.3672309
#> [7] 1.6165187 -0.2254519 -0.4955087 -1.4673770
#>
#> [[2]]
#> [1] 9.439392 9.607291 7.437476 11.082792 8.754518 11.040919 11.040919
#> [8] 13.077088 8.754518 12.098537
#>
density(dist, 1)
#> [1] 0.2165326 0.0000000
# Multivariate numeric samples
dist <- dist_sample(x = list(cbind(rnorm(100), rnorm(100, 10))))
dimnames(dist) <- c("x", "y")
dist
#> <distribution[1]>
#> [1] sample[100]
mean(dist)
#> x y
#> [1,] 0.03330121 9.97632
variance(dist)
#> x y
#> [1,] 1.2002489 0.1438919
#> [2,] 0.1438919 0.8788955
generate(dist, 10)
#> [[1]]
#> x y
#> [1,] -0.54043706 10.799526
#> [2,] 0.22070920 10.616250
#> [3,] 1.26495507 9.640448
#> [4,] 0.06372166 9.809402
#> [5,] 0.73367431 11.244005
#> [6,] 1.02096351 10.353401
#> [7,] -0.13567761 10.794906
#> [8,] 2.90270571 8.694576
#> [9,] 0.34454991 11.290768
#> [10,] 0.07640337 10.523857
#>
quantile(dist, 0.4) # Returns the marginal quantiles
#> x y
#> [1,] -0.1249546 9.719756
cdf(dist, matrix(c(0.3,9), nrow = 1))
#> [1] 0.39