smvrnorm: Simulate from a Multivariate Normal Distribution
Description
smvrnorm() simulates data from a multivariate normal distribution.
Usage
smvrnorm(
n = 1,
mu,
sigma,
tol = 1e-06,
empirical = FALSE,
eispack = FALSE,
seed
)
Value
The function returns simulated data from a multivariate normal distribution.
Arguments
n
the number of observations to simulate
mu
a vector of means
sigma
a positive-definite symmetric matrix specifying the covariance matrix of the variables.
tol
tolerance (relative to largest variance) for numerical lack of positive-definiteness in sigma.
empirical
logical. If true, mu and sigma specify the empirical not population mean and covariance matrix.
eispack
logical. values other than FALSE result in an error
seed
set an optional seed
Details
This is a simple port and rename of mvrnorm() from the MASS package. I elect
to plagiarize/port it because the MASS package conflicts with a lot of things in my workflow,
especially select(). This is useful for "informal Bayes" approaches to generating quantities
of interest from a regression model.
References
B. D. Ripley (1987) Stochastic Simulation. Wiley. Page 98.