Learn R Programming

lestat (version 1.9)

mnormal: A Multivariate Normal Distribution

Description

Creates an object representing a multivariate normal distribution.

Usage

mnormal(expectation = c(0,0), P = diag(length(expectation)))

Arguments

expectation

A vector of length at least 2 specifying the expectation of the distribution. By default, the vector (0,0).

P

A matrix of size \(k\times k\), where \(k\) is the length of the expectation vector. P specifies the precision matrix, i.e., the inverse of the covariance matrix.

Value

A multivariate normal probability distribution.

Details

If \(\mu\) is the expectation vector and \(P\) is the precision matrix, then the probability density function is proportional to $$f(x)=\exp(-0.5(x-\mu)^tP(x-\mu))$$

See Also

normal

Examples

Run this code
# NOT RUN {
plot(mnormal())
plot(mnormal(c(1,2,3)))
plot(mnormal(c(1,2), matrix(c(1, 0.5, 0.5, 1), 2, 2)))
# }

Run the code above in your browser using DataLab