intermediate.corr.BC: Computes intermediate correlation matrix for binary and...

Description Usage Arguments Value References See Also Examples

View source: R/intermediate.corr.BC.R

Description

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

Usage

1
2
intermediate.corr.BC(n.P, n.B, n.C, lambda.vec = NULL, prop.vec = NULL, 
coef.mat = NULL, corr.vec = NULL, corr.mat = NULL)

Arguments

n.P

Number of Poisson variables.

n.B

Number of binary variables.

n.C

Number of continuous variables.

lambda.vec

Rate vector for Poisson variables.

prop.vec

Proportion vector for binary variables.

coef.mat

Matrix of coefficients produced from fleishman.coef.

corr.vec

Vector of elements below the diagonal of correlation matrix ordered column-wise.

corr.mat

Specified correlation matrix.

Value

A correlation matrix of size n.B*n.C.

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

intermediate.corr.BB, intermediate.corr.CC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: 
n.B<-2
n.C<-4
prop.vec=c(0.4,0.7)
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)
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)

intmatBC=intermediate.corr.BC(n.P=0,n.B,n.C,lambda.vec=NULL,prop.vec,coef.mat, 
corr.vec=NULL,corr.mat)
intmatBC

n.B<-1
n.C<-1
prop.vec=0.6
coef.mat=matrix(c(-0.31375,0.82632,0.31375,0.02271),4,1)
corr.vec=NULL
corr.mat=matrix(c(1,-0.3,-0.3,1),2,2)

intmatBC=intermediate.corr.BC(n.P=0,n.B,n.C,lambda.vec=NULL,prop.vec,coef.mat, 
corr.vec=NULL,corr.mat)
intmatBC

## End(Not run)

Example output

Loading required package: BB
Loading required package: corpcor
Loading required package: Matrix
Loading required package: mvtnorm
           [,1]       [,2]       [,3]       [,4]
[1,] -0.4253028 -0.3814076 -0.3862091 -0.3846393
[2,] -0.4420581 -0.3964336 -0.4014243 -0.3997926
           [,1]
[1,] -0.4253028

PoisBinNonNor documentation built on March 22, 2021, 9:07 a.m.