gendat_mvn: Generate Multivariate Normal Data.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/gendat.R

Description

Generates multivariate normal data from a p \times p variance-covariance matrix and p dimensional mean vector.

Usage

1
gendat_mvn(n, Sigma, mu = NULL, ...)

Arguments

n

Sample size.

Sigma

p \times p variance-covariance matrix.

mu

p dimensional mean vector. Defaults to zeros if unspecified.

...

Arguments that can be passed to mvrnorm.

Details

Data is generated from a multivariate normal distrubution given by \mathcal{N} \sim ≤ft( \mathbf{μ_{p \times 1}}, \mathbf{Σ_{p \times p}} \right) where \mathcal{N} has the density function \frac{ \exp ≤ft[ - \frac{1}{2} ≤ft( \mathbf{X} - \boldsymbol{μ} \right)^{T} \right] \boldsymbol{Σ}^{-1} ≤ft( \mathbf{X} - \boldsymbol{μ} \right) } { √{ ≤ft( 2 π \right)^{k} | \boldsymbol{Σ} | } } .

Value

Returns an n \times p multivariate normal data matrix generated using the variance-covariance matrix and the mean vector provided.

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other data generating functions: gendat_linreg_X(), gendat_linreg_y(), gendat_linreg(), gendat_mvn_a(), gendat_mvn_fe(), gendat_vm(), gendat()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Sigma <- matrix(
  data = c(
    225, 112.50, 56.25,
    112.5, 225, 112.5,
    56.25, 112.50, 225
  ),
  ncol = 3
)
mu <- c(100, 100, 100)
data <- gendat_mvn(
  n = 100,
  Sigma = Sigma,
  mu = mu
)

jeksterslabds/jeksterslabRds documentation built on July 16, 2020, 3:41 p.m.