Learn R Programming

NORTARA (version 1.0.0)

BoundingRA: Computes an intermediate multivariate normal correlation matrix before using the NORTA approach.

Description

The function computes an intermediate multivariate correlation matrix with a specific RA(Retrospective Approximation) algorithm called bounding RA.

Usage

BoundingRA(cor_matrix, invcdfnames, paramslists, m1 = 60, c1 = 2, c2 = 1, delta1 = 1e-04, sigma0 = 0.01, epsilon = 1e+50, maxit = 1000)

Arguments

cor_matrix
The specified input correlation matrix.
invcdfnames
A character sequence of the marginals' inverse cdf names.
paramslists
A list contains lists of params of the marginals as the same order as invcdfnames.
m1
The initial sample size.
c1
The sample-size multiplier(c1>1).
c2
The step-size multiplier(c2>0).
delta1
The initial step size(detla1>0).
sigma0
The standard error tolerance.
epsilon
The initial error tolerance.
maxit
The maximum number of numerical searches.

Value

An intermediate normal correalation matrix of the same size as cor_matrix.

Details

The function computes an intermediate multivariate correlation matrix with a specific RA(Retrospective Approximation) algorithm called bounding RA.Then the result matrix will be used to applying the NORTA approach to get n observations which have specified marginals and target correlation matrix cor_matrix.

References

Huifen Chen, (2001) Initialization for NORTA: Generation of Random Vectors with Specified Marginals and Correlations. INFORMS Journal on Computing 13(4):312-331.

See Also

genNORTARA, valid_input_cormat, check_input_cormat

Examples

Run this code
## Not run: 
# invcdfnames <- c("qt","qpois","qnorm")
# paramslists <- list(
#                m1 = list(df = 3),
#                m2 = list(lambda = 5),
#                m3 = NULL  # it means list(mean = 0, sd = 1)
#                  )
# cor_matrix <- matrix(c(1,0.5,-0.3,0.5,1,0.4,-0.3,0.4,1), 3)
# Sigma <- BoundingRA(cor_matrix,invcdfnames,paramslists)
# Sigma
# invcdfnames <- c("qunif","qunif","qunif")
# paramslists <- list(
#                m1 = NULL, #it means list(min = 0, max = 1)
#                m2 = NULL,
#                m3 = NULL
#               )
# cor_matrix <- matrix(c(1,0.5,-0.3,0.5,1,0.4,-0.3,0.4,1), 3)
# Sigma <- BoundingRA(cor_matrix,invcdfnames,paramslists)
# Sigma
# #NB:For element 0.5 in cor_matrix, the true root should be around 2*sin(0.5*3.14/6).
# res <- sapply(c(0.5,-0.3,0.4), function(x){2*sin(x*pi/6)})
# trueroots <- diag(1/2,3,3)
# trueroots[upper.tri(trueroots)] <- res
# trueroots <- trueroots + t(trueroots)
# trueroots
# abserrors <- abs(Sigma - trueroots)
# abserrors
# ## End(Not run)

Run the code above in your browser using DataLab