Learn R Programming

AirScreen (version 0.1.0)

rnormCS: Generate normal samples (Compound Symmetry)

Description

rnormCS efficiently generates samples from a multivariate normal distribution with compound symmetry correlation structure (all features equally correlated).

Usage

rnormCS(n, p, rho = 0.5, means = 0, variances = 1)

Value

A numeric \(n \times p\) matrix with the specified correlation, means, and variances.

Arguments

n

Number of observations.

p

Number of features.

rho

Common correlation coefficient.

means

Numeric vector of feature means (length \(1\) or \(p\)).

variances

Numeric vector of feature variances (length \(1\) or \(p\)).

Examples

Run this code
X1 <- rnormCS(10, 5)
X2 <- rnormCS(10, 5, rho = 0.3, means = 2, variances = 4)
X3 <- rnormCS(10, 5, rho = 0.4, means = 1:5, variances = 3:7)

Run the code above in your browser using DataLab