Learn R Programming

hyperSpec (version 0.98-20140523)

rmmvnorm: Multivariate normal random numbers

Description

Interface functions to use rmvnorm for hyperSpec-class objects.

Usage

## S3 method for class 'numeric,hyperSpec,matrix':
rmmvnorm(n, mean,
    sigma)

## S3 method for class 'numeric,hyperSpec,array': rmmvnorm(n, mean, sigma)

## S3 method for class 'numeric,matrix,matrix': rmmvnorm(n, mean, sigma)

## S3 method for class 'numeric,matrix,array': rmmvnorm(n, mean, sigma)

Arguments

n
vector giving the numer of cases to generate for each group
mean
matrix with mean cases in rows
sigma
common covariance matrix or array (ncol (mean) x ncol (mean) x nrow (mean)) with individual covariance matrices for the groups.

Details

The mvtnorm method for hyperSpec objects supports producing multivariate normal data for groups with different mean but common covariance matrix, see the examples.

See Also

rmvnorm

cov and pooled.cov about calculating covariance of hyperSpec objects.

Examples

Run this code
## multiple groups, common covariance matrix

pcov <- pooled.cov (chondro, chondro$clusters)
rnd <- rmmvnorm (rep (10, 3), mean = pcov$mean, sigma = pcov$COV)
plot (rnd, col = rnd$.group)

Run the code above in your browser using DataLab