genCorMat: Correlation Matrix Generator.

Description Usage Arguments Value Note Author(s) Examples

View source: R/genCorMat.R

Description

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

Usage

1
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.

Note

Mostly intended for internal use, but could be useful to user. Therefore, the function is exported.

Author(s)

Gregory Vaughan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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) 

sgee documentation built on May 1, 2019, 7:10 p.m.