File: rmvnorm.Rd

package info (click to toggle)
r-cran-bdgraph 2.72%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,324 kB
  • sloc: cpp: 8,044; ansic: 157; makefile: 5
file content (36 lines) | stat: -rwxr-xr-x 1,068 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
\name{rmvnorm}
\alias{rmvnorm}

\title{ Generate data from the multivariate Normal distribution }

\description{
    Random generation function from the multivariate Normal distribution with mean equal to \eqn{mean} and covariance matrix \eqn{sigma}.
}

\usage{ 
    rmvnorm( n = 10, mean = rep( 0, length = ncol( sigma ) ), 
             sigma = diag( length( mean ) ) ) 
}

\arguments{
    \item{n}{ Number of observations. }
    \item{mean}{ Mean vector, default is \eqn{rep( 0, length = ncol( sigma ) )}. }
    \item{sigma}{ positive definite covariance matrix, default is \eqn{ diag( length( mean ) ) }. }
}

\value{ A numeric matrix with rows equal to \eqn{n} and columns equal to \eqn{length( mean )}. }

\author{ Reza Mohammadi \email{a.mohammadi@uva.nl} }

\seealso{\code{\link{bdgraph.sim}}, \code{\link{rwish}}, \code{\link{rgwish}} }

\examples{
mean  <- c( 5, 20 )       
sigma <- matrix( c( 4, 2,
                    2, 5 ), 2, 2 )  # covariance matrix

sample <- rmvnorm( n = 500, mean = mean, sigma = sigma )
plot( sample )
}

\keyword{ distribution }