Skip to content

get_modal_state_sequence()

get_modal_state_sequence() computes the modal (most frequent) state at each time position.

Function Usage

python
from sequenzo import get_modal_state_sequence
result = get_modal_state_sequence(seqdata, weighted=True, with_missing=False)

Entry Parameters

ParameterRequiredTypeDescription
seqdataSequenceDataInput sequence dataset.
weightedboolUse sequence weights.
with_missingboolInclude missing values in modal computation.

What It Does

  • Finds the most frequent state at each time point.
  • Supports weighted modal computation.
  • Returns a DataFrame describing the modal sequence over time.

Examples

python
from sequenzo import get_modal_state_sequence

modal = get_modal_state_sequence(seqdata, weighted=True)
print(modal)

R Counterpart

  • Closest TraMineR function: seqmodst
  • Mapping note: This is a direct conceptual match; Sequenzo wraps modal-state computation with optional weighting and missing-state handling.

Authors

Code: Yuqi Liang

Documentation: Yuqi Liang