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

Density and random generation functions for the multivariate normal distribution.

1 2 |

`x` |
a numeric matrix of which each row represents an observation. |

`mean` |
a vector of column means. |

`cov` |
a covariance matrix. |

`log` |
logical; if |

`n` |
number of vectors to simulate. |

See Evans et al. (2000) for one of many references on the multivariate normal density.

For `rmvnorm`

, if the `mean`

argument is `NULL`

, then the scalar 0 will be used by default, unless `cov`

is not `NULL`

, in which case `mean = rep(0, nrow(cov))`

will be used. If the `cov`

argument is `NULL`

, then `diag(length(mean))`

will be used by default. Thus `rmvnorm(n)`

is equivalent to `rnorm(n)`

.

For `dmvnorm`

, a vector of densities. For `rmvnorm`

, a vector with `n`

rows and `length(mean)`

columns representing a sample from the multivariate normal distribution with the specified parameters.

Daniel Dvorkin

Evans, M., Hastings, N., and Peacock, B. (2000) *Statistical Distributions, third edition*, John Wiley & Sons.

`mvgamma`

, `mvweisd`

for related distributions; `Normal`

in package `stats`

; `dmvnorm`

and `rmvnorm`

in package `mixtools`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
set.seed(123)
m = c(-3, 0, 3)
v = cov(matrix(rnorm(90), ncol=3))
x = rmvnorm(5, m, v)
print(x)
# [,1] [,2] [,3]
# [1,] -2.0498637 0.3599609 3.218045
# [2,] -3.7479240 1.2302183 2.290916
# [3,] -0.9852752 1.1433559 2.790147
# [4,] -3.9353966 -0.5451158 3.223321
# [5,] -3.2864769 -0.1672326 2.201353
dmvnorm(x, m, v)
# 0.048079901 0.025591976 0.002587824 0.041810685 0.054688032
``` |

lcmix documentation built on May 21, 2017, 4:05 a.m.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

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.