distance: Compute Distance Correlation

View source: R/distance.r

distanceR Documentation

Compute Distance Correlation

Description

Calculate the distance correlation between two linear spaces.

Usage

distance(s1, s2, type = "dist", x = NULL)

Arguments

s1

First space

s2

Second space

type

Type of distance measures: "dist" (default), "trace", "canonical" or "sine"

x

The covariate values, for canonical correlation only.

Value

The distance between s1 and s2.

Examples

# two spaces
failEDR <- as.matrix(cbind(
  c(1, 1, 0, 0, 0, 0),
  c(0, 0, 1, -1, 0, 0)
))
B <- as.matrix(cbind(
  c(0.1, 1.1, 0, 0, 0, 0),
  c(0, 0, 1.1, -0.9, 0, 0)
))

distance(failEDR, B, "dist")
distance(failEDR, B, "trace")

N <- 300
P <- 6
dataX <- matrix(rnorm(N * P), N, P)
distance(failEDR, B, "canonical", dataX)

orthoDr documentation built on April 30, 2023, 5:12 p.m.