Last data update: 2014.03.03

R: Computes an tetrachoric correlation matrix for binary...
Tetra.Corr.BBR Documentation

Computes an tetrachoric correlation matrix for binary variables given the specified correlation matrix

Description

This function computes the tetrachoric correlation matrix for binary-binary combinations as formulated in Demirtas et al. (2012).

Usage

Tetra.Corr.BB(n.BB, prop.vec, corr.vec = NULL, corr.mat = NULL)

Arguments

n.BB

Number of binary variables.

prop.vec

Probability vector for binary variables.

corr.vec

Vector of elements below the diagonal of correlation matrix ordered columnwise.

corr.mat

Specified correlation matrix.

Value

A correlation matrix of size n.BB*n.BB.

References

Demirtas, H., Hedeker, D., and Mermelstein, R.J. (2012). Simulation of massive public health data by power polynomials. Statistics in Medicine, 31(27), 3337-3346.

See Also

Tetra.Corr.BB, Biserial.Corr.BN, overall.corr.mat

Examples

n.BB=2
prop.vec=c(0.4,0.7)
corr.vec=NULL
corr.mat=matrix(c(1.0,-0.3,-0.3,-0.3,-0.3,-0.3,
-0.3,1.0,-0.3,-0.3,-0.3,-0.3,
-0.3,-0.3,1.0,0.4,0.5,0.6,
-0.3,-0.3,0.4,1.0,0.7,0.8,
-0.3,-0.3,0.5,0.7,1.0,0.9,
-0.3,-0.3,0.6,0.8,0.9,1.0),6,by=TRUE)

tetcor.mat=Tetra.Corr.BB(n.BB,prop.vec,corr.vec=NULL,corr.mat)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BinNonNor)
Loading required package: BB
Loading required package: corpcor
Loading required package: mvtnorm
Loading required package: Matrix
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BinNonNor/Tetra.Corr.BB.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Tetra.Corr.BB
> ### Title: Computes an tetrachoric correlation matrix for binary variables
> ###   given the specified correlation matrix
> ### Aliases: Tetra.Corr.BB
> 
> ### ** Examples
> 
> n.BB=2
> prop.vec=c(0.4,0.7)
> corr.vec=NULL
> corr.mat=matrix(c(1.0,-0.3,-0.3,-0.3,-0.3,-0.3,
+ -0.3,1.0,-0.3,-0.3,-0.3,-0.3,
+ -0.3,-0.3,1.0,0.4,0.5,0.6,
+ -0.3,-0.3,0.4,1.0,0.7,0.8,
+ -0.3,-0.3,0.5,0.7,1.0,0.9,
+ -0.3,-0.3,0.6,0.8,0.9,1.0),6,by=TRUE)
> 
> tetcor.mat=Tetra.Corr.BB(n.BB,prop.vec,corr.vec=NULL,corr.mat)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>