What does Hidden Markov Models for Customer Decision Stages conclude, in numbers, about “Classical Sources East and West: Markov's Letter Chain in Onegin and the Chuai Chapter of the Guiguzi”?
Answer: Chapter 7 examines Markov's letter chain in Onegin of 1913 (stationary vowel share 0.4319) and the Chuai chapter of the Guiguzi (one click carries only 0.2680 bits).
Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (18 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.4319
| pairs: VV 1104 VC 7534 CV 7535 CC 3827 (total 20000) | |
| P(vowel) | 0.4319 |
| P(vowel | vowel) | 0.1278 P(vowel | consonant) = 0.6632 |
| stationary vowel share of the chain | 0.4319 |
| expected VV if letters were independent | 3730.8 |
| chi-square (1 df) | 5732.4, phi = -0.5354 |
| mean vowel run 1.147 letters, consonant run 1.508 letters | |
| next-letter class guessed right: share alone 0.5681, chain 0.7534 | |
| entropy per letter class | 0.9866 bits alone, 0.7618 given previous |
| information carried by the previous letter | 0.2248 bits |
Show the full program
# Chapter 7. p71: Markov's 1913 count of vowels and consonants.
# Data: the counts Markov reported for the first 20,000 letters of
# Pushkin's Eugene Onegin, as given in the 2006 English translation and
# in Hayes (2013): 8,638 vowels, 11,362 consonants; 1,104 vowel-vowel
# pairs and 3,827 consonant-consonant pairs. The two mixed pair counts
# follow from the totals (the text treated as one closed ring of
# 20,000 pairs). Computed: the two-state chain, its stationary vowel
# share, a chi-square test of independence, mean run lengths, and how
# well each model predicts the next letter's class.
import math
N, V, C = 20000, 8638, 11362
VV, CC = 1104, 3827
VC = V - VV
CV = C - CC
p_v = V / N
p_vv = VV / V
p_cv = CV / C
print("pairs: VV %d VC %d CV %d CC %d (total %d)"
% (VV, VC, CV, CC, VV + VC + CV + CC))
print("P(vowel) = %.4f" % p_v)
print("P(vowel | vowel) = %.4f P(vowel | consonant) = %.4f"
% (p_vv, p_cv))
stat = p_cv / (p_cv + (1 - p_vv))
print("stationary vowel share of the chain: %.4f" % stat)
obs = [[VV, VC], [CV, CC]]
rows, cols = [V, C], [V, C]
chi = math.fsum((obs[i][j] - rows[i] * cols[j] / N) ** 2
/ (rows[i] * cols[j] / N) for i in range(2) for j in range(2))
phi = (VV * CC - VC * CV) / math.sqrt(V * C * V * C)
print("expected VV if letters were independent: %.1f" % (V * V / N))
print("chi-square (1 df) = %.1f, phi = %.4f" % (chi, phi))
print("mean vowel run %.3f letters, consonant run %.3f letters"
% (1 / (1 - p_vv), 1 / (1 - (1 - p_cv))))
acc_marg = max(V, C) / N
acc_chain = (VC + CV) / N
print("next-letter class guessed right: share alone %.4f, chain %.4f"
% (acc_marg, acc_chain))
def h(ps):
return -math.fsum(p * math.log2(p) for p in ps if p > 0)
h0 = h([p_v, 1 - p_v])
h1 = p_v * h([p_vv, 1 - p_vv]) + (1 - p_v) * h([p_cv, 1 - p_cv])
print("entropy per letter class: %.4f bits alone, %.4f given previous"
% (h0, h1))
print("information carried by the previous letter: %.4f bits" % (h0 - h1))Single source and citation
Fan, Y. (2026). Hidden Markov Models and Viterbi Decoding: Inferring a Customer's Hidden Decision Stage from Click Sequences and Timing the Offer (Version 1.0.0), Chapter 7: Classical Sources East and West: Markov's Letter Chain in Onegin and the Chuai Chapter of the Guiguzi. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-300 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026300,
author = {Fan, Yafu},
title = {Hidden Markov Models and Viterbi Decoding: Inferring a Customer's Hidden Decision Stage from Click Sequences and Timing the Offer},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · The Last-Click Illusion: Whole Sequences against a Single Page
- Chapter 2 · The Viterbi Trellis: Dynamic Programming in Logarithms, Backtracking and Underflow
- Chapter 3 · Forward and Backward: Posterior Marginals, the Best Path and "Wait Two More Clicks"
- Chapter 4 · Baum–Welch: Estimating Parameters from Unlabelled Clickstreams
- Chapter 5 · Identifiability and Label Switching: What Clickstreams Cannot Say
- Chapter 6 · Timing the Offer: the Inquiry as Evidence, a Cost Threshold and Calibration
- Chapter 8 · Closing the Loop: a Weekly Stage Review, the Customer Stage Decoder and Pre-Registered Tests