Learn R Programming

Connection (version 0.1.0)

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.

Examples

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

Run the code above in your browser using DataLab