Categorical data places observations into named groups, while continuous data records measurements on a numeric scale that can be subdivided. The distinction is not cosmetic: it determines which summary statistics are valid, which charts are honest, and which statistical tests answer your question. A mean of zip codes is arithmetic nonsense; a chi-square test on blood pressure loses information. This guide explains the mechanism behind the split, the thresholds analysts use, and the errors that survive peer review. You will learn to classify any variable correctly, choose compatible summaries, and catch the specific mistakes that make categorical and continuous data get confused.

The measurement-scale mechanism behind the split

Categorical versus continuous is the practical version of a four-level hierarchy formalized by psychologist Stanley Smith Stevens in 1946. Nominal data uses labels with no order (blood type, country). Ordinal data has ranked labels with unequal or unknown gaps (pain rated mild, moderate, severe). Interval data has equal numeric gaps but an arbitrary zero (temperature in Celsius). Ratio data has equal gaps and a true zero (weight, height, count).

The hierarchy matters because mathematical operations are only meaningful at certain levels. Adding two nominal labels produces nothing interpretable. Subtracting two interval values is valid, but ratios are not: 20 °C is not "twice as warm" as 10 °C because the zero point is arbitrary. Only ratio data supports statements like "twice as heavy." Continuous data occupies the interval and ratio levels, where a value can in principle be refined indefinitely; between 1.0 and 1.1 there are infinitely many possible readings.

A subtler mechanism is how measurement itself creates the category. Many variables are continuous in reality but recorded discretely. Age is continuous, yet registries often store whole years. That rounding converts a continuous variable into a discrete one, and the analysis must respect the loss. A patient recorded as 64 could be anywhere from 64.0 to 64.99 years old. When age is used only to define groups ("65 and older"), the data has been deliberately transformed into a categorical variable for a specific purpose—a choice with consequences covered below.

How encoding and quantiles bridge the two types

The bridge between categorical and continuous data runs through binning, and the mechanism explains why information disappears. Splitting a continuous variable at fixed cut points creates ordered categories. Body mass index, a continuous ratio measure, becomes underweight, normal, overweight, or obese at the conventional 18.5, 25, and 30 kg/m² thresholds. That transformation buys interpretability and costs resolution: everyone from 25.0 to 29.9 collapses into one group.

Quantile binning takes a different path. Quartiles split a distribution into four groups of roughly equal size, so each bin holds about 25% of observations regardless of the underlying shape. Deciles create ten bins of about 10% each. This guarantees populated categories but produces cut points that shift from sample to sample, which complicates replication. Fixed clinical thresholds are stable across studies; sample quantiles are not.

Sturges' rule offers a starting convention for histogram construction: the number of bins equals 1 + 3.322 × log₁₀(n), where n is the sample size. For 1,000 observations that yields about 11 bins; for 100 observations, about 8. The rule is a heuristic, not a law, and it exists to prevent the two classic histogram failures: too few bins that hide shape, and too many bins that manufacture noise.

Measurement precision is another encoding decision with statistical consequences. Recording weight to the nearest kilogram, rather than the nearest 0.1 kg, injects rounding error of up to half a kilogram per observation. If the true variability between subjects is small relative to that rounding interval, the discretized variable behaves more like an ordinal scale than a precise ratio measure. The variable has not changed; the instrument and recording convention have.

Where the categories cost you: power and information loss

Collapsing continuous data into groups sacrifices statistical power, and the effect is quantifiable. The most cited demonstration comes from Royston, Altman, and Sauerbrei, who showed in a 2006 paper in Statistics in Medicine that dichotomizing a continuous predictor at its median can require substantially larger samples to detect the same underlying association. Their point: an analysis that splits a continuous variable at the median throws away information about how far each observation sits from that cut point. Two patients with values just above and far above the threshold are treated identically.

The mechanism is straightforward once stated. A continuous predictor varies across its full range, so each observation contributes a gradient of information. A dichotomized predictor contributes one bit—above or below. The statistical model responds by producing wider confidence intervals, which shrink only with more data. For a fixed sample size, the dichotomized analysis is less likely to reach significance even when the true relationship is real.

This is why professional practice favors keeping variables continuous when the question is about the shape or strength of an association. Categorize when the clinical decision itself is categorical—when a treatment is indicated at a threshold, or when a guideline defines a risk band. The rule of thumb: let the decision rule dictate the category, not the convenience of the analyst.

Misconception: means are safe for every number

The recurring error is treating any numeric-looking variable as continuous and computing a mean. Consider a 0–10 pain scale. It is ordinal: the step from 0 to 1 is not guaranteed to equal the step from 9 to 10 in subjective experience. Reporting "mean pain 6.3" implies equal intervals that the scale does not supply. Yet means of pain scales are ubiquitous in clinical reporting, which makes this a professional caveat rather than a simple error. For moderate sample sizes and roughly symmetric distributions, a mean can be a reasonable approximation of the center even for ordinal data, and the approximation degrades when the distribution is skewed or the sample small.

