Stage 2 summary. Modelling and statistics
Modelling and statistics is where structure and evidence meet. The first half asks how data should be shaped so that a stored fact has one version and a query means one thing: the relational schema that protects writes, the dimensional schema that serves reads, and the harder problem of deciding that two records describe the same person when nothing in either says so. The second half asks what a number is allowed to support, through distributions, the mathematics model training runs on, statistical inference, and the discipline that keeps a machine learning result honest once real users reach it.
One habit connects both halves: somebody has to write down what a row means and defend it. A fact table with an undeclared grain, a linkage threshold nobody owns, a summary statistic chosen without looking at the shape of the data, and a model evaluated on rows that leaked into its own training set are one failure in four costumes, an unstated assumption that stays invisible until the arithmetic diverges.
What you carry out of this stage
- Read an entity-relationship sketch, explain what a key guarantees, and say why a natural key eventually betrays the model that trusted it
- Normalise a small schema to third normal form and name the three anomalies it removes
- Design a star schema with one fact and three dimensions, starting from a written grain
- Place one big table and the data vault against the star on the change-cost and query-cost axes
- Explain probabilistic record linkage at the Fellegi and Sunter level of intuition, and say who owns the threshold
- Use vectors, matrices, gradients, Bayes and entropy to read what a model is doing rather than only what it outputs
- Choose a summary statistic from the shape of the distribution, and rule out alternative explanations before calling a correlation evidence
- Read a confidence interval, state what a p-value is and is not, and design an A/B test that survives review
- Separate training, validation and test discipline from leakage, and name what changes when a model reaches production
Stage 2 route: from structure to uncertainty
Stage 2 runs in two halves: modules one to three give the facts a shape you can query and modules four to seven say how sure you are of what that shape returns, and they run in that order because shape without uncertainty produces confident nonsense.
Stage 2 runs in two halves. The first gives the facts a shape you can query; the second says how sure you are about what the shape returns. Skip either half and the other one misleads you.
Conceptual, logical and physical models answer three different questions
Modelling runs at three levels and confusing them makes design conversations circular. The conceptual model names the real-world things and how they relate: a customer places orders, an order contains products. The logical model expresses that as attributes, keys, relationships and constraints, without committing to a database product. The physical model decides table names, column types, indexes and partitioning. The hard work is nearly always conceptual. Customer is easy to say and difficult to model, because whether a customer is a person, a household, an account or a supply point decides how many customers the organisation has and how consent applies.
A primary key guarantees that one row identifies one thing, and a foreign key lets the database refuse a reference to something that does not exist. A natural key uses a real-world value such as an email address or a product code, and it betrays the model as soon as that value changes, is reused, turns out not to be unique, or has to be redacted. A surrogate key is an internal identifier no business process can revise, which is why it survives. Operations and analytics model the same subject differently on purpose, one shaped to keep concurrent writes correct and the other to answer questions over large scans.
Third normal form protects writes, the star schema serves reads, and the grain decides both
Normalisation organises a schema so each fact is stored in exactly one place. First normal form requires every cell to hold a single value; second normal form requires every non-key column to depend on the whole key rather than part of it; third normal form requires that no non-key column is determined by another, which moves a city determined by its postcode into its own table. What that buys is the removal of three anomalies: an update landing on some copies of a fact and not others, an insertion that cannot be made because the fact has nowhere to live, and a deletion that takes the last record of something with it. The cost is joins, fair for small keyed reads and poor for scans over hundreds of millions of rows.
Analysis wants a different shape. A star schema puts one fact table of measurements at the centre with descriptive dimensions around it, and no dimension joins another. The first decision is the grain: a written statement of what one fact row represents, such as one row per order line. It is declared before any column is chosen, because it settles which measures may be added up and which dimensions can join. An order-level discount summed at order-line grain is counted once per line, which is the arithmetic behind two dashboards that agree for eleven months and then differ by four per cent. Dimensions that change over time force a second decision, between overwriting an attribute and versioning it, and the wrong answer is leaving it unmade. One big table folds the star flat into the easy-to-query, expensive-to-change corner: defensible as a serving artefact rebuilt from a modelled core, damaging as the only place meaning is defined. A data vault earns its complexity when many sources describe the same entities and every attribute must trace to its load.
One fact table, four dimensions, and one grain stated first
One fact table states the grain, one row per order line per day, and four dimensions hang off its join keys, so the grain settles both which measures may be added up and which dimension is allowed on the table at all.
A star schema is one fact table at a stated grain with one dimension on each join key. State the grain first: it settles which measures may be added up and which dimensions can join the fact at all.
Without a shared identifier, deciding two records are one person is a statistical judgement
Master data is the small set of entities many systems must refer to consistently: customers, patients, suppliers, products, sites, assets. Transactional data records events and nearly always points at one of them. Reference data is the controlled list of permitted values, with a publisher and a version, and two systems holding different vintages of it produce joins that are wrong in ways that look plausible. The test is what breaks when a value changes: a transaction correction fixes one event, a reference code change reclassifies a population, and a master data change alters who the organisation thinks it is dealing with. Entity resolution is deciding which records describe the same real thing, and it is hard because the systems at the seams were never asked to share a key. Names vary lawfully, addresses vary structurally and dates of birth are mistyped.
The chain has five steps: standardise every field, block so only pairs agreeing on something cheap are compared, compare each field on a scale rather than as equal or not, score the agreement pattern into one number, and decide against a threshold. Fellegi and Sunter set out the intuition in 1969. A field's weight is the ratio between how often it agrees for a true pair and how often it agrees by chance, so a rare surname carries evidence and a common forename almost none. Blocking is the step whose errors are invisible, because a pair never generated cannot appear in any precision measurement. The threshold is a business decision rather than a statistical output, since a false match gives one person another's history while a missed match leaves a vulnerable customer flag on the record nobody reads. Splink, the Ministry of Justice's open library, is the worked public-sector implementation.
From duplicate records to one golden record through one gate
Standardise, block, compare and score end at a gate with two routes, and the grey band is the second one, so a pipeline drawn with only the automatic route has to set a threshold that either merges two people or leaves one person split in two.
Entity resolution is standardise, block, compare and score, then a gate with two routes: link the confident matches and send the grey band to a person who rejoins the same link step. A pipeline with only the automatic route merges the wrong people quietly.
Vectors, matrices, gradients, Bayes and entropy are the machinery under the tools
A vector is an ordered list of numbers standing for a thing, which is what an embedding is. A matrix is a table of them, which is what a dataset is, and multiplying a data matrix by a weight matrix is the core computation inside a regression, a neural network layer and a principal component analysis alike. The dot product measures how far two vectors point the same way, which is why users with similar preference vectors get similar recommendations. Training is then optimisation: a loss function scores how wrong the predictions are, and each step moves the parameters against the gradient by a distance set by the learning rate.
Two ideas do the reasoning work on top of that. Bayes' theorem updates a belief in light of evidence, which is why a test with a high detection rate still produces mostly false alarms when the condition is rare: the prior matters as much as the test. Entropy measures how much uncertainty a distribution holds, which is a way to say how much a feature tells you rather than how strongly it correlates. Neither is needed to run a library, and that is the point: they are what let a practitioner see why an accuracy figure on a rare event is close to meaningless.
The shape of a distribution decides which summary is honest
A distribution describes how values spread, and the shape decides which statistics can be trusted. On an approximately normal distribution the mean, median and mode sit close together and the 68, 95 and 99.7 rule holds across one, two and three standard deviations. Income, house prices, insurance claims and outage durations are usually not normal, and the same rule applied to them understates the tail badly. When incident duration has a mean of 62 minutes and a median of 18, both numbers are true and answer different questions: the median describes a typical incident, the mean warns that rare severe events dominate total exposure.
Correlation is the half that gets misused. The Pearson coefficient runs from minus one through zero to plus one and measures the strength and direction of a linear relationship, nothing more. Ice cream sales and drowning rates rise together because temperature drives both, and a model treating one as the cause recommends the wrong intervention. The working test is not whether two variables move together but what else could make them: confounding, reverse causation, selection bias, seasonality or a change in measurement. Until those are ruled out a correlation is a reason to investigate rather than permission to act, and establishing cause needs a controlled experiment, a credible natural experiment, or an observational design whose assumptions are written down.
Distribution shape decides which summary statistic is honest
Symmetric data can be summarised by the mean, skewed data needs the median, heavy tails need percentiles as well, bimodal data needs splitting, and a mean quoted on skewed data sits above where half the cases actually are.
The honest summary statistic depends on the distribution shape. Symmetric: mean. Skewed: median. Heavy-tailed: median plus percentiles. Bimodal: split the report. Picking the wrong summary distorts the claim; the NIST Engineering Statistics Handbook §1.3.5 lays this out.
A p-value answers a narrow question, and the design has to be fixed before the data arrives
An A/B test is a randomised comparison, and randomisation is what makes the groups comparable before the change is applied. Five requirements make the result worth acting on: random assignment, a single changed variable, a sample size fixed by a power calculation against a stated minimum detectable effect, a hypothesis and success metric agreed in advance, and a duration covering weekday, weekend and payday variation. Stopping early because one arm looks ahead turns an intended five per cent false positive rate into something several times larger.
A p-value answers one narrow question: if there were no real difference, how unusual would a result this extreme be under the model's assumptions. It is not the probability that the treatment works, and 0.049 is not meaningfully different from 0.051. The American Statistical Association's 2016 statement was written against that binary reading. Two p-hacking patterns are worth naming: testing many variants and reporting only the one that cleared the threshold, since five tests at five per cent give roughly a 23 per cent chance of one false positive, and changing the outcome measure after seeing the data. A confidence interval shows the range of effects the data is consistent with. The evidence chain that survives challenge runs from the population sampled, through the measure and the design, to the effect size and its uncertainty, and then to a claim stated no more strongly than that chain supports.
Inference scope bounded on population, time, treatment, outcome
A finding holds only inside the four bounds the study set, population, time, treatment and outcome, and a claim that leaves any one of them unstated has quietly been stretched past the study that produced it.
Every inference is bounded on four axes: population (who the sample represents), time (when the data was gathered), treatment (what was actually tested), outcome (what was measured). Stretching any axis beyond the study is extrapolation. The ASA 2016 statement makes this explicit; bounded claims survive replication, unbounded claims do not.
Generalisation is the whole test, and shipping a model changes what can go wrong
Analytics forms a ladder of questions. Descriptive work says what happened, diagnostic work says why, predictive work estimates what is likely next, and prescriptive work recommends an action and so carries the consequence of being followed. Machine learning problems sort by the learning signal: supervised learning pairs inputs with correct outputs, covering classification and regression; unsupervised learning finds structure without labels, through clustering, dimensionality reduction and anomaly detection; reinforcement learning optimises actions against a reward; and self-supervised learning derives its labels from the data itself.
Evaluation is where projects are won or lost. A model that fits training data including its noise scores highly there and fails on anything new, which is overfitting; one too simple to capture the structure scores poorly on both, which is underfitting. The defence is a genuine separation of training, validation and test data, cross-validation when data is scarce, and vigilance about leakage, where information unavailable at prediction time reaches the model and produces a score that cannot be reproduced. A confusion matrix makes the choice of error explicit: precision matters when a false positive is costly, recall when a missed case is. Once a model ships the distribution drifts from the one it learned, which is why monitoring, a rollback path and a named owner belong in the design. Stage 4 takes up the AI-specific risks, and EU AI Act Article 10 sets what high-risk systems must show about their data.
The traps this stage warns against
Building a fact table without writing down what one row represents, because the team all know what a sale is.
Instead: Declare the grain on the face of the model before choosing a single column. It is what decides which measures may be summed and which dimensions can join, and an undeclared grain surfaces as an unexplained gap between two reports months later.
Keying a dimension on a natural business value such as an email address or a product code because it is already unique.
Instead: Use a surrogate key that no business process can revise, and keep the natural value as an attribute. Real-world identifiers change, get reused, turn out not to be unique and sometimes have to be redacted.
Letting the team that built the linkage pipeline choose the match threshold.
Instead: The threshold trades a false match against a missed match, and the costs are not symmetric. It belongs to the person who can describe what a wrong link does to a real person, and the setting and its reason should be recorded alongside the model version.
Tuning the matching model until the manual review queue disappears.
Instead: Shrink it, but keep it. Twins at one address, a parent and child sharing a forename, or a new tenant at a former customer's flat are genuinely undecidable from the available fields, and removing the queue hides the uncertainty inside an automatic decision nobody can appeal.
Reporting a mean because it is the default summary in the tool.
Instead: Look at the shape first. On a skewed distribution the median describes the typical case and the mean describes total exposure, so report both and say which question each answers.
Reading a p-value of 0.04 as a 96 per cent chance that the treatment works.
Instead: It is the probability of data at least this extreme if there were no effect, under the model's assumptions. Report the effect size and its confidence interval, and decide on whether the effect is large enough and reliable enough to act on.
Trusting a validation score produced after cleaning, imputing or feature-engineering across the whole dataset.
Instead: Split first, then fit every transformation on the training portion alone. Information that crosses the split, including anything unavailable at prediction time, produces a score that will not survive contact with real traffic.
Core distinctions
- A conceptual model names the things, a logical model names attributes, keys and constraints, and a physical model names the implementation
- A natural key carries business meaning and can change; a surrogate key carries none and therefore survives
- Third normal form removes update, insertion and deletion anomalies and costs joins; a star schema pays duplication to remove them
- The grain is a written statement of what one fact row represents, and it decides both which measures are additive and which dimensions can join
- Deterministic matching says a field agrees or it does not; probabilistic linkage says how much that agreement should move your belief
- The match score is a statistical output and the threshold is a business decision, so they belong to different people
- Correlation measures how two variables move together; causation requires ruling out confounding, reverse causation, selection and measurement change
- A p-value is the probability of data this extreme if there were no effect, not the probability that the effect is real
- Overfitting is high training accuracy with poor validation accuracy; leakage is a validation score that was never earned because the answer was in the features
Stage 2 leaves you with two disciplines that reinforce each other: shaping data so a stored fact has one version and a query has one meaning, and treating a number as evidence only as far as its design and its uncertainty allow. The scenario practice now applies both to situations where a defensible answer and a comfortable one differ, which is where a declared grain, an owned threshold and an honest interval start doing visible work.
Sources and further reading
- E. F. Codd, A Relational Model of Data for Large Shared Data BanksThe 1970 paper behind data independence and normalisation, and the reason the relational model outlived the storage it ran on.
- Codd, Further Normalization of the Data Base Relational ModelWhere second and third normal form are defined, through partial and transitive dependencies.
- Splink: probabilistic record linkage at scaleThe Ministry of Justice's account of its open linkage library, the worked public-sector implementation of the resolution chain.
- The Government Data Quality FrameworkThe uniqueness dimension that entity resolution exists to serve, and the only dimension you cannot measure without first deciding what counts as a duplicate.
- ASA Statement on Statistical Significance and P-ValuesThe 2016 statement against binary readings of p-values and the practices that inflate false positives.
- Kohavi, Tang and Xu, Trustworthy Online Controlled ExperimentsThe practitioner reference behind the A/B design requirements, power calculations and early-stopping failures.
- MIT OpenCourseWare 18.06, Linear AlgebraThe vector and matrix machinery that embeddings, regression and neural network layers all run on.
- Regulation (EU) 2024/1689, Article 10: Data and data governanceWhat a high-risk AI system must be able to show about its training, validation and testing data, taken up in Stage 4.