---
title: "Introduction to cosCorr Package"
author: "Mehmet Niyazi Cankaya"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Introduction to cosCorr}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

# 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

```{r example}
library(cosCorr)

# Simple example with 4 variables (p=4)
x <- c(0, 2, 3, 4)
rho <- cosCorr(x)
print(rho)
```

## More Examples

```{r examples}
# Example with 5 variables
x2 <- c(0, 1, 2, 3, 4)
rho2 <- cosCorr(x2)
print(rho2)

# Example with NA values removed
x3 <- c(0, 2, NA, 4, 5)
rho3 <- cosCorr(x3, na.rm = TRUE)
print(rho3)
```

## 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.

