## Not run:
# invcdfnames <- c("qt","qpois","qnorm","qweibull","qunif")
# # The following usage :
# # a <- qt; b <- qnorm; f <- stats::qweibull (It is also the way you can use functions
# # from other packages)
# # invcdfnames <- c("a","qpois","b","f","qunif") will also be ok!
# paramslists <- list(
# m1 = list(df = 3),
# m2 = list(lambda = 5),
# m4 = list(shape = 1)
# )
# defaultindex <- c(3,5)
# #It means the 3rd and 5th invcdf should use its default arguments.
# #That means qnorm using mean = 0, sd = 1, qunif using min =0 ,max =1 and so on.
# cor_matrix <- matrix(c(1.0,-0.4,0.1,0.7,-0.2,-0.4,
# 1.0,0.4,0.4,0.9,0.1,0.4,1.0,
# 0.5,0.5,0.7, 0.4,0.5,1.0,
# 0.7,-0.2,0.9,0.5,0.7,1.0),5,5)
#
# res <- genNORTARA(10000,cor_matrix,invcdfnames,paramslists,defaultindex)
# #May get warning message indicating nearest positive definite is used,It's
# #normal but the cor(res) may not very close to cor_matrix.
# cor(res)
# invcdfnames <- c("qt","qpois","qnorm")
# paramslists <- list(
# m1 = list(df = 3),
# m2 = list(lambda = 5)
# )
# defaultindex <- 3
# cor_matrix <- matrix(c(1,0.5,-0.3,0.5,1,0.4,-0.3,0.4,1), 3)
# res <- genNORTARA(10000,cor_matrix,invcdfnames,paramslists,defaultindex)
# cor(res) #This time cor(res) may very close to cor_matrix.
# ## End(Not run)
Run the code above in your browser using DataLab