covMatCS {TestIndVars}R Documentation

Generate a covariance matrix with equivariance-equicorrelation or compound symmetry structure.

Description

This function generates a covariance matrix with equivariance-equicorrelation

Usage

covMatCS(p, sigma2 = 1, rho = NULL)

Arguments

p

An integer specifying the number of dimensions of the covariance matrix.

sigma2

A numeric value specifying the variance parameter (default = 1).

rho

A numeric value specifying the correlation parameter. If not provided, a random value between 0 and 1 will be generated.

The compound symmetry structure is defined as follows:

\Sigma = \Sigma_{CS} = \sigma^2 \begin{bmatrix} 1 & \rho & \cdots & \rho \\ \rho & 1 & \cdots & \rho \\ \vdots & \vdots & \ddots & \vdots \\ \rho & \rho & \cdots & \rho \end{bmatrix}

where \Sigma is the covariance matrix, \sigma^2 is the variance parameter, and \rho is the correlation parameter.

Value

A p \times p numeric matrix representing the covariance matrix with equivariance-equicorrelation or compound symmetry structure.

Examples

# generate a covariance matrix for \eqn{p = 5}, \eqn{\sigma^2 = 1}, and \eqn{\rho = 0.9}.
covMatCS(p = 5, rho = 0.9)

# generate a covariance matrix for \eqn{p = 5},  \eqn{\sigma^2 = 5}, and \eqn{\rho = 0.9}.
covMatCS(p = 5, sigma2 = 5, rho = 0.9)

# generate  covariance matrix for \eqn{p = 5},  and no value is considered for \eqn{\rho}
covMatCS(p = 5)


[Package TestIndVars version 0.1.0 Index]