5  Seeing the Tail

The core diagnostic toolkit, introduced as a way of looking rather than computing:

import matplotlib.pyplot as plt

def survival_loglog_plot(data):
    sorted_data = sorted(data, reverse=True)
    n = len(sorted_data)
    ranks = [i / n for i in range(1, n + 1)]
    plt.loglog(sorted_data, ranks, marker=".", linestyle="none")
    plt.xlabel("x (log)")
    plt.ylabel("P(X > x) (log)")

Readers build histograms, CCDFs, rank-frequency plots, and QQ plots against a Gaussian reference, then run all four on the same dataset and compare what each one reveals (or hides). The chapter ends with a caution that Part III will return to hard: a roughly straight line on a log-log plot is suggestive, not proof.