Titanic / Beyond accuracy
Field study 03 / Real public data / R + Python

The same data.
Three different questions.

What appears together? What predicts an outcome? And how certain are we? A historical Titanic case study, told through three analytical lenses.

891labeled historical records
712training rows / grouped CV
179held-out test rows
01 / Describe before predicting

A rate needs
a denominator.

Group averages can conceal both differences and uncertainty. These are sex-by-class summaries of the observed 891-row sample, separate from model evaluation. Every dot has a count and a Bayesian interval.

Dots: posterior means. Lines: central 95% credible intervals under a Beta(1,1) prior. Hover for observed counts.

02 / Association rules

Co-occurrence,
not causation.

Apriori asks which passenger attributes appear with a survival outcome. Rules are discovered on training rows only. Inspect confidence against the outcome baseline—not in isolation.

This page filters the exported training-only rules: support ≥4%, confidence ≥60%, joint count ≥20, lift ≥1. Change the code to remine below those bounds.

Read a rule

A high lift can reflect class, sex, family composition, or correlated characteristics. It does not identify a causal mechanism.

03 / Predictive comparison

More than
an accuracy score.

A prevalence baseline, random forest, and Bayesian logistic model share the same split. Shared ticket groups stay together. Imputation and scaling are learned inside each training fold—not from held-out rows.

The held-out comparison

MODELCV AUC / MEAN ± SDTEST AUC ↑TEST BRIER ↓TEST LOG LOSS ↓BAL. ACCURACY ↑

CV: five training-only grouped folds; SD is fold-to-fold variability, not a 95% interval. Test: 179 rows. Balanced accuracy uses a fixed 0.5 threshold. A small holdout does not establish a universal winner.

Can the model rank outcomes?

Do probabilities match frequencies?

AUC measures ranking. Brier score and log loss measure probability quality. Calibration points can be noisy when bins contain few records. These views answer different questions.
04 / Bayesian logistic regression

Show the estimate.
Show its uncertainty.

Weakly informative normal priors regularize the coefficients. A Laplace approximation describes uncertainty around the posterior mode. These are conditional associations—not the effects of changing a passenger characteristic.

Conditional odds ratios

Log scale. Vertical line: odds ratio 1. Continuous terms are per training standard deviation. Intercept omitted.

05 / Open the work

One study.
Two implementations.

The feature matrices, Bayesian mode, exact rule counts, and descriptive beta summaries can be compared across languages. Forest implementations differ, so identical forest predictions are not expected.

Start in R

RStudio project, arules, randomForest, Bayesian optimization, ggplot2, and an executed analysis narrative.

R code & instructions ↗

Read the Python edition

Scikit-learn, mlxtend, SciPy, a reproducible pipeline, and an executed Jupyter notebook.

Python code & instructions ↗

Inspect the evidence

Source provenance, the shared split, the prespecified analysis contract, and exported results.

Repository & methodology ↗
Data provenance, safeguards, and what this study cannot tell us

Public, historical data. The 891-row labeled sample is distributed by Paul Hendricks’ titanic package, whose source declares CC0. The revision and checksum are pinned. Names, cabin strings, and ticket strings are not committed. Data provenance ↗

Leakage safeguards. Shared tickets stay within groups. IDs and grouping keys never enter the predictors. Imputation, centering, and scaling use training data only, including inside validation folds. Hyperparameters and priors are fixed before looking at test results.

Selection and scope. This is not the complete ship manifest, nor a random sample for a modern application. Missing ages and historical recording choices constrain interpretation. Ticket groups do not perfectly identify families.

Descriptive, not prescriptive. Sex, class, and other observed characteristics are correlated with many unmeasured historical circumstances. No causal effect, rescue recommendation, fairness guarantee, or statistically significant model superiority is asserted.