Description Usage Arguments Details Value Warning Author(s) See Also Examples

Density for the multivariate Normal distribution

1 2 3 | ```
dmultinorm(vec.x, vec.mean = c(0, 0),
mat.cov = c(1, 1, 0),
log = FALSE)
``` |

`vec.x` |
For the |

`vec.mean` |
The vector of means. |

`mat.cov` |
The vector of variances and covariances, arranged in that order. See below for further details. |

`log` |
Logical. If |

This implementation of the multivariate (say
*R*–dimensional) Normal density
handles the variances and covariances, instead of
correlation parameters.

For more than one observation, arrange all entries in matrices accordingly.

For each observation, `mat.cov`

is a vector of
length *R * (R + 1) / 2*,
where the first *R* entries are the variances
*σ^2[i]*, *i = 1, …, R*, and
then the covariances arranged as per rows, that is,
*cov[ij]* *i = 1, …, R,
j = i + 1, …, R*.

By default, it returns the density of two independent standard Normal distributions.

The density of the multivariate Normal distribution.

For observations whose covariance matrix is not positive definite,
`NaN`

will be returned.

Victor Miranda

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ```
###
### Two - dimensional Normal density.
###
set.seed(180228)
nn <- 25
mean1 <- 1; mean2 <- 1.5; mean3 = 2
var1 <- exp(1.5); var2 <- exp(-1.5); var3 <- exp(1); cov12 = 0.75
dmvndata <- rbinorm(nn, mean1 = 1, mean2 = 1.5, var1 = var1, var2 = var2,
cov12 = cov12)
## Using dbinorm() from VGAM.
d2norm.data <- dbinorm(x1 = dmvndata[, 1], x2 = dmvndata[, 2],
mean1 = mean1, mean2 = mean2, var1 = var1, var2 = var2,
cov12 = cov12)
## Using dmultinorm().
d2norm.data2 <- dmultinorm(vec.x = dmvndata, vec.mean = c(mean1, mean2),
mat.cov = c(var1, var2, cov12))
summary(d2norm.data)
summary(d2norm.data2)
##
## 3--dimensional Normal.
##
dmvndata <- cbind(dmvndata, rnorm(nn, mean3, sqrt(var3)))
d2norm.data3 <- dmultinorm(dmvndata, vec.mean = c(mean1, mean2, mean3),
mat.cov = c(var1, var2, var3, cov12, 0, 0))
hist(d2norm.data3)
summary(d2norm.data3)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.