Title: | Data Generation with Poisson, Binary and Ordinal Components |
---|---|
Description: | Generation of multiple count, binary and ordinal variables simultaneously given the marginal characteristics and association structure. Throughout the package, the word 'Poisson' is used to imply count data under the assumption of Poisson distribution. The details of the method are explained in Amatya, A. and Demirtas, H. (2015) <DOI:10.1080/00949655.2014.953534>. |
Authors: | Gul Inan, Hakan Demirtas, Ran Gao |
Maintainer: | Ran Gao <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 1.4.3 |
Built: | 2025-02-16 05:16:07 UTC |
Source: | https://github.com/cran/PoisBinOrd |
Provides R functions for generation of multiple count, binary and ordinal variables simultaneously given the marginal characteristics and association structure.
Package: | PoisBinOrd |
Type: | Package |
Version: | 1.4.3 |
Date: | 2021-03-21 |
License: | GPL-2 | GPL-3 |
PoisBinOrd package consists of ten functions. The functions validation.bin
, validation.ord
, and
validation.corr
validate the specified quantities to prevent users from committing obvious specification errors.
correlation.limits
returns the lower and upper bounds of the pairwise correlation of Poisson-Poisson, Poisson-binary, Poisson-ordinal, binary-binary, binary-ordinal, and ordinal-ordinal combinations given their marginal distributions,
i.e. returns the range of feasible pairwise correlations. The function correlation.bound.check
checks the validity of the values of pairwise correlations. The functions intermediate.corr.PP
,
intermediate.corr.BO
, and intermediate.corr.PBO
computes intermediate correlation matrix for Poisson-Poisson combinations, binary/ordinal and binary/ordinal combinations,
and Poisson and binary/ordinal combinations, respectively. The function overall.corr.mat
assembles
the final correlation matrix. The engine function gen.PoisBinOrd
generates mixed data in accordance with the specified marginal and correlational quantities.
Throughout the package, variables are supposed to be inputted in a certain order, namely,
first count variables, next binary variables, and then ordinal variables should be placed.
Gul Inan, Hakan Demirtas, Ran Gao
Maintainer: Ran Gao <[email protected]>
Amatya, A. and Demirtas, H. (2015). Simultaneous generation of multivariate mixed data with Poisson and normal marginals. Journal of Statistical Computation and Simulation, (85)15, 3129-3139.
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.
Ferrari, P.A. and Barbiero, A. (2012). Simulating ordinal data. Multivariate Behavioral Research, 47(4), 566-589.
This function checks if there are range violations among correlation of Poisson-Poisson, Poisson-binary, Poisson-ordinal, binary-binary, binary-ordinal, and ordinal-ordinal combinations.
correlation.bound.check(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
correlation.bound.check(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
n.P |
Number of Poisson variables. |
n.B |
Number of binary variables. |
n.O |
Number of ordinal variables. |
lambda.vec |
Rate vector for Poisson variables. |
prop.vec |
Probability vector for binary variables. |
prop.list |
A list of probability vectors for ordinal variables. |
corr.vec |
Vector of elements below the diagonal of correlation matrix ordered column-wise. |
corr.mat |
Specified correlation matrix. |
The function returns TRUE if no specification problem is encountered. Otherwise, it returns an error message.
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.
validation.corr
, correlation.limits
## Not run: n.P<-1 n.B<-1 n.O<-1 lambda.vec<-c(1) prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) correlation.bound.check(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list,corr.vec=NULL, corr.mat) n.P<-2 n.B<-2 n.O<-2 lambda.vec<-c(1,2) prop.vec<-c(0.3,0.5) prop.list<-list(c(0.3,0.6),c(0.5,0.6)) corr.mat=matrix(0.8,6,6) diag(corr.mat)=1 correlation.bound.check(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list,corr.vec=NULL, corr.mat) ## End(Not run)
## Not run: n.P<-1 n.B<-1 n.O<-1 lambda.vec<-c(1) prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) correlation.bound.check(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list,corr.vec=NULL, corr.mat) n.P<-2 n.B<-2 n.O<-2 lambda.vec<-c(1,2) prop.vec<-c(0.3,0.5) prop.list<-list(c(0.3,0.6),c(0.5,0.6)) corr.mat=matrix(0.8,6,6) diag(corr.mat)=1 correlation.bound.check(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list,corr.vec=NULL, corr.mat) ## End(Not run)
This function computes lower and upper limits for pairwise correlations of Poisson-Poisson, Poisson-binary, Poisson-ordinal, binary-binary, binary-ordinal, and ordinal-ordinal combinations.
correlation.limits(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL)
correlation.limits(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL)
n.P |
Number of Poisson variables. |
n.B |
Number of binary variables. |
n.O |
Number of ordinal variables. |
lambda.vec |
Rate vector for Poisson variables. |
prop.vec |
Probability vector for binary variables. |
prop.list |
A list of probability vectors for ordinal variables. |
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 Poisson-Poisson, Poisson-binary, Poisson-ordinal, binary-ordinal, and ordinal-ordinal variables through the method suggested by Demirtas and Hedeker (2011).
The function returns a matrix of size (n.P + n.B + n.O)*(n.P + n.B + n.O), 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.
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.
validation.corr
, correlation.bound.check
## Not run: n.P<-3 n.B<-2 n.O<-3 lambda.vec<-c(1,2,3) prop.vec<-c(0.3,0.5) prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) #Correlation limits among Poisson variables correlation.limits(n.P,n.B=0,n.O=0,lambda.vec,prop.vec=NULL,prop.list=NULL) #See also Cor.PP.Limit in R package PoisNor #Correlation limits among binary variables correlation.limits(n.P=0,n.B,n.O=0,lambda.vec=NULL,prop.vec,prop.list=NULL) #See also correlation.limits in R package BinNonNor #Correlation limits among ordinal variables correlation.limits(n.P=0,n.B=0,n.O,lambda.vec=NULL,prop.vec=NULL,prop.list) #See also Limit_forOO in R package OrdNor #Correlation limits among Poisson and binary variables and within themselves. correlation.limits(n.P,n.B,n.O=0,lambda.vec,prop.vec,prop.list=NULL) #Correlation limits among Poisson and ordinal variables and within themselves. correlation.limits(n.P,n.B=0,n.O,lambda.vec,prop.vec=NULL,prop.list) #Correlation limits among binary and ordinal variables and within themselves. correlation.limits(n.P=0,n.B,n.O,lambda.vec=NULL,prop.vec,prop.list) #Correlation limits among Poisson, binary, and ordinal variables and within themselves. correlation.limits(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list) n.P<-2 lambda.vec=c(-1,1) correlation.limits(n.P,n.B=0,n.O=0,lambda.vec,prop.vec=NULL,prop.list=NULL) ## End(Not run)
## Not run: n.P<-3 n.B<-2 n.O<-3 lambda.vec<-c(1,2,3) prop.vec<-c(0.3,0.5) prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) #Correlation limits among Poisson variables correlation.limits(n.P,n.B=0,n.O=0,lambda.vec,prop.vec=NULL,prop.list=NULL) #See also Cor.PP.Limit in R package PoisNor #Correlation limits among binary variables correlation.limits(n.P=0,n.B,n.O=0,lambda.vec=NULL,prop.vec,prop.list=NULL) #See also correlation.limits in R package BinNonNor #Correlation limits among ordinal variables correlation.limits(n.P=0,n.B=0,n.O,lambda.vec=NULL,prop.vec=NULL,prop.list) #See also Limit_forOO in R package OrdNor #Correlation limits among Poisson and binary variables and within themselves. correlation.limits(n.P,n.B,n.O=0,lambda.vec,prop.vec,prop.list=NULL) #Correlation limits among Poisson and ordinal variables and within themselves. correlation.limits(n.P,n.B=0,n.O,lambda.vec,prop.vec=NULL,prop.list) #Correlation limits among binary and ordinal variables and within themselves. correlation.limits(n.P=0,n.B,n.O,lambda.vec=NULL,prop.vec,prop.list) #Correlation limits among Poisson, binary, and ordinal variables and within themselves. correlation.limits(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list) n.P<-2 lambda.vec=c(-1,1) correlation.limits(n.P,n.B=0,n.O=0,lambda.vec,prop.vec=NULL,prop.list=NULL) ## End(Not run)
This function simulates a sample of size n from a set of multivariate Poisson, binary, and ordinal data with pre-specified marginals and a correlation matrix.
gen.PoisBinOrd(n, n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, final.corr.mat)
gen.PoisBinOrd(n, n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, final.corr.mat)
n |
Number of variates. |
n.P |
Number of Poisson variables. |
n.B |
Number of binary variables. |
n.O |
Number of ordinal variables. |
lambda.vec |
Rate vector for Poisson variables. |
prop.vec |
Probability vector for binary variables. |
prop.list |
A list of probability vectors for ordinal variables. |
final.corr.mat |
Final correlation matrix produced from |
A matrix of size n*(n.P + n.B + n.O), of which the first n.P columns are Poisson variables, the next n.B columns are binary variables, and the last n.O columns are ordinal variables.
## Not run: n=10000 n.P<-2 n.B<-2 n.O<-2 lambda.vec<-sample(10,2) prop.vec<-runif(2) prop.list<-list(c(0.3,0.6,0.7),c(0.2,0.3,0.5)) M=c(-0.05, 0.26, 0.14, 0.09, 0.14, 0.12, 0.13, -0.02, 0.17, 0.11, -0.04, 0.19, 0.10, 0.35, 0.39) N=diag(6) N[lower.tri(N)]=M corr.mat=N+t(N) diag(corr.mat)<-1 final.corr.mat=overall.corr.mat(n.P,n.B,n.O,lambda.vec,prop.vec, prop.list,corr.vec=NULL,corr.mat) mymixdata=gen.PoisBinOrd(n,n.P,n.B,n.O,lambda.vec,prop.vec,prop.list, final.corr.mat) ## End(Not run)
## Not run: n=10000 n.P<-2 n.B<-2 n.O<-2 lambda.vec<-sample(10,2) prop.vec<-runif(2) prop.list<-list(c(0.3,0.6,0.7),c(0.2,0.3,0.5)) M=c(-0.05, 0.26, 0.14, 0.09, 0.14, 0.12, 0.13, -0.02, 0.17, 0.11, -0.04, 0.19, 0.10, 0.35, 0.39) N=diag(6) N[lower.tri(N)]=M corr.mat=N+t(N) diag(corr.mat)<-1 final.corr.mat=overall.corr.mat(n.P,n.B,n.O,lambda.vec,prop.vec, prop.list,corr.vec=NULL,corr.mat) mymixdata=gen.PoisBinOrd(n,n.P,n.B,n.O,lambda.vec,prop.vec,prop.list, final.corr.mat) ## End(Not run)
Computes an intermediate normal correlation matrix for any combination of binary and ordinal variables before dichotomization/ordinalization given the specified correlation matrix as formulated in Ferrari and Barbiero (2012).
intermediate.corr.BO(n.B, n.O, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
intermediate.corr.BO(n.B, n.O, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
n.B |
Number of binary variables. |
n.O |
Number of ordinal variables. |
prop.vec |
Probability vector for binary variables. |
prop.list |
A list of probability vectors for ordinal variables. |
corr.vec |
Vector of elements below the diagonal of correlation matrix ordered column-wise. |
corr.mat |
Specified correlation matrix. |
A correlation matrix of size (n.B+n.O)*(n.B+n.O).
Ferrari, P.A. and Barbiero, A. (2012). Simulating ordinal data. Multivariate Behavioral Research, 47(4), 566-589.
Barbiero, A. and Ferrari, P.A. (2015). GenOrd: Simulation of ordinal and discrete variables with given correlation matrix and marginal distributions. http://www.cran.r-project.org/web/packages/GenOrd.
## Not run: n.B=1 n.O=2 prop.vec=0.7 prop.list=list(cumsum(c(0.30, 0.40)), cumsum(c(0.4, 0.2, 0.3))) corr.mat=matrix ( c( 1.0000000, 0.1767231, 0.3006186, 0.1767231, 1.0000000, -0.139923, 0.3006186, -0.1399230, 1.0000000),3,3) intmatBO=intermediate.corr.BO(n.B,n.O,prop.vec,prop.list,corr.vec=NULL, corr.mat) n.B=1 n.O=1 prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) intmatBO=intermediate.corr.BO(n.B,n.O,prop.vec,prop.list,corr.vec=NULL, corr.mat) n.B=2 prop.vec=c(0.4,0.7) corr.mat=matrix(c(1,-0.3,-0.3,1),2,2) intmatBB=intermediate.corr.BO(n.B,n.O=0,prop.vec,prop.list=NULL,corr.vec=NULL, corr.mat) #See Tetra.Corr.BB in R package BinNonNor #Tetra.Corr.BB(n.BB=2,prop.vec=c(0.4,0.7),corr.vec=NULL,corr.mat=corr.mat) n.B=0 n.O=2 prop.list=list(cumsum(c(0.30, 0.40)), cumsum(c(0.4,0.2,0.3))) corr.mat=matrix(c(1.0000000, -0.139923,-0.139923,1.0000000),2,2) intmatOO=intermediate.corr.BO(n.B,n.O,prop.vec=NULL,prop.list,corr.vec=NULL, corr.mat) #See IntermediateOO(plist, OOCorrMat) in R package OrdNor #IntermediateOO(plist=list(cumsum(c(0.30,0.40)),cumsum(c(0.4,0.2,0.3))), OOCorrMat=corr.mat) ## End(Not run)
## Not run: n.B=1 n.O=2 prop.vec=0.7 prop.list=list(cumsum(c(0.30, 0.40)), cumsum(c(0.4, 0.2, 0.3))) corr.mat=matrix ( c( 1.0000000, 0.1767231, 0.3006186, 0.1767231, 1.0000000, -0.139923, 0.3006186, -0.1399230, 1.0000000),3,3) intmatBO=intermediate.corr.BO(n.B,n.O,prop.vec,prop.list,corr.vec=NULL, corr.mat) n.B=1 n.O=1 prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) intmatBO=intermediate.corr.BO(n.B,n.O,prop.vec,prop.list,corr.vec=NULL, corr.mat) n.B=2 prop.vec=c(0.4,0.7) corr.mat=matrix(c(1,-0.3,-0.3,1),2,2) intmatBB=intermediate.corr.BO(n.B,n.O=0,prop.vec,prop.list=NULL,corr.vec=NULL, corr.mat) #See Tetra.Corr.BB in R package BinNonNor #Tetra.Corr.BB(n.BB=2,prop.vec=c(0.4,0.7),corr.vec=NULL,corr.mat=corr.mat) n.B=0 n.O=2 prop.list=list(cumsum(c(0.30, 0.40)), cumsum(c(0.4,0.2,0.3))) corr.mat=matrix(c(1.0000000, -0.139923,-0.139923,1.0000000),2,2) intmatOO=intermediate.corr.BO(n.B,n.O,prop.vec=NULL,prop.list,corr.vec=NULL, corr.mat) #See IntermediateOO(plist, OOCorrMat) in R package OrdNor #IntermediateOO(plist=list(cumsum(c(0.30,0.40)),cumsum(c(0.4,0.2,0.3))), OOCorrMat=corr.mat) ## End(Not run)
This function computes the pairwise entries of the intermediate normal correlation matrix for all Poisson-binary and Poisson-ordinal variable combinations given the specified correlation matrix as formulated in Amatya and Demirtas (2015).
intermediate.corr.PBO(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
intermediate.corr.PBO(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
n.P |
Number of Poisson variables. |
n.B |
Number of binary variables. |
n.O |
Number of ordinal variables. |
lambda.vec |
Rate vector for Poisson variables. |
prop.vec |
Probability vector for binary variables. |
prop.list |
A list of probability vectors for ordinal variables. |
corr.vec |
Vector of elements below the diagonal of correlation matrix ordered column-wise. |
corr.mat |
Specified correlation matrix. |
A matrix of n.P*(n.B+n.O)
Amatya, A. and Demirtas, H. (2015). Simultaneous generation of multivariate mixed data with Poisson and normal marginals. Journal of Statistical Computation and Simulation, 85(15), 3129-3139.
intermediate.corr.PP
, intermediate.corr.BO
## Not run: n.P<-1 n.B<-1 n.O<-1 lambda.vec<-c(1) prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) intmatPBO=intermediate.corr.PBO(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list, corr.vec=NULL,corr.mat) ## End(Not run)
## Not run: n.P<-1 n.B<-1 n.O<-1 lambda.vec<-c(1) prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) intmatPBO=intermediate.corr.PBO(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list, corr.vec=NULL,corr.mat) ## End(Not run)
This function computes the intermediate normal correlation matrix for Poisson-Poisson combinations before inverse cdf matching as formulated in Amatya and Demirtas (2015).
intermediate.corr.PP(n.P, lambda.vec, corr.vec = NULL, corr.mat = NULL)
intermediate.corr.PP(n.P, lambda.vec, corr.vec = NULL, corr.mat = NULL)
n.P |
Number of Poisson variables. |
lambda.vec |
Rate vector for Poisson variables. |
corr.vec |
Vector of elements below the diagonal of correlation matrix ordered column-wise. |
corr.mat |
Specified correlation matrix. |
A correlation matrix of size n.P*n.P
Amatya, A. and Demirtas, H. (2015). Simultaneous generation of multivariate mixed data with Poisson and normal marginals. Journal of Statistical Computation and Simulation, 85(15), 3129-3139.
n.P<-3 lambda.vec<-c(1,2,3) corr.mat<-matrix(c(1,0.352,0.265,0.352,1,0.121,0.265,0.121,1),n.P,n.P) intmatPP=intermediate.corr.PP(n.P,lambda.vec,corr.vec=NULL,corr.mat) ## Not run: #See also cmat.star in R package PoisNor #cmat.star(no.pois=3,no.norm=0,corMat=corr.mat,lamvec=lambda.vec) ## End(Not run)
n.P<-3 lambda.vec<-c(1,2,3) corr.mat<-matrix(c(1,0.352,0.265,0.352,1,0.121,0.265,0.121,1),n.P,n.P) intmatPP=intermediate.corr.PP(n.P,lambda.vec,corr.vec=NULL,corr.mat) ## Not run: #See also cmat.star in R package PoisNor #cmat.star(no.pois=3,no.norm=0,corMat=corr.mat,lamvec=lambda.vec) ## End(Not run)
This function computes the final correlation matrix by combining pairwise intermediate correlation matrix entries for Poisson-Poisson, Poisson-binary, Poisson-ordinal, binary-binary, binary-ordinal, and ordinal-ordinal combinations. If the resulting correlation matrix is not positive definite, a nearest positive matrix will be used.
overall.corr.mat(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
overall.corr.mat(n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, prop.list = NULL, corr.vec = NULL, corr.mat = NULL)
n.P |
Number of Poisson variables. |
n.B |
Number of binary variables. |
n.O |
Number of ordinal variables. |
lambda.vec |
Rate vector for Poisson variables. |
prop.vec |
Probability vector for binary variables. |
prop.list |
A list of probability vectors for ordinal variables. |
corr.vec |
Vector of elements below the diagonal of correlation matrix ordered column-wise. |
corr.mat |
Specified correlation matrix. |
A matrix of size (n.P+n.B+n.O)*(n.P+n.B+n.O)
intermediate.corr.PP
, intermediate.corr.BO
,intermediate.corr.PBO
## Not run: n.P<-1 n.B<-1 n.O<-1 lambda.vec<-c(1) prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.vec=NULL corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) finalmat=overall.corr.mat(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list,corr.vec=NULL, corr.mat) ## End(Not run)
## Not run: n.P<-1 n.B<-1 n.O<-1 lambda.vec<-c(1) prop.vec<-c(0.3) prop.list<-list(c(0.3,0.6)) corr.vec=NULL corr.mat=matrix(c(1,0.2,0.1,0.2,1,0.5,0.1,0.5,1),3,3) finalmat=overall.corr.mat(n.P,n.B,n.O,lambda.vec,prop.vec,prop.list,corr.vec=NULL, corr.mat) ## End(Not run)
Checks whether the marginal specification of the binary part is valid and consistent.
validation.bin(n.B, prop.vec = NULL)
validation.bin(n.B, prop.vec = NULL)
n.B |
Number of binary variables. |
prop.vec |
Probability vector for binary variables. |
The function returns TRUE if no specification problem is encountered. Otherwise, it returns an error message.
n.B<-3 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) ## Not run: n.B<-3 validation.bin(n.B) n.B<--3 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) n.B<-0 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) n.B<-5 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) n.B<-3 prop.vec<-c(0.25,0.5,-0.75) validation.bin(n.B,prop.vec) ## End(Not run)
n.B<-3 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) ## Not run: n.B<-3 validation.bin(n.B) n.B<--3 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) n.B<-0 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) n.B<-5 prop.vec<-c(0.25,0.5,0.75) validation.bin(n.B,prop.vec) n.B<-3 prop.vec<-c(0.25,0.5,-0.75) validation.bin(n.B,prop.vec) ## End(Not run)
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.
validation.corr(n.P, n.B, n.O, corr.vec = NULL, corr.mat = NULL)
validation.corr(n.P, n.B, n.O, corr.vec = NULL, corr.mat = NULL)
n.P |
Number of Poisson variables. |
n.B |
Number of binary variables. |
n.O |
Number of ordinal variables. |
corr.vec |
Vector of elements below the diagonal of correlation matrix ordered column-wise. |
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
n.P<-1 n.B<-1 n.O<-1 corr.vec=c(0.2,0.1,0.5) validation.corr(n.P,n.B,n.O,corr.vec,corr.mat=NULL) n.P<-2 n.B<-2 n.O<-2 corr.mat=matrix(0.5,6,6) diag(corr.mat)=1 validation.corr(n.P,n.B,n.O,corr.vec=NULL,corr.mat)
n.P<-1 n.B<-1 n.O<-1 corr.vec=c(0.2,0.1,0.5) validation.corr(n.P,n.B,n.O,corr.vec,corr.mat=NULL) n.P<-2 n.B<-2 n.O<-2 corr.mat=matrix(0.5,6,6) diag(corr.mat)=1 validation.corr(n.P,n.B,n.O,corr.vec=NULL,corr.mat)
Checks whether the marginal specification of the ordinal part is valid and consistent.
validation.ord(n.O, prop.list = NULL)
validation.ord(n.O, prop.list = NULL)
n.O |
Number of ordinal variables. |
prop.list |
A list of probability vectors corresponding to each ordinal variable. The i-th element of prop.list is a vector of the cumulative probabilities defining the marginal distribution of the i-th ordinal component of the multivariate variables. If the i-th ordinal variable has k categories, the i-th vector of the prop.list will contain k-1 probability values. The k-th element is implicitly 1. |
The function returns TRUE if no specification problem is encountered. Otherwise, it returns an error message.
n.O<-3 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(n.O,prop.list) ## Not run: n.O<-3 validation.ord(n.O) n.O<-NULL prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(prop.list=prop.list) n.O<--3 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(-3,prop.list) n.O<--0 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(n.O,prop.list) n.O<-5 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(n.O,prop.list) n.O<-3 prop.list<-list(c(0.3,0.6),c(0.25,0.5,-0.75),c(0.1,0.2,0.8,1.5)) validation.ord(n.O,prop.list) n.O<-3 prop.list<-list(0.3,c(0.3,0.4),c(0.4,0.2,0.3)) validation.ord(n.O,prop.list) ## End(Not run)
n.O<-3 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(n.O,prop.list) ## Not run: n.O<-3 validation.ord(n.O) n.O<-NULL prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(prop.list=prop.list) n.O<--3 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(-3,prop.list) n.O<--0 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(n.O,prop.list) n.O<-5 prop.list<-list(c(0.3,0.6),c(0.25,0.5,0.75),c(0.1,0.2,0.8,0.9)) validation.ord(n.O,prop.list) n.O<-3 prop.list<-list(c(0.3,0.6),c(0.25,0.5,-0.75),c(0.1,0.2,0.8,1.5)) validation.ord(n.O,prop.list) n.O<-3 prop.list<-list(0.3,c(0.3,0.4),c(0.4,0.2,0.3)) validation.ord(n.O,prop.list) ## End(Not run)