README.md

gp3sequences gp3sequences website

CRAN
status CRAN
downloads R-CMD-check pkgdown CRAN
DOI License:
MIT

Links: CRAN · Package website · Source code · Issue tracker · CRAN checks

gp3sequences is an independent R package for transparent, reproducible, and auditable analysis of ordered categorical sequences. It is designed for ordinary long-format data frames and is not restricted to Gazepoint exports, eye-tracking data, particular hardware, or proprietary software.

Installation

Install the current CRAN release:

install.packages("gp3sequences")

Install the current release version from GitHub:

pak::pak("stefanosbalaskas/gp3sequences")

The CRAN release is version 0.1.0, published on 30 July 2026. The source repository currently contains release version 0.3.0.

Current release status

The current release version is 0.3.0, building on the 0.2.0 release. The package currently exposes 81 public functions and the website provides 15 synthetic, reproducible articles.

The 0.3.0 release combines the audited sequence-data contract with consensus and group comparisons, sequence distances, clustering and stability workflows, transition networks, higher-order models, categorical and mixture hidden Markov models, longitudinal and panel workflows, bounded non-contiguous subsequences, time-varying models, multichannel and covariate-dependent HMMs, design-aware inference, extended visualisations, optional specialist-package adapters, and analysis-contract/provenance auditing.

Intended applications

Potential applications include:

Neutral long-format input

The core data contract will require configurable columns corresponding to sequence_id, sequence_order, and state. Optional participant, trial, condition, group, timing, duration, weight, and metadata columns may also be mapped explicitly.

A minimal input may look like this:

example_sequences <- data.frame(
  sequence_id = rep(c("s1", "s2"), each = 4L),
  sequence_order = rep(1:4, times = 2L),
  state = c(
    "home", "search", "product", "checkout",
    "home", "category", "product", "home"
  ),
  stringsAsFactors = FALSE
)

example_sequences
#>   sequence_id sequence_order    state
#> 1          s1              1     home
#> 2          s1              2   search
#> 3          s1              3  product
#> 4          s1              4 checkout
#> 5          s2              1     home
#> 6          s2              2 category
#> 7          s2              3  product
#> 8          s2              4     home

Current data-contract API

The core sequence-data contract provides three related functions:

audit <- audit_sequence_data(
  example_sequences,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state"
)

validation <- validate_sequence_data(
  example_sequences,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state"
)

prepared <- prepare_sequence_data(
  example_sequences,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state",
  repeated_state_policy = "preserve"
)

Analysis contracts and provenance

The 0.3.0 release adds three public functions for machine-readable capability, contract, provenance, and reproducibility auditing:

These functions complement the sequence-data contract and provide the common foundation for the 0.3.0 hardening program.

Encoding and structural summaries

Related functions support deterministic encoding and descriptive sequence summaries without assigning substantive meaning to states:

encoded <- encode_sequence_data(
  prepared$data,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state"
)

state_summary <- summarise_sequence_states(
  prepared$data,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state"
)

transition_summary <- summarise_sequence_transitions(
  prepared$data,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state"
)

paths <- format_sequence_paths(
  prepared$data,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state"
)

Contiguous motif analysis

The motif workflow enumerates contiguous state windows only and retains explicit structural definitions:

motif_occurrences <- extract_sequence_ngrams(
  prepared$data,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state",
  min_length = 2,
  max_length = 4,
  overlap = "allow"
)

motif_summary <- summarise_sequence_motifs(motif_occurrences)

motif_filter <- filter_sequence_motifs(
  motif_summary,
  min_sequences = 2,
  min_prevalence = 0.10,
  top_n = 20,
  ties = "include"
)

motif_table <- format_sequence_motifs(
  motif_filter,
  prevalence = "percent",
  digits = 1
)

Motif positions and visualisation

Motif occurrences can be summarised and plotted without adding analytical dependencies:

position_summary <- summarise_sequence_motif_positions(
  motif_occurrences,
  position = "centre",
  scale = "relative"
)

position_table <- format_sequence_motif_positions(
  position_summary,
  position_units = "percent",
  digits = 1
)

plot_sequence_motifs(
  motif_summary,
  metric = "sequence_prevalence",
  top_n = 10
)

plot_sequence_motif_positions(
  motif_occurrences,
  position = "centre",
  scale = "relative",
  top_n = 5
)

Documentation

The package website now provides 15 synthetic, reproducible articles:

The articles use ordinary data frames and synthetic data. They preserve the package interpretation boundary and do not infer psychological or causal attributes from structural sequence outputs.

Current release extensions

The 0.3.0 release includes the following explicitly governed workflows:

These extensions preserve ordinary-data-frame inputs, explicit method parameters, deterministic seeds, and structural interpretation boundaries. Inferential helpers record the independent unit and study design; observational contrasts remain associational, and randomized contrasts require valid assignment and implementation.

Interpretation boundary

Sequence outputs describe behavioural or structural patterns only. They do not independently establish emotion, cognition, comprehension, personality, intention, diagnosis, deception, or other psychological attributes. Substantive interpretation requires an appropriate study design and external evidence.

Author

Stefanos Balaskas

ORCID · Personal website · LinkedIn

Licence

gp3sequences is released under the MIT License.

Advanced sequence-analysis methods

The 0.2.0 release established:

The 0.3.0 release extends that foundation with longitudinal and panel workflows, bounded non-contiguous subsequences, time-varying models, multichannel and covariate HMMs, design-aware inference, extended visualisations, and analysis-contract/provenance auditing.

These outputs are structural and statistical. They do not independently establish emotion, cognition, comprehension, personality, intention, diagnosis, deception, causality, or other psychological attributes.



Try the gp3sequences package in your browser

Any scripts or data that you put into this service are public.

gp3sequences documentation built on Aug. 23, 2026, 5:10 p.m.