Learn R Programming

PoisBinOrd (version 1.4.3)

gen.PoisBinOrd: Simulates a sample of size n from a set of multivariate Poisson, binary, and ordinal variables

Description

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.

Usage

gen.PoisBinOrd(n, n.P, n.B, n.O, lambda.vec = NULL, prop.vec = NULL, 
prop.list = NULL, final.corr.mat)

Arguments

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 overall.corr.mat

Value

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.

Examples

Run this code
# 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)
# }

Run the code above in your browser using DataLab