distance-constructors: Distance Function Constructors

cordistR Documentation

Distance Function Constructors

Description

These functions provide convenient constructors for various types of distance functions. Each constructor function initializes a distance function object for use with distance computation functions, specifying the method and any necessary labels.

Usage

cordist(labels = NULL, method = c("pearson", "spearman"))

mahadist(labels = NULL)

eucdist(labels = NULL)

robustmahadist(labels = NULL)

pcadist(
  labels = NULL,
  ncomp = 2,
  whiten = TRUE,
  threshfun = NULL,
  dist_method = c("euclidean", "manhattan", "cosine")
)

Arguments

labels

A vector of labels associated with the data points.

method

The method of distance computation, applicable for 'cordist'.

Details

The constructors allow for the specification of distance calculation methods and associated labels: - 'cordist' creates a correlation distance function. - 'mahadist' creates a Mahalanobis distance function. - 'eucdist' creates a Euclidean distance function. - 'robustmahadist' creates a robust version of the Mahalanobis distance function.

Value

An object of class 'distfun' with a specific method subclass, encapsulating all information necessary for computing distances according to the specified method.

See Also

create_dist for the underlying constructor used by these functions.

Examples

dist_obj_1 <- cordist(labels = c("A", "B", "C"), method = "pearson")
dist_obj_2 <- mahadist(labels = c("A", "B", "C"))
dist_obj_3 <- eucdist(labels = c("A", "B", "C"))
dist_obj_4 <- robustmahadist(labels = c("A", "B", "C"))


bbuchsbaum/rMVPA documentation built on April 28, 2024, 6:30 a.m.