Learn R Programming

ccaPP (version 0.1.1)

ccaProj: (Robust) CCA via projections through the data points

Description

Perform canoncial correlation analysis via projection pursuit based on projections through the data points, with a focus on robust and nonparametric methods.

Usage

ccaProj(x, y, k = 1,
    method = c("spearman", "kendall", "quadrant", "M", "pearson"),
    control = list(...), useL1Median = TRUE, ...)

CCAproj(x, y, k = 1, method = c("spearman", "kendall", "quadrant", "M", "pearson"), useL1Median = TRUE, ...)

Arguments

x,y
each can be a numeric vector, matrix or data frame.
k
an integer giving the number of canonical variables to compute.
method
a character string specifying the correlation functional to maximize. Possible values are "spearman" for the Spearman correlation, "kendall" for the Kendall correlation, "quadrant" for the quadrant correlati
control
a list of additional arguments to be passed to the specified correlation functional. If supplied, this takes precedence over additional arguments supplied via the ... argument.
useL1Median
a logical indicating whether the $L_{1}$ medians should be used as the centers of the data sets (defaults to TRUE). If FALSE, the columnwise centers are used instead (columnwise means if method is "pea
...
additional arguments to be passed to the specified correlation functional.

Value

  • An object of class "cca" with the following components:
  • cora numeric vector giving the canonical correlation measures.
  • Aa numeric matrix in which the columns contain the canonical vectors for x.
  • Ba numeric matrix in which the columns contain the canonical vectors for y.
  • callthe matched function call.

Details

First the candidate projection directions are defined for each data set from the respective center through each data point. Then the algorithm scans all $n^2$ possible combinations for the maximum correlation, where $n$ is the number of observations.

See Also

ccaGrid corFunctions

Examples

Run this code
## generate data
library("mvtnorm")
set.seed(1234)  # for reproducibility
p <- 3
q <- 2
m <- p + q
sigma <- 0.5^t(sapply(1:m, function(i, j) abs(i-j), 1:m))
xy <- rmvnorm(100, sigma=sigma)
x <- xy[, 1:p]
y <- xy[, (p+1):m]

## Spearman correlation
ccaProj(x, y, method = "spearman")
ccaProj(x, y, method = "spearman", consistent = TRUE)

## Pearson correlation
ccaProj(x, y, method = "pearson")

Run the code above in your browser using DataLab