Eta_squared: 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)
Value
A numeric value between 0 and 1 representing the Eta squared statistic.
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.