cov_intraclass: Generates a p \times p intraclass covariance matrix

Description Usage Arguments Details Value

View source: R/data-intraclass.r

Description

This function generates a p \times p intraclass covariance matrix with correlation rho. The variance sigma2 is constant for each feature and defaulted to 1.

Usage

1
cov_intraclass(p, rho, sigma2 = 1)

Arguments

p

the size of the covariance matrix

rho

the value of the off-diagonal elements

sigma2

the variance of each feature

Details

The intraclass covariance matrix is defined as:

σ^2 * (ρ * J_p + (1 - ρ) * I_p),

where J_p is the p \times p matrix of ones and I_p is the p \times p identity matrix.

By default, with sigma2 = 1, the diagonal elements of the intraclass covariance matrix are all 1, while the off-diagonal elements of the matrix are all rho.

The value of rho must be between 1 / (1 - p) and 1, exclusively, to ensure that the covariance matrix is positive definite.

Value

intraclass covariance matrix


sparsediscrim documentation built on July 1, 2021, 9:07 a.m.