Description Usage Arguments Value References See Also Examples
View source: R/gaussianRankCorr.R
This function computes the Gaussian rank correlation of \insertCiteBoudt2012;textualBSL.
1 | gaussianRankCorr(x, vec = FALSE)
|
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. |
Gaussian rank correlation matrix (default) or a vector of pair correlations.
cor2cov
for conversion from correlation matrix
to covariance matrix.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.