| mvn | R Documentation |
This function constructs an object representing a normal distribution.
If the length of the mean vector mu is 1, it creates a univariate
normal distribution. Otherwise, it creates a multivariate normal distribution.
mvn(mu, sigma = diag(length(mu)))
mu |
A numeric vector specifying the means of the distribution.
If |
sigma |
A numeric matrix specifying the variance-covariance matrix of the
distribution. It must be a square matrix with the same number of
rows and columns as the length of |
If mu has length 1, it returns a normal object. If mu has length
> 1, it returns an mvn object. Both types of objects contain mu
and sigma as their properties.
# Bivariate normal with identity covariance
X <- mvn(mu = c(0, 0))
mean(X)
vcov(X)
# 1D case returns a normal object
is_normal(mvn(mu = 1, sigma = matrix(4)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.