Introduction to cosCorr Package

Introduction to cosCorr Package

Overview

The cosCorr package implements the cosine-correlation coefficient for measuring the degree of linear dependence among variables in multidimensional contexts.

The Cosine-Correlation Theorem

The cosine-correlation coefficient rho is defined as:

rho = [(p-1) * prod(|t_i|)] / sum(|t_i|^(p-1))

where t_1 = 0 and t_2, …, t_p are the variables in the system.

Basic Usage

library(cosCorr)

# Simple example with 4 variables (p=4)
x <- c(0, 2, 3, 4)
rho <- cosCorr(x)
print(rho)
#> [1] 0.7272727

More Examples

# Example with 5 variables
x2 <- c(0, 1, 2, 3, 4)
rho2 <- cosCorr(x2)
print(rho2)
#> [1] 0.2711864

# Example with NA values removed
x3 <- c(0, 2, NA, 4, 5)
rho3 <- cosCorr(x3, na.rm = TRUE)
print(rho3)
#> [1] 0.6091371

Properties of the Coefficient

  • Range: The coefficient always lies in [0, 1]
  • Interpretation: Higher values indicate stronger linear dependence
  • Generalization: Extends naturally to p-dimensional spaces
  • Applications: Useful in experimental design, time series analysis, and geometric analysis

Mathematical Background

The coefficient is derived from dimensional exploration principles in time scale calculus. It quantifies angular relationships between variables in a p-dimensional space.

References

Cankaya, M. N. (2025). Derivatives through Probes in Regular Geometric Objects: A Dimensional Exploration for qqq-Sets in Time Scale Calculus. Fractals, in printing progress.