Description Usage Arguments Value See Also Examples
This function validates the specified correlation vector and/or matrix for appropriate dimension, symmetry, range, and positive definiteness. If both correlation matrix and correlation vector are supplied, it checks whether the matrix and vector are conformable.
1 | validation.corr(n.BB, n.NN, corr.vec = NULL, corr.mat = NULL)
|
n.BB |
Number of binary variables. |
n.NN |
Number of continuous non-normal variables. |
corr.vec |
Vector of elements below the diagonal of correlation matrix ordered columnwise. |
corr.mat |
Specified correlation matrix. |
The function returns TRUE if no specification problem is encountered. Otherwise, it returns an error message.
correlation.limits
, correlation.bound.check
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | n.BB=2
n.NN=4
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)
validation.corr(n.BB,n.NN,corr.vec=NULL,corr.mat)
n.BB=2
n.NN=4
corr.vec=c(-0.3,-0.3,-0.3,-0.3,-0.3,-0.3,-0.3,-0.3,-0.3,0.4,0.5,0.6,0.7,0.8,0.9)
validation.corr(n.BB,n.NN,corr.vec,corr.mat=NULL)
## Not run:
n.BB=0
n.NN=4
validation.corr(n.BB,n.NN,corr.vec=NULL,corr.mat)
n.BB=2
n.NN=0
validation.corr(n.BB,n.NN=0,corr.vec=NULL,corr.mat)
corr.matc=corr.mat[3:6,3:6]
validation.corr(n.BB=0,n.NN=4,corr.vec=NULL,corr.mat=corr.matc)
corr.mat[2,1]=0.5
validation.corr(n.BB,n.NN,corr.vec=NULL,corr.mat)
corr.mat[1,2]=0.5
corr.mat[3,1]=1.5
corr.mat[1,3]=1.5
validation.corr(n.BB,n.NN,corr.vec=NULL,corr.mat)
npd<-matrix(c(1, 0.477, 0.644, 0.478, 0.651, 0.826,
0.477, 1, 0.516, 0.233, 0.682, 0.75,
0.644, 0.516, 1, 0.599, 0.581, 0.742,
0.478, 0.233, 0.599, 1, 0.741, 0.8,
0.651, 0.682, 0.581, 0.741, 1, 0.798,
0.826, 0.75, 0.742, 0.8, 0.798, 1),
nrow = 6, ncol = 6)
validation.corr(n.BB,n.NN,corr.vec=NULL,corr.mat=npd)
n.BB=1
n.NN=0
corr.mat<-diag(1)
validation.corr(n.BB,n.NN,corr.vec=NULL,corr.mat)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.