rmvnorm: Generate data from the multivariate Normal distribution

Description Usage Arguments Value Author(s) See Also Examples

View source: R/rmvnorm.R

Description

Random generation function from the multivariate Normal distribution with mean equal to mean and covariance matrix sigma.

Usage

1
2
3
 
    rmvnorm( n = 10, mean = rep( 0, length = ncol( sigma ) ), 
             sigma = diag( length( mean ) ) ) 

Arguments

n

Number of observations.

mean

Mean vector, default is rep( 0, length = ncol( sigma ) ).

sigma

positive definite covariance matrix, default is diag( length( mean ) ) .

Value

A numeric matrix with rows equal to n and columns equal to length( mean ).

Author(s)

Reza Mohammadi a.mohammadi@uva.nl

See Also

bdgraph.sim, rwish, rgwish

Examples

1
2
3
4
5
6
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 )

Example output



BDgraph documentation built on May 3, 2021, 9:08 a.m.