Learn R Programming

corrMCT (version 0.2.0)

corrmat_block: Block design correlation matrix

Description

An easy function to generate a block design correlation matrix. Each diagonal element \(R_i\) is a compound symmetric matrix with dimension \(d_i \times d_i\). Correlation coefficient in each block is \(\rho_i\). All the off-diagonal elements are \(0\).

Usage

corrmat_block(d, rho)

Value

A correlation matrix

Arguments

d

An integer vector. Length \(B\) of block dimensions. Element of d can be 1, it would not generate a sub-matrix with the corresponding element in rho, but just \(1\).

rho

A numeric vector. A length \(B\) vector of correlation coefficients, represent \(B\) different block of correlation matrix.

Examples

Run this code
corrmat_block(
  d = c(2,3,4),
  rho = c(0.1, 0.3, 0.5)
)

Run the code above in your browser using DataLab