gaussianRankCorr: Gaussian rank correlation

Description Usage Arguments Value References See Also Examples

View source: R/gaussianRankCorr.R

Description

This function computes the Gaussian rank correlation of \insertCiteBoudt2012;textualBSL.

Usage

1

Arguments

x

A numeric matrix representing data where the number of rows is the number of independent data points and the number of columns is the number of variables in the dataset.

vec

A logical argument indicating if the vector of correlations should be returned instead of a matrix.

Value

Gaussian rank correlation matrix (default) or a vector of pair correlations.

References

\insertAllCited

See Also

cor2cov for conversion from correlation matrix to covariance matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(ma2)
model <- newModel(fnSimVec = ma2_sim_vec, fnSum = ma2_sum, simArgs = list(T = 10),
                  theta0 = ma2$start, fnLogPrior = ma2_prior)
set.seed(100)

# generate 1000 simualtions from the ma2 model
x <- simulation(model, n = 1000, theta = c(0.6, 0.2))$x

corr1 <- cor(x) # traditional correlation matrix
corr2 <- gaussianRankCorr(x) # Gaussian rank correlation matrix
par(mfrow = c(1, 2))
image(corr1, main = 'traditional correlation matrix')
image(corr2, main = 'Gaussian rank correlation matrix')

std <- apply(x, MARGIN = 2, FUN = sd) # standard deviations
cor2cov(gaussianRankCorr(x), std) # convert to covariance matrix

ziwenan/BSL documentation built on April 25, 2021, 1:11 p.m.