The same principle applies to codes and identifiers. Report the mean zip code or the average hospital ID and the number you get is arithmetically valid and scientifically meaningless. Codes are nominal: the digits carry no magnitude. Any summary that adds, subtracts, or averages them is a category error wearing a number's clothing.

Red flags that a summary statistic is being asked to do the wrong job:

A mean reported for a variable that is clearly a label, code, or identifier. A standard deviation reported for an ordinal scale with unknown interval sizes. A percentage change computed on an interval scale with an arbitrary zero, such as Celsius temperature. A bar chart ordering categories alphabetically while claiming the order is meaningful. A t-test applied to counts so small that the normal approximation fails.

Each of these signals a mismatch between the data's measurement level and the method applied to it.

Choosing summaries and charts by data type

The correct pairing of data type to summary and visualization is a lookup problem, not a judgment call.

Data type Level Valid central tendency Valid spread Default chart
Nominal Categorical Mode Frequency counts Bar chart, pie (cautiously)
Ordinal Categorical Median, mode Interquartile range Ordered bar chart
Interval Continuous Mean or median SD, IQR Histogram, box plot
Ratio Continuous Mean or median SD, IQR, coefficient of variation Histogram, box plot
Binned continuous Ordered categorical Median IQR Ordered bar chart
Discrete counts Discrete Mean and median SD (when mean is large) Histogram, dot plot

Two rows deserve comment. For interval data, both mean and median are defensible; the median wins when the distribution is skewed. For discrete counts, the mean-and-SD pairing works when the mean count is large enough that the distribution is roughly symmetric—a Poisson distribution with a mean of 20 behaves well, one with a mean of 2 is heavily skewed toward zero. The threshold is not a single number but a rule of thumb tied to the shape of the count distribution.

Chart choice follows the same logic. Histograms display the shape of continuous distributions; bar charts compare category totals. A scatter plot requires both axes to be continuous. Using a line chart to connect nominal categories implies a trend that the data cannot support. These are not stylistic preferences—each chart type encodes assumptions about measurement level, and violating them misleads the viewer even when the underlying numbers are correct.

A practical decision workflow for any variable

The workflow below converts the conceptual distinction into a repeatable sequence. Apply it before any summary or test.

Ask what a unit difference means. If the distance between adjacent values has a consistent interpretation, the variable is at least interval. If not, it is ordinal or nominal. Ask whether a true zero exists. A true zero means zero of the quantity (zero weight, zero events). An arbitrary zero (zero degrees Celsius) blocks ratio statements. Decide whether binning serves a decision rule. If a guideline threshold defines who gets treated, create the category, but report the continuous distribution alongside it. Choose the summary that matches the level. For nominal data, report counts and percentages. For ordinal data, report medians and interquartile ranges. For continuous data, choose mean and SD for symmetric distributions, median and IQR otherwise. Check the rounding. Map the recorded precision of each variable and confirm the precision is fine relative to the between-subject variation. Run a sensitivity check. Repeat the key analysis with a different bin definition or a continuous version and compare conclusions.

That last step is the one most often skipped and most likely to change a result. If the finding survives a different categorization, it is robust; if it flips, the original threshold was doing the work.

Every dataset has a table of variables at the top of its codebook. That table is a map of measurement levels, and the first pass through it should classify each column before a single statistic is computed.

Limits of the categorical–continuous divide

The clean binary is a teaching device, and the honest version acknowledges where it breaks. Some variables live between the levels. A rating on a 1–5 scale is ordinal but often analyzed as interval on the assumption of roughly equal spacing, a practice that is defensible for some constructs and misleading for others. The distinction itself is not always measurable: whether a scale's intervals are equal is an empirical question that requires data most studies do not collect.

Machine learning adds a second complication. For many predictive models, the categorical-versus-continuous choice is an engineering decision—one-hot encoding versus standardized numeric input—and the model may reveal the more predictive representation. But predictive utility does not settle measurement level. A model can use zip code as a useful feature without zip code becoming a ratio variable. Analytics convenience and statistical legitimacy are different currencies, and this guide has argued for not exchanging one for the other silently.

Finally, continuous data is a modeling ideal, not a physical fact. Every instrument has finite resolution. A lab value reported to two decimal places is discrete at that resolution; the continuum is a useful fiction above the noise floor. The practical conclusion is not that all measurements are discrete, but that the sampling resolution should be known and reported, because it bounds the precision of any statistic derived from the data.