Skip to content

compute_event_transition_matrix()

compute_event_transition_matrix() summarizes how often one event is immediately followed by another in event order.

Function Usage

python
compute_event_transition_matrix(
    eseq,
    weighted=True,
    normalize=True
)

TraMineR Parameter Mapping

  • event_sequences -> TraMineR eseq
  • weighted -> TraMineR weighted

Entry Parameters

ParameterRequiredTypeDescription
event_sequences (event_sequences)EventSequenceData / EventSequenceListThe full event-sequence dataset to summarize.
weightedboolUse sequence weights if available.
normalizeboolIf True, convert counts to row-wise probabilities.

What It Returns

A square DataFrame where:

  • Rows = source event
  • Columns = next event in order
  • Values = adjacent event-order count or row-wise probability

Example

python
tm = compute_event_transition_matrix(eseq, normalize=True)
print(tm)

R Counterpart

  • Closest R function: seqetm
  • Mapping note: This is a practical Sequenzo helper for summarizing adjacent event-to-event movements. It is related to transition-focused event-sequence workflows, but it should not be confused with the formal event-sequence definition of a transition, where a transition may contain several simultaneous events.

Notes

  • When normalize=True, each non-empty row sums to 1.
  • Use normalize=False to get raw weighted counts.

Authors

Code: Yuqi Liang

Documentation: Yuqi Liang

References

Ritschard, G., Bürgin, R., & Studer, M. (2013). Exploratory Mining of Life Event Histories. In J. J. McArdle & G. Ritschard (Eds.), Contemporary Issues in Exploratory Data Mining in the Behavioral Sciences (pp. 221-253). Routledge.