Last data update: 2014.03.03

R: Computes lower and upper correlation bounds for each pair of...
correlation.limitsR Documentation

Computes lower and upper correlation bounds for each pair of variables

Description

This function computes lower and upper limits for pairwise correlation of binary-binary, binary-continuous non-normal, and continuous non-normal-continuous non-normal combinations.

Usage

correlation.limits(n.BB, n.NN, prop.vec = NULL, coef.mat = NULL)

Arguments

n.BB

Number of binar variables.

n.NN

Number of continuous non-normal variables.

prop.vec

Probability vector for binary variables.

coef.mat

Matrix of coefficients produced from fleishman.coef.

Details

While the function computes the exact lower and upper bounds for pairwise correlations among binary-binary variables as formulated in Demirtas et al. (2012), it computes approximate lower and upper bounds for pairwise correlations among binary-continuous non-normal and continuous non-normal-continuous non-normal variables through the method suggested by Demirtas and Hedeker (2011).

Value

The function returns a matrix of size (n.BB + n.NN)*(n.BB + n.NN), where the lower triangular part of the matrix contains the lower bounds and the upper triangular part of the matrix contains the upper bounds of the feasible correlations.

References

Demirtas, H. and Hedeker, D. (2011). A practical way for computing approximate lower and upper correlation bounds. The American Statistician, 65(2), 104-109.

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

fleishman.coef, correlation.bound.check

Examples


n.BB=2
n.NN=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)

limits=correlation.limits(n.BB,n.NN,prop.vec,coef.mat)
limits.bin=correlation.limits(n.BB,n.NN=0,prop.vec,coef.mat=NULL)
limits.nonnor=correlation.limits(n.BB=0,n.NN,prop.vec=NULL,coef.mat)

## Not run: 
n.BB=1
prop.vec=0.5
limits=correlation.limits(n.BB,n.NN,prop.vec,coef.mat=NULL)

## End(Not run)

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/correlation.limits.Rd_%03d_medium.png", width=480, height=480)
> ### Name: correlation.limits
> ### Title: Computes lower and upper correlation bounds for each pair of
> ###   variables
> ### Aliases: correlation.limits
> 
> ### ** Examples
> 
> 
> n.BB=2
> n.NN=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)
> 
> limits=correlation.limits(n.BB,n.NN,prop.vec,coef.mat)
> limits.bin=correlation.limits(n.BB,n.NN=0,prop.vec,coef.mat=NULL)
> limits.nonnor=correlation.limits(n.BB=0,n.NN,prop.vec=NULL,coef.mat)
> 
> ## Not run: 
> ##D n.BB=1
> ##D prop.vec=0.5
> ##D limits=correlation.limits(n.BB,n.NN,prop.vec,coef.mat=NULL)
> ## End(Not run)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>