Learn R Programming

sgee (version 0.6-0)

genCorMat: Correlation Matrix Generator.

Description

Function that generates a correlation matrix of a predefined type and size given appropriate correlation parameter(s), rho.

Usage

genCorMat(corstr = "independence", rho, maxClusterSize = 0)

Arguments

corstr

Structure of correlaiton matrix to be generated; 'independence', 'exchangeable', 'ar1', and 'unstructured' currently implemented.

rho

Correlation parameter; assumed to be of length 1 or maxClusterSize * (maxClusterSize - 1) /2.

maxClusterSize

size of the correlation matrix being generated.

Value

A correlation matrix of form matching corstr and of size maxClusterSize.

Examples

Run this code
# NOT RUN {

## Generates Correlation Matricies easily
## When corstr = "independence", the value of rho
## is irrelevant
mat1 <- genCorMat(corstr = "independence", rho = .1, maxClusterSize = 3) 

## Exchangeable
mat2 <- genCorMat(corstr = "exchangeable", rho = .3, maxClusterSize = 2) 

## AR-1
mat3 <- genCorMat(corstr = "ar1", rho = .4, maxClusterSize = 4) 

## unstructured
mat3 <- genCorMat(corstr = "unstructured",
                  rho = c(.3,.2,.1),
                  maxClusterSize = 3) 


# }

Run the code above in your browser using DataLab