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

AnimalSequences (version 0.2.0)

transition_entropy: Calculate Transition Entropy for Sequences

Description

This function calculates the transition entropy for sequences using n-grams. It performs bootstrapping to compute entropy and expected entropy over multiple iterations.

Usage

transition_entropy(sequences, ngram = 2, iterations = 20)

Value

A data frame with calculated entropies, expected entropies, and entropy ratios for each iteration.

Arguments

sequences

A list of sequences (character vectors) to analyze.

ngram

The size of the n-gram (default is 2).

iterations

The number of bootstrap iterations (default is 20).

Examples

Run this code
sequences <- unlist(list("A B C", "B C A", "C A B"))
transition_entropy(sequences, ngram = 2, iterations = 20)

Run the code above in your browser using DataLab