dm: numeric data matrix; rows are observiations (samples ), columns are variables.
method: a string; "standard" (default), "Qn", "QnStable", "ogkQn" and "shrink" envokes standard, elementwise robust (based on Qn scale estimator, see Qn), robust (Qn using OGK, see covOGK) or shrinked
correlation estimate respectively.
Returns
A correlation matrix estimated by the specified method.
Details
The "standard" method envokes a standard correlation estimator. "Qn"
envokes a robust, elementwise correlation estimator based on the Qn scale estimte. "QnStable" also uses the Qn scale estimator, but uses an improved way of transforming that into the correlation estimator. "ogkQn" envokes a correlation estimator based on Qn using OGK. "shrink" is only useful when used with pcSelect. An optimal shrinkage parameter is used. Only correlation between response and covariates is shrinked.
See Also
Qn and covOGK
from package robustbase. pcorOrder for computing partial correlations.
References
See those in the help pages for Qn and covOGK from package robustbase.
## produce uncorrelated normal random variablesset.seed(42)x <- rnorm(100)y <-2*x + rnorm(100)## compute correlation of var1 and var2mcor(cbind(x,y), method="standard")## repeat but this time with heavy-tailed noiseyNoise <-2*x + rcauchy(100)mcor(cbind(x,yNoise), method="standard")## shows almost no correlationmcor(cbind(x,yNoise), method="Qn")## shows a lot correlationmcor(cbind(x,yNoise), method="QnStable")## shows still much correlationmcor(cbind(x,yNoise), method="ogkQn")## ditto