# Prepare three GPD parameter vectors
GPD.lambda.vec <- c(0.1, 0.2, 0.3)
GPD.theta.vec <- c(7, 0.7, 40)
# Compute binary probabilities, PMFs, and thresholds
p <- calc.bin.prob.GPD(GPD.theta.vec, GPD.lambda.vec)
pvec <- p$p
prop <- p$prop
Mloc <- p$Mlocation
# Use only the first two variables for demonstration
pvec.pair <- pvec[1:2]
Mlocation.pair <- Mloc[1:2]
prop.pair <- list(prop[[1]], prop[[2]])
# Define a 2 by2 target correlation matrix
del.next <- matrix(c(1.0, 0.3,
0.3, 1.0),
nrow = 2, byrow = TRUE)
# Simulate 100 correlated binary observations
inter_bin <- generate.binaryVar(100, pvec.pair, del.next)
# Reconstruct the GPD scaled data
Mydata <- BinToGPD(pvec.pair, prop.pair, Mlocation.pair, inter_bin)
Run the code above in your browser using DataLab