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:
where |
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)