50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

relen (version 1.0.1)

relen: Compute Relative Entropy

Description

This function computes the relative entropy (H) as an index for qualitative variation of a factor. Any factor can be used as argument. H ist computed as follows: H = (-1/ln(k))*sum(hj*ln(hj))

Usage

relen(x)

Arguments

x
A factor with k levels.

Value

The output will be between 0 and one whereas 0 means minimum variation (all units are in one category).

References

Eid, M., Gollwitzer, M. & Schmitt, M. (2013). Statistik und Forschungsmethoden (3 korr.Auflage) Weinheim: Beltz. p105ff

Examples

Run this code
relen(iris$Species)
  

Run the code above in your browser using DataLab