Learn R Programming

mvdalab (version 1.7)

mvrnorm.svd: Simulate from a Multivariate Normal, Poisson, Exponential, or Skewed Distribution

Description

Produces one or more samples from the specified multivariate distribution.

Usage

mvrnorm.svd(n = 1, mu = NULL, Sigma = NULL, tol = 1e-06, empirical = FALSE, 
            Dist = "normal", skew = 5, skew.mean = 0, skew.sd = 1, 
            poisson.mean = 5)

Arguments

n

the number of samples required.

mu

a vector giving the means of the variables.

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.

Dist

desired distribution.

skew

amount of skew for skewed distributions.

skew.mean

mean for skewed distribution.

skew.sd

standard deviation for skewed distribution.

poisson.mean

mean for poisson distribution.

Author

Nelson Lee Afanador (nelson.afanador@mvdalab.com)

Details

"mvrnorm.svd" The matrix decomposition is done via svd

Examples

Run this code
Sigma <- matrix(c(1, .5, .5, .5, 1, .5, .5, .5, 1), 3, 3)
Means <- rep(0, 3)

Sim.dat.norm <- mvrnorm.svd(n = 1000, Means, Sigma, Dist = "normal")
plot(as.data.frame(Sim.dat.norm))

Sim.dat.pois <- mvrnorm.svd(n = 1000, Means, Sigma, Dist = "poisson")
plot(as.data.frame(Sim.dat.pois))

Sim.dat.exp <- mvrnorm.svd(n = 1000, Means, Sigma, Dist = "exp")
plot(as.data.frame(Sim.dat.exp))

Sim.dat.skew <- mvrnorm.svd(n = 1000, Means, Sigma, Dist = "skewnorm")
plot(as.data.frame(Sim.dat.skew))

Run the code above in your browser using DataLab