% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rmnorm.R
\name{rmnorm}
\alias{rmnorm}
\title{Generate random numbers from the multivariate normal distribution}
\usage{
rmnorm(n = 1, mean = rep(0, d), varcov)
}
\arguments{
\item{n}{the number of random vectors to be generated.}

\item{mean}{a vector with means of length d.}

\item{varcov}{a variance-covariance matrix with dimentions d * d.}
}
\value{
For n > 1 rmnorm returns a matrix of n rows of random vectors, while for n = 1 rmnorm returns a named random vector.
}
\description{
rmnorm generate random numbers from a multivariate normal distribution.
}
\details{
rmnorm Generate random numbers from the multivariate normal distribution
}
\examples{
\dontrun{
#Variance-covariance matrix
varcov <- matrix(c(2.047737e-03, 3.540039e-05, 0.0075178920, 3.540039e-05,
6.122832e-07, 0.0001299661, 7.517892e-03, 1.299661e-04, 0.0276005740), ncol = 3)
#Set names
nam <- c("a", "b", "c")
dimnames(varcov) <- list(nam, nam)
#Check positive definiteness (all positive eigenvalues = positive definite)
eigen(varcov) $values
#Mean
mean <- c(1, 0.3, 0.5)
#Generate n = 1 random vector
rmnorm(n = 1, mean = mean, varcov = varcov)
#Generate n = 10 random vectors
rmnorm(n = 10, mean = mean, varcov = varcov)
#Generate n = 1 random vectors when varcov is non-positive definite
#Non-positive definite varcov matrix
varcov2 <- matrix(c(2.04e-03, 3.54e-05, 7.52e-03, 3.54e-05, 6.15e-07,
  1.30e-04, 7.52e-03, 1.30e-04, 2.76e-02), ncol = 3)
  dimnames(varcov2) <- dimnames(varcov)
eigen(varcov2)
#Random vector
rmnorm(n = 1, mean = mean, varcov = varcov2)
}
}
\seealso{
Other Distributions: 
\code{\link{cutter}()},
\code{\link{dSnbinom}()},
\code{\link{dbeta_new}()},
\code{\link{dcutter}()},
\code{\link{dggamma}()},
\code{\link{logLik.cutter}()},
\code{\link{plot.cutter}()},
\code{\link{print.cutter}()},
\code{\link{r2norm}()},
\code{\link{rcutter}()},
\code{\link{rnbinom_new}()}
}
\author{
Based on lmf package
}
\concept{Distributions}
