
Multivariate normal rectangle probability via mvtnorm
Source:R/extenders_spatial.R
morie_mvnorm_pmv.RdThin extender over mvtnorm::pmvnorm that evaluates the
multivariate normal CDF over a hyper-rectangle
\([lower, upper]\).
Arguments
- lower
Numeric vector of lower integration limits (
-Infpermitted).- upper
Numeric vector of upper integration limits (
Infpermitted).- mean
Numeric mean vector of the same length as
lower(defaults to a zero vector).- sigma
Numeric positive-(semi)definite covariance matrix.
- ...
Further arguments forwarded to
mvtnorm::pmvnorm(e.g.corr,algorithm,keepAttr).
Value
A list with $method = "mvtnorm::pmvnorm" and
$raw (a numeric scalar with the estimated probability
and Monte-Carlo error attributes attached).
Examples
# \donttest{
if (requireNamespace("mvtnorm", quietly = TRUE)) {
set.seed(1)
S <- matrix(c(1, 0.4, 0.4, 1), 2, 2)
morie_mvnorm_pmv(
lower = c(-1, -1), upper = c(1, 1),
mean = c(0, 0), sigma = S
)
}
#> $method
#> [1] "mvtnorm::pmvnorm"
#>
#> $raw
#> [1] 0.4858496
#> attr(,"error")
#> [1] 1e-15
#> attr(,"msg")
#> [1] "Normal Completion"
#>
# }