Tutorials › Regression Analysis (Undergraduate) › Separate Identifiers from Generalizable Predictors

Purpose-Driven Model Specification · Tutorial 610 of 991

Separate Identifiers from Generalizable Predictors

Learn to assess whether an identifier carries stable predictive information for the cases and settings where a regression model will be used.

Intermediate 10 min read

What You'll Learn

  • Distinguish an identifier used to locate a record from a predictor with a reusable meaning.
  • Explain why entering a numeric ID as a quantitative predictor can make results depend on arbitrary coding.
  • Assess when a site label may be useful for predictions at known sites but not at new ones.
  • Identify how names and person-specific codes can support lookup without generalizing to new individuals.
  • Match predictor choices to the model’s intended deployment cases and prediction-time information.
  • Record a clear rationale for including or excluding an identifier from a candidate model.

Why an Identifier Can Look Predictive

A data table needs labels so that its records can be found, linked, and checked. A record number, patient name, school code, or clinic label may therefore appear alongside genuine measurements. Some such labels will be associated with the outcome in the data at hand. The important question is whether that association represents information the model can use again for its intended predictions.

A regression predictor should have a meaning that can be applied consistently to the cases the model is meant to address. An identifier may instead distinguish one record, person, or site from another. It can help retrieve a known case without explaining or predicting outcomes for new cases. A site label is a useful edge case: it can identify a meaningful group and help predict at a site already represented in the data, while offering no direct information about an entirely new site.

Definition: An identifier is a label or code used primarily to distinguish, locate, or link a record, person, or group. A generalizable predictor is a variable whose meaning and measurement can be applied to the cases targeted by the model, and whose relationship with the outcome is intended to remain useful in that setting. An identifier is not automatically a generalizable predictor just because it is associated with the outcome in the observed data.

Start With the Intended Use

Before deciding how to represent a variable, specify the cases for which predictions are intended. Is the model for later records from the same people, future patients at currently observed clinics, or patients at clinics not represented in the data? A variable that identifies a known person may be available and informative for repeat predictions about that person, yet unusable for a new person. A site label may be available for a prediction at a known site but cannot supply a learned site-specific value for a new site.

The prediction-time information set matters too. A label that is created only after an outcome is recorded cannot be used for an earlier forecast. Even if it is available, an identifier needs a defensible role: its meaning, availability, and relationship to outcomes should fit the intended use. This is the same distinction between a variable being recorded and a variable being appropriate for a particular forecast.

Modeling framework: For the examples, consider candidate models for the conditional mean \(E(Y\mid X)\), where \(Y\) is the outcome and \(X\) denotes the chosen predictors. The intended prediction cases and their available information are specified first. A proposed predictor must be measurable at prediction time, have a defined meaning for the target cases, and have a relationship with the outcome that is reasonably expected to persist in the intended setting. The examples use simple mean models to illustrate specification choices; they do not establish that an association is causal or guarantee that a fitted model will predict well.

For a quantitative measurement such as temperature, a one-unit increase has the same basic interpretation wherever it is measured. A numeric record code usually does not have that property: code 204 is not necessarily one unit more of a meaningful characteristic than code 203. Treating an identifier as quantitative can therefore impose a relationship based on the numbering scheme rather than on the subject matter.

Why Arbitrary Numeric Codes Are Not Measurements

A variable recorded with digits is not necessarily quantitative. If the digits are labels, changing those labels while preserving which records they identify should not change the underlying scientific information. A regression model that treats the labels as numbers may fail this basic check: its fitted association can depend on the arbitrary order or spacing of the codes.

Worked Example: A Record Number Creates a Coding-Dependent Trend

Suppose a hypothetical process produces four records in sequence, with measured outcomes of 10, 12, 14, and 16 units. The records are assigned numeric codes. First, the codes happen to match the sequence: 1, 2, 3, and 4. Then someone assigns the same four records the codes 1, 4, 2, and 3, without changing any outcome. What happens if the code is treated as a quantitative predictor in a straight-line model?

With the sequence-matching codes, the four \((x,y)\) pairs are \((1,10)\), \((2,12)\), \((3,14)\), and \((4,16)\). The fitted slope is \(b_1=\sum (x_i-\bar{x})(y_i-\bar{y})/\sum (x_i-\bar{x})^2\). Here \(\bar{x}=2.5\) and \(\bar{y}=13\). The numerator is \((-1.5)(-3)+(-0.5)(-1)+(0.5)(1)+(1.5)(3)=10\), and the denominator is \((-1.5)^2+(-0.5)^2+(0.5)^2+(1.5)^2=5\). Thus \(b_1=10/5=2\) outcome units per code unit.

After the arbitrary reassignment, the pairs are \((1,10)\), \((4,12)\), \((2,14)\), and \((3,16)\). The means remain \(\bar{x}=2.5\) and \(\bar{y}=13\). The numerator is \((-1.5)(-3)+(1.5)(-1)+(-0.5)(1)+(0.5)(3)=4\); the denominator is still \(5\). The fitted slope is now \(4/5=0.8\) outcome units per code unit.

The outcomes did not change; only the record labels did. The apparent slope changed from 2 to 0.8. Neither slope describes a reusable effect of increasing record number if the numbering itself is arbitrary. If sequence is substantively important, the relevant predictor might instead be a measured time or process order, provided it is available and meaningful for the intended predictions.

This example illustrates a general justification. For a nominal identifier, permuting the labels should leave its scientific content unchanged. But a numeric linear term uses both label order and label spacing. Because a relabeling can change the fitted slope, that slope is not justified by the identifier’s nominal meaning. One could instead represent categories with indicators, but doing so does not automatically make an ID useful: it can amount to giving each observed category its own estimated level, with no defined value for an unseen category.

Site Labels: Useful for Some Targets, Not All

A site label differs from a unique record number because many records may share a site. The label can identify a stable setting, such as a clinic or school, and may capture real differences among known settings. Whether it belongs in a candidate model depends on the target: predictions at represented sites and predictions at new sites are different tasks.

Worked Example: Predictions at Known Clinics

Consider hypothetical measurements of a continuous outcome in three clinics. The observed outcomes are 4 and 6 units at clinic A, 8 and 10 units at clinic B, and 6 and 8 units at clinic C. Suppose the intended use is prediction for another patient at one of these same clinics, and the clinic label will be known at prediction time.

The observed clinic means are \( \bar{Y}_A=(4+6)/2=5 \), \( \bar{Y}_B=(8+10)/2=9 \), and \( \bar{Y}_C=(6+8)/2=7 \) units. A simple candidate mean model using clinic indicators, with A as the reference, is \(E(Y\mid \text{clinic})=\beta_0+\beta_B I(\text{clinic}=B)+\beta_C I(\text{clinic}=C)\). For these observed means, the corresponding values are \(\beta_0=5\), \(\beta_B=9-5=4\), and \(\beta_C=7-5=2\). The model’s predicted means are therefore 5 units for A, \(5+4=9\) units for B, and \(5+2=7\) units for C.

The example supports considering clinic as a categorical predictor for the stated target: the label is known, repeats across patients, and distinguishes settings with different observed means. It does not show that clinic itself causes the differences; other features of the clinics or their patients could account for them. It also does not give a clinic-specific prediction for a new clinic D. The model has no learned \(\beta_D\), so extending these clinic-specific means to D would require additional information or a different modeling strategy.

A clinic label may be more transferable when it is replaced or supplemented by measured characteristics with consistent meanings, such as staffing levels or available services. Those characteristics can potentially be recorded for a new clinic as well. Whether they improve prediction is an empirical and subject-matter question, but their values are at least defined beyond the sites already observed.

Names and Person-Specific Codes

A person’s name or unique patient number normally identifies who a record belongs to; it does not measure a characteristic that is comparable across people. Including a separate category for every name can let a model represent differences among already observed individuals, but those categories do not have useful learned values for new individuals. In addition, names and codes can raise privacy concerns and may act as proxies for characteristics that need careful consideration. Their apparent predictive value is not, by itself, a reason to include them.

Worked Example: A Name Helps Lookup, Not Prediction for a New Person

Suppose hypothetical training data contain repeated observations for two people. Person Lee has recorded outcomes of 48 and 52 units; person Patel has outcomes of 88 and 92 units. The intended use is to predict an outcome for a new person whose name has not appeared in the data.

For Lee, the average is \((48+52)/2=50\) units. For Patel, it is \((88+92)/2=90\) units. Across all four observations, the overall mean is \((48+52+88+92)/4=280/4=70\) units. A name-category lookup could return 50 units for Lee or 90 units for Patel, if the person is one of those already represented and the prediction task permits using that person’s earlier records. For a new person, neither name-specific average applies. The overall mean of 70 units is only a simple fallback in this illustration; it is not evidence that names provide a generalizable predictor.

If the intended target were future observations from the same people, identity could be relevant to the task, but it should be treated as person-specific information rather than as a general predictor for new people. If the target is new people, seek measurable characteristics with defined values for them instead of relying on their names or unique codes.

A Practical Decision Process

The aim is not to remove every variable that happens to be called an ID. It is to decide its role in light of how the model will be used. A group label can represent a reusable distinction for known groups; a unique record key often cannot. Use the following questions to make the reasoning explicit.

1
State the target cases.
Say whether predictions concern new records from known people, new people, known sites, or new sites. A variable’s usefulness depends on this target.
2
Check availability and meaning.
Confirm that the value will be known at prediction time and that its meaning is consistent for every target case. Ask whether it is a measurement or merely a label.
3
Ask what information it carries.
Identify a plausible, stable reason the variable could relate to the outcome. A correlation caused only by row order, data collection, or a particular batch of records may not persist.
4
Check unseen categories.
Determine what the candidate specification would do when a new person, site, or category appears. If it has no defined prediction, the model is not directly suited to that target.
5
Document the decision.
Record whether the identifier is excluded, used only for data management, or considered as a categorical predictor for a specified known-group target. State the intended use that justifies the choice.

Common Mistakes and Why the Distinction Matters

  • “It is numeric, so it is quantitative.” A patient number or record code may contain digits but still be a label. Numeric appearance does not give the values meaningful order or spacing.
  • “It predicts well in these data, so it will predict new cases.” A label can distinguish observed records perfectly while having no defined value for new cases. A pattern associated with data-entry order or a particular collection period may also fail to persist.
  • “All site labels must be excluded.” A site can be a meaningful categorical predictor for predictions at known sites. The issue is whether the intended prediction cases include sites for which the model has no learned site-specific information.
  • “A model can use any category if it is encoded.” Encoding a label does not resolve whether it is available, meaningful, stable, or defined for the target cases. A category for a new ID is not supplied merely by choosing a coding scheme.
  • “An identifier’s association establishes a mechanism.” A difference by site or person is an observed association. It does not establish that the label itself causes the outcome, nor that its association will continue in a different setting.

These distinctions affect the scope of the model’s claims and uses. A candidate specification for known clinics may be sensible for future patients at those clinics, yet unsuitable without modification for a new clinic. A model that relies on unique IDs may appear to fit familiar cases while having no principled way to handle new ones. Being explicit about the target cases makes these limits visible before a model is selected or deployed.

Key takeaway: Treat an identifier as a predictor only when its role, availability, and meaning support the intended predictions. Unique labels usually support lookup, not generalization. Group labels such as sites can be useful for known groups, but they do not automatically support predictions for unseen groups.

Check Your Understanding

For each question, explain how the intended prediction cases affect your decision.

  1. A model uses a numeric specimen number, and higher numbers tend to have higher outcomes. What should you check before treating the number as a quantitative predictor?
  2. A hospital wants predictions for next month’s patients at the same four clinics used to develop the model. How could clinic label differ in role from a unique patient number?
  3. A health network wants to use a clinic-specific model for a clinic that did not contribute data. What limitation should be identified before making that prediction?
  4. Why can a name-category model provide a value for a previously observed person but fail to provide a meaningful person-specific value for a new person?
  5. Give one example of a measurable site characteristic that could be defined for both previously observed and new sites. What makes it different from a site code?