Title: Measures of Independence and Connection Without Linear Models
Version: 0.1.0
Description: Provides tools to measure connection and independence between variables without relying on linear models. Includes functions to compute Eta squared, Chi-squared, and Cramer V. The main advantage of this package is that it works without requiring parametric assumptions. The methods implemented are based on educational material and statistical decomposition techniques, not directly on previously published software or articles.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-07-23 13:24:35 UTC; Pietro
Author: Pietro Frascino [aut, cre] (Student of Alma Mater Studiorum of Bologna)
Maintainer: Pietro Frascino <pietro.frascino710@gmail.com>
Repository: CRAN
Date/Publication: 2025-07-25 09:50:07 UTC

Chi-squared Statistic for Association Between Two Variables

Description

Calculates the Chi-squared statistic from a contingency table constructed using two input vectors. Both parameters can be a categorical (non-numeric) variable, allowing flexibility in input types. Variable a is used as rows, and b as columns in the contingency table.

Usage

Chi_squared(a, b)

Arguments

a

First array or vector. Can be numeric or a categorical factor.

b

Second array or vector. Can be numeric or a categorical factor.

Value

The Chi-squared statistic measuring association between the variables.

Examples

Chi_squared(c(1, 3, 3, 6, 10), c("a", "b", "c", "d", "e"))


Cramer V Statistic for Strength of Association

Description

Computes Cramer V to assess the strength of association between two categorical variables.

Usage

Cramer_V(a, b)

Arguments

a

A numeric or categorical vector (used for rows in the contingency table).

b

A numeric or categorical vector (used for columns in the contingency table).

Details

This measure is derived from the Chi-squared statistic and a contingency table. Both parameters can be a categorical variable, allowing flexibility in working with labelled data. Variable a is treated as rows and b as columns in the contingency table. The function supports both elementary data records and grouped frequency distributions.

Value

A numeric value between 0 and 1 representing the strength of association (Cramer V).

Examples

Cramer_V(c(1, 1, 1, 4, 6), c("a", "b", "c", "c", "c"))


Eta Squared Statistic for Strength of Association

Description

Computes the Eta squared statistic to quantify the strength of association between a numeric variable and another numeric variable or a grouping factor.

Usage

Eta_squared(a, b)

Arguments

a

A numeric vector representing the dependent variable.

b

A categorical or numeric vector representing the grouping variable.

Details

This measure is based on variance decomposition without relying on linear model. The second argument can be a categorical variable, which allows the function to handle both numeric and labelled inputs. Variable a is treated as the response and inserted as rows in the contingency table, while b can be treated as the grouping factor (columns). The function is compatible with both raw (elementary) data and grouped frequency distributions.

Value

A numeric value between 0 and 1 representing the Eta squared statistic.

Examples

Eta_squared(c(1, 2.5, 4, 7, 7, 11), c("a", "b", "b", "c", "d", "f"))