Skip to contents

Overview

transitiontrees transitiontrees-package
transitiontrees: Transition Trajectories and Dynamics of Variable-Length Pathways or Sequences

Fitting

Fit a variable-order transition tree from wide sequences, event logs or network objects, prepare long logs, and re-smooth or prune a fitted tree.

context_tree()
Fit a variable-order transition tree
prepare_input()
Reshape a long event log into one sequence per row
smooth_tree()
Re-smooth the next-state probabilities of a fitted tree
prune_tree()
Prune a transition tree to the contexts that change the prediction
compare_smoothing()
Compare smoothing schemes on one dataset
compare_pruning()
Compare pruning criteria on one tree

Pathways

Ranked tables of the contexts a tree holds, the state distribution, and lookups of single pathways.

tree_pathways()
List the pathways of a fitted transition tree
common_pathways()
List the most frequent pathways of a tree
divergent_pathways()
List the pathways whose history most changes the prediction
sharp_pathways()
List the pathways with the most certain next state
tree_dependence()
Measure how much each step of history changes the prediction
state_frequencies()
Count how often each state occurs
query_pathway()
Look up the next-state distribution after a pathway
pathway_exists()
Test whether a pathway is a context of the tree
subtree()
Extract the branch of a tree below one context

Fit and selection

In-sample and held-out fit, information criteria, perplexity and cross-validated selection of depth, minimum count, smoothing and pruning.

model_fit()
Summarize the fit of a transition tree
logLik(<transitiontrees>)
Compute the log-likelihood of a transition tree
nobs(<transitiontrees>)
Count the observations a transition tree was fitted on
perplexity()
Compute the perplexity of a transition tree
n_nodes()
Count the contexts of a transition tree
tune_tree()
Select context tree settings by cross-validated perplexity

Prediction and scoring

Next-state prediction, scoring of held-out sequences, simulation, imputation of gaps and mining of unusual contexts and sequences.

predict(<transitiontrees>)
Predict the next state after each history
score_sequences()
Score each sequence under a fitted tree
score_positions()
Score each position of each sequence under a fitted tree
generate_sequences()
Generate sequences from a fitted transition tree
simulate(<transitiontrees>)
Simulate sequences from a fitted transition tree
impute_sequences()
Fill in missing states of incomplete sequences
mine_contexts()
Find the contexts that make a given next state likely or unlikely
mine_sequences()
Find the least and most typical sequences

Reliability and comparison

Bootstrap stability of pathways, the distance between two trees, and permutation tests between two or more groups.

bootstrap_pathways()
Bootstrap the stability and informativeness of pathways
tree_distance()
Compute the divergence between two context trees
compare_trees()
Test whether two context trees differ, with a permutation test
compare_groups()
Test where groups of sequences differ, context by context

Plots of a tree

The fitted tree as a horizontal tree, dendrogram, sunburst or interactive network, and displays of its pathways, distributions, forward trajectories and pruning decisions.

plot(<transitiontrees>)
Plot a context tree
plot(<transitiontrees_group>)
Plot the context tree of each group
plot_pathways()
Plot pathways as a heatmap of next-state probabilities
plot_divergence()
Plot the pathways whose history changes the prediction most
plot_distributions()
Plot the next-state distribution of each context
plot_predictive()
Plot how well a context tree predicts new sequences
plot_trajectories()
Draw a forward trajectory tree
plot_pruning()
Plot how much memory one pathway needs
plot_difference()
Map the next-state differences between two groups

Plots of inference results

Displays of bootstrap, comparison and tuning results.

plot(<transitiontrees_bootstrap>)
Plot bootstrap intervals of pathway informativeness
plot_pathway_resamples()
Plot the bootstrap distribution of pathway statistics
plot(<transitiontrees_comparison>)
Plot the permutation distribution of a two-tree comparison
plot(<transitiontrees_group_comparison>)
Plot the context-level differences between groups
plot(<transitiontrees_tune>)
Plot the cross-validated perplexity of a tuning grid

Result accessors

Tidy tables and summaries of fitted trees and inference results.

as.data.frame(<transitiontrees>)
Convert a fitted transition tree to a data frame of contexts
as.data.frame(<transitiontrees_group>)
Convert a group of transition trees to one data frame of contexts
as.data.frame(<transitiontrees_bootstrap>)
Convert a pathway bootstrap to a data frame
as.data.frame(<transitiontrees_comparison>)
Convert a two-tree comparison to a data frame
as.data.frame(<transitiontrees_group_comparison>)
Convert a group comparison to a data frame
as.data.frame(<transitiontrees_tune>)
Convert a tuning grid to a data frame
summary(<transitiontrees>)
Summarize a fitted transition tree
summary(<transitiontrees_group>)
Summarize a group of fitted transition trees
summary(<transitiontrees_bootstrap>)
Summarize a pathway bootstrap
summary(<transitiontrees_comparison>)
Summarize a two-tree comparison
summary(<transitiontrees_group_comparison>)
Summarize a group comparison
summary(<transitiontrees_tune>)
Summarize a tuning grid
print(<transitiontrees>)
Print a fitted transition tree
print(<transitiontrees_group>)
Print a group of fitted transition trees
print(<transitiontrees_bootstrap>)
Print a pathway bootstrap
print(<transitiontrees_comparison>)
Print a two-tree comparison
print(<transitiontrees_group_comparison>)
Print a group comparison
print(<transitiontrees_tune>)
Print a tuning grid
print(<summary.transitiontrees>)
Print the summary of a transition tree
print(<summary.transitiontrees_group>)
Print the summary of a group of transition trees
print(<summary.transitiontrees_comparison>)
Print a summary of a two-tree comparison
print(<summary.transitiontrees_group_comparison>)
Print a summary of a group comparison
print(<summary.transitiontrees_tune>)
Print a summary of a tuning grid

Data

Engagement trajectories, collaborative regulation events and human-AI collaboration messages.

trajectories
Student engagement trajectories
engagement
Student engagement sequences (wide format)
group_regulation_long
Regulation of collaborative learning (long event log)
ai_long
AI turns in human-AI programming sessions (long event log)