R/dist_multivariate_normal.R
dist_multivariate_normal.Rd
dist_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,] -3.60009185 0.5562756
#> [2,] -0.05923307 1.2763818
#> [3,] 1.98769657 1.9861989
#> [4,] 1.51301349 2.3132829
#> [5,] 2.41166586 4.7343095
#> [6,] 2.05624208 2.2215200
#> [7,] 0.86251835 2.3519657
#> [8,] 1.68848502 1.3478514
#> [9,] 2.41133076 1.3724569
#> [10,] -1.03574719 2.4842942
#>
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