mcor {pcalg}R Documentation

Compute Correlation Matrix (Robustly)

Description

Compute a correlation matrix, possibly by robust methods, applicable also for the case of a large number of variables.

Usage

mcor(dm, method= c("standard", "Qn", "ogkScaleTau2", "ogkQn"))

Arguments

dm numeric matrix of data; rows are samples, columns are variables.
method "standard" (default), "Qn" and "ogkQn" envokes standard, elementwise robust (based on Q_n scale estimator, see Qn) or robust (Qn using OGK, see covOGK) correlation estimate respectively.

Details

The "standard" method envokes a standard correlation estimator. "Qn" envokes a robust, elementwise correlation estimator based on the Qn scale estimte. "ogkQn" envokes a correlation estimator based on Qn using OGK.

Value

A correlation matrix estimated according to the specified method

Author(s)

Markus Kalisch kalisch@stat.math.ethz.ch and Martin Maechler

References

See those in the help pages for Qn and covOGK from package robustbase.

See Also

Qn) and covOGK from package robustbase. pcorOrder for computing partial correlations and condIndFisherZ for testing zero partial correlation.

Examples

## produce uncorrelated normal random variables
set.seed(42)
x <- rnorm(100)
y <- 2*x + rnorm(100)
## compute correlation of var1 and var2
mcor(cbind(x,y), method="standard")

## repeat but this time with heavy-tailed noise
yNoise <- 2*x + rcauchy(100)
mcor(cbind(x,yNoise), method="standard") ## shows almost no correlation
mcor(cbind(x,yNoise), method="Qn")       ## shows a lot correlation
mcor(cbind(x,yNoise), method="ogkQn")    ## dito

[Package pcalg version 0.1-3 Index]