R/dist_multivariate_normal.R
dist_multivariate_normal.Rddist_multivariate_normal(mu = 0, sigma = diag(1))mvtnorm::dmvnorm, mvtnorm::qmvnorm
dist <- dist_multivariate_normal(mu = list(c(1,2)), sigma = list(matrix(c(4,2,2,3), ncol=2)))
dimnames(dist) <- c("x", "y")
dist
#> <distribution[1]>
#> [1] MVN[2]
mean(dist)
#> x y
#> [1,] 1 2
variance(dist)
#> x y
#> [1,] 4 3
support(dist)
#> <support_region[1]>
#> [1] R^2
generate(dist, 10)
#> [[1]]
#> x y
#> [1,] 2.41166586 4.7343095
#> [2,] 2.05624208 2.2215200
#> [3,] 0.86251835 2.3519657
#> [4,] 1.68848502 1.3478514
#> [5,] 2.41133076 1.3724569
#> [6,] -1.03574719 2.4842942
#> [7,] 0.04990478 1.3453962
#> [8,] 0.97289793 3.7787571
#> [9,] 0.78530930 3.6150883
#> [10,] 0.59753978 -0.1314307
#>
density(dist, cbind(2, 1))
#> [1] 0.02829422
density(dist, cbind(2, 1), log = TRUE)
#> [1] -3.565098
cdf(dist, 4)
#> [1] 0.8412602
quantile(dist, 0.7)
#> x y
#> [1,] 2.048801 2.908288
quantile(dist, 0.7, type = "marginal")
#> x y
#> [1,] 2.048801 2.908288