This function computes the final correlation matrix by combining tetrachoric correlation for
binary-binary combinations, biserial correlations for binary-continuous non-normal combinations, and intermediate correlation matrix
for continuous non-normal-continuous non-normal combinations. If the resulting correlation matrix is not positive definite,
a nearest positive matrix will be used.
Vector of elements below the diagonal of correlation matrix ordered columnwise.
corr.mat
Specified correlation matrix.
coef.mat
Matrix of coefficients produced from fleishman.coef.
Value
A matrix of size (n.BB+n.NN)*(n.BB+n.NN).
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.
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/overall.corr.mat.Rd_%03d_medium.png", width=480, height=480)
> ### Name: overall.corr.mat
> ### Title: Computes the final correlation matrix
> ### Aliases: overall.corr.mat
>
> ### ** Examples
>
> n.BB=2
> n.NN=4
> 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,byrow=TRUE)
>
> coef.mat=matrix(c(
+ -0.31375, 0.00000, 0.10045, -0.10448,
+ 0.82632, 1.08574, 1.10502, 0.98085,
+ 0.31375, 0.00000, -0.10045, 0.10448,
+ 0.02271, -0.02945, -0.04001, 0.00272),4,byrow=TRUE)
>
> final.corr.mat=overall.corr.mat(n.BB,n.NN,prop.vec,corr.vec=NULL,corr.mat,
+ coef.mat)
>
> corr.mat.BB=corr.mat[1:2,1:2]
> final.corr.mat=overall.corr.mat(n.BB,n.NN=0,prop.vec,corr.vec=NULL,
+ corr.mat=corr.mat.BB,coef.mat=NULL)
>
> corr.mat.NN=corr.mat[3:6,3:6]
> final.corr.mat=overall.corr.mat(n.BB=0,n.NN,prop.vec=NULL,corr.vec=NULL,
+ corr.mat=corr.mat.NN,coef.mat)
>
>
> n.BB=1
> n.NN=1
> prop.vec=0.6
> corr.vec=NULL
> corr.mat=matrix(c(1,-0.3,-0.3,1),2,2)
> coef.mat=matrix(c(-0.31375,0.82632,0.31375,0.02271),4,1)
> final.corr.mat=overall.corr.mat(n.BB,n.NN,prop.vec,corr.vec=NULL,corr.mat,
+ coef.mat)
>
>
>
>
>
> dev.off()
null device
1
>