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
seqdata✓SequenceDataInput sequence dataset.
weighted✗boolUse sequence weights.
with_missing✗boolInclude 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.

Returns ​

pd.DataFrame.

Examples ​

python
from sequenzo import get_modal_state_sequence

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

R Counterpart ​

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

See Also ​

Authors ​

Code: Yuqi Liang

Documentation: Yuqi Liang

Sequenzo is released under the BSD-3-Clause License; this documentation site source is licensed under MIT.