Manuel B. Garcia

Manuel B. Garcia serves as the Senior Director for Educational Technology and Digital Learning at FEU Institute of Technology, Manila, Philippines. Read More

Contact Info

1607, FEU Tech Building,
P. Paredes St, Sampaloc,
Manila, Philippines
mbgarcia@feutech.edu.ph

Follow Me

Should Prediction Models Be Developed and Validated in the Same Dataset?

Prediction models can be developed and internally validated using the same dataset, but evaluating a fitted model on its training observations does not establish independent predictive performance. Learn how bootstrapping and cross-validation estimate optimism, why random splitting is often inefficient, and when external validation is necessary.

451
Developing and Validating Prediction Models in the Same Dataset Guide 451 of 1272
01 · The Question

Can You Use One Dataset to Build a Prediction Model and Demonstrate That It Works?

You have collected a dataset containing candidate predictors and observed outcomes. You fit a regression model or machine-learning algorithm, calculate its predictive performance, and obtain encouraging results. The model appears to distinguish individuals with different outcomes reasonably well.

But the same participants contributed to both model development and performance evaluation. Does this mean the model has been validated?

Perhaps you could randomly divide the dataset into training and testing subsets. Alternatively, you might use bootstrapping or cross-validation. Each approach seems to provide some form of evaluation, but they do not necessarily answer the same question.

The methodological issue is whether the available data can support an assessment of predictive performance that accounts for the information used to develop the model, and whether that assessment establishes performance beyond the original data source.

02 · The Short Answer

Yes for Internal Validation, but Not for Independent External Validation

In Brief

Prediction models can be developed and internally validated using the same overall dataset, provided the validation procedure appropriately separates model fitting from evaluation and accounts for the complete development process. However, evaluating a model on the observations used to fit it produces apparent performance, not independent validation.

Bootstrapping and cross-validation can estimate optimism and assess performance within the development data source. External validation requires independent observations not used in model development or optimization. The distinction matters because satisfactory internal validation does not establish that a model will perform adequately in a different population, institution, or time period.

03 · What You Need to Know

How Development Data Can Support Validation Without Proving Generalizability

What Does It Mean to Develop and Validate a Model?

Model development involves constructing a prediction function from observed relationships between predictors and outcomes.

For a logistic regression model, development typically includes estimating an intercept and predictor coefficients. For a machine-learning model, it may include learning parameters, choosing hyperparameters, selecting features, and determining preprocessing procedures.

Validation evaluates how well the resulting prediction function performs when applied to observations that were not used to fit or optimize that particular model.

However, validation is not a single interchangeable activity. Internal validation and external validation address different forms of uncertainty.

Researchers should therefore distinguish prediction model development, validation, and updating before deciding how the available observations will be used.

What Is Apparent Performance?

Apparent performance is calculated by applying a fitted model to the same observations used to develop it.

For example, researchers may fit a logistic regression model to 800 participants and calculate its area under the receiver operating characteristic curve using those same 800 participants.

This result describes how well the model fits and predicts within the development sample. It does not provide an independent assessment of how the model will perform in new observations.

Apparent performance is often optimistic because model fitting can capture sample-specific patterns in addition to reproducible predictor-outcome relationships.

The extent of optimism depends on model complexity, sample size, outcome frequency, predictor selection, tuning, and other development decisions.

Apparent performance is useful to report, but it should be identified accurately rather than presented as validation.

Why Is Evaluating a Model on Its Training Data Problematic?

A model is constructed to fit relationships observed in its development data. Some of those relationships reflect genuine patterns, while others arise from random variation.

Flexible modeling methods may capture these chance patterns particularly readily when the available information is limited relative to model complexity.

When performance is evaluated using the same observations, the model benefits from having already encountered their outcomes during development.

Its discrimination, calibration, or prediction error may therefore appear more favorable than would be observed in new participants.

This is a manifestation of overfitting.

Overfitting is not restricted to machine learning. Conventional regression models can also overfit, particularly when many candidate parameters are considered or extensive data-driven selection is performed.

What Is Internal Validation?

Internal validation uses the development dataset to estimate how well the modeling procedure may perform beyond the observations used for fitting.

It commonly relies on resampling or data partitioning to create repeated opportunities for model development and evaluation.

Appropriate methods include bootstrapping and cross-validation. A single random training-testing split is another form of internal assessment, although it can be inefficient and unstable in smaller datasets.

Internal validation is particularly valuable when independent external data are not yet available.

However, its conclusions remain conditional on the characteristics and data-generating processes represented in the original dataset.

It cannot establish that predictor relationships, measurement procedures, or baseline risks will remain unchanged elsewhere.

What Is Bootstrap Internal Validation?

Bootstrap validation repeatedly draws samples with replacement from the development dataset.

Within each bootstrap sample, researchers repeat the model-development procedure and evaluate the fitted model's performance both in that sample and in the original data.

The difference between these performance estimates can be used to estimate optimism associated with the development process.

Average optimism across bootstrap repetitions can then be used to adjust apparent performance estimates.

For example, the optimism-corrected AUC may be calculated by subtracting estimated average optimism from the apparent AUC.

The bootstrap procedure must reproduce relevant development decisions, including predictor selection and tuning, if the resulting optimism estimate is intended to reflect those decisions.

Simply bootstrapping a final model after ignoring an extensive selection process may underestimate the uncertainty introduced during development.

How Is Bootstrap Optimism Correction Calculated?

Illustrative Bootstrap Optimism Correction
Optimism = Mean(Performancebootstrap − Performancetest)
Performancebootstrap is the performance of a model developed and evaluated in its bootstrap sample. Performancetest is the performance of that bootstrap-developed model evaluated in the original dataset. This formulation applies to measures for which larger values indicate better performance.
Suppose the apparent AUC of the final model is 0.82 and the average bootstrap-estimated optimism is 0.04. The optimism-corrected AUC is 0.82 − 0.04 = 0.78. These hypothetical values illustrate the calculation, not a guarantee of future performance.

For error measures where smaller values indicate better performance, the direction of the correction must be handled appropriately.

Bootstrap validation also involves assumptions about the representativeness of the development sample. It does not automatically correct systematic selection bias or measurement error.

What Is Cross-Validation?

Cross-validation divides the available observations into subsets, commonly called folds.

In k-fold cross-validation, the model is fitted using k minus one folds and evaluated in the remaining fold. The procedure is repeated so that each fold serves as the evaluation subset.

The results are then combined to estimate performance under the chosen resampling procedure.

Cross-validation can be useful for estimating predictive performance and selecting model hyperparameters.

However, using the same cross-validation results both to optimize a model and to report its final performance can introduce selection-related optimism.

Nested cross-validation or another appropriately separated evaluation strategy may be necessary when extensive tuning or model comparison is performed.

Why Must Preprocessing Be Included Within Validation?

Data preprocessing can use information from the dataset even when it does not involve fitting the final prediction equation.

Examples include missing-data imputation, variable selection, scaling, transformation, dimensionality reduction, and hyperparameter tuning.

If preprocessing is estimated using all observations before cross-validation, information from evaluation folds may influence the models being assessed.

For example, selecting predictors using outcome associations calculated from the complete dataset before dividing it into folds allows validation outcomes to influence feature selection.

This is a form of information leakage.

Where preprocessing involves learned parameters or outcome information, it should generally be performed within the training portion of each resampling iteration, with the learned procedure applied to the corresponding evaluation observations.

The precise implementation depends on the preprocessing method and the prediction task.

Is a Random Train-Test Split a Form of External Validation?

Ordinarily, no. A random split divides observations from the same source dataset into development and evaluation subsets.

Although the test observations are not used directly to fit the model when the procedure is conducted correctly, both subsets generally represent the same underlying population and measurement processes.

The test set therefore provides an internal assessment of performance within that source.

It does not necessarily reveal problems that arise when the model is applied to another hospital, university, geographic region, or calendar period.

The distinction is important because independent observations are not automatically equivalent to independent settings.

Why Can a Single Random Split Be Inefficient?

A random split reserves part of the available dataset for testing, reducing the number of observations and outcome events available for model development.

For example, a 70:30 split leaves only 70% of observations for fitting the model.

If the outcome is uncommon, the test subset may contain relatively few events, producing imprecise performance estimates.

Results can also depend substantially on the particular random allocation of participants.

Resampling approaches such as bootstrapping can often make more efficient use of limited development data.

The choice should nevertheless reflect dataset size, computational requirements, clustering, temporal structure, and the modeling objective.

The methodological issues are examined further in why a simple train-test split is often inefficient.

Does Internal Validation Require a Separate Validation Sample?

Not necessarily. Bootstrap internal validation repeatedly uses observations from the development dataset without requiring a permanently reserved validation subset.

Cross-validation likewise rotates evaluation subsets across the available observations.

These procedures allow the same overall dataset to support both model development and internal validation while maintaining appropriate separation within individual resampling iterations.

However, the final model is generally fitted using the available development data after the modeling procedure has been established.

The internally validated performance estimate describes the expected performance of that development strategy under the relevant assumptions, rather than constituting an untouched external test of the final fitted model.

When Is External Validation Necessary?

External validation is especially important before a prediction model is adopted broadly or used for consequential decisions.

It evaluates the fixed model using independent observations not involved in its development or optimization.

The validation population should be relevant to the model's intended application.

For example, a model developed using patients from a specialist hospital may require evaluation in primary care if primary care is its intended deployment setting.

A student withdrawal model developed at one institution may require independent assessment before use at another institution with different enrollment patterns or support systems.

External validation can identify differences in calibration, discrimination, and applicability that internal validation cannot adequately establish.

Can a Model Be Externally Validated in the Same Institution?

Yes. A model developed using an earlier cohort may be evaluated in a later independent cohort from the same institution.

This is commonly described as temporal validation.

It can reveal changes in outcome frequency, population characteristics, treatment practices, or institutional procedures.

However, temporal validation within one institution may provide less evidence about geographic transportability than evaluation across genuinely different settings.

Researchers should describe which dimension of external validity the design is intended to assess.

What Happens if the Model Is Modified During External Validation?

External validation should initially evaluate the fixed original model.

If researchers change coefficients, recalibrate probabilities, select new predictors, or optimize thresholds using the validation outcomes, the analysis becomes a form of model updating or development.

The original validation results should be reported before modification.

Performance after updating in those same observations is not independent external validation of the revised model.

The updated model requires appropriate internal assessment of the updating process and, where feasible, further independent validation.

This distinction prevents researchers from interpreting improved apparent performance as evidence that the modification will generalize.

What Performance Measures Should Internal Validation Examine?

Validation should assess performance measures relevant to the intended prediction task.

Discrimination concerns the ability to distinguish individuals with different outcomes. Calibration concerns agreement between predicted probabilities and observed outcome frequencies.

For binary outcomes, discrimination may be summarized using AUC. Calibration can be assessed through plots, calibration-in-the-large, and calibration slope.

For continuous outcomes, relevant measures may include prediction error and agreement between predicted and observed values.

Time-to-event outcomes require methods appropriate to censoring, prediction horizons, and competing events where relevant.

Researchers should avoid evaluating only discrimination when the model is intended to support decisions based on absolute risk.

Can Internal Validation Correct a Poorly Designed Dataset?

No. Internal validation addresses aspects of model overfitting and performance estimation within the available data source.

It cannot automatically correct selection bias, systematic outcome misclassification, inappropriate predictor timing, or inadequate representation of the intended population.

For example, a model developed using only advanced disease cases and healthy controls may show stable cross-validated performance while remaining poorly applicable to patients with uncertain diagnoses.

Likewise, a model containing information unavailable at the intended prediction time may remain invalid for that application even if cross-validation is implemented correctly.

Study design and data validity must therefore be evaluated independently of the resampling procedure.

How Do Related Observations Affect Validation?

Ordinary random resampling may be inappropriate when observations are clustered or dependent.

Examples include repeated measurements from the same patient, multiple records from one student, or observations nested within institutions.

If records from the same individual appear in both training and evaluation subsets, the model may benefit from information that would not be available for a genuinely new individual.

Researchers should select resampling units and partitioning strategies that reflect the intended prediction task.

Grouped cross-validation, temporal partitioning, or internal-external validation across clusters may be appropriate in particular circumstances.

The relevant independence structure should be established before validation begins.

How Much Data Is Needed for Development and Validation?

Sample size requirements depend on the outcome, candidate predictor parameters, anticipated predictive performance, and intended validation precision.

For model development, researchers should consider overfitting and the stability of predicted risks.

For external validation, sample size planning should focus on sufficiently precise estimates of calibration and discrimination.

Using the same overall dataset for internal validation does not remove the need for adequate development information.

The principles governing outcome-event requirements in prognostic research remain relevant.

How Should Development and Validation Be Reported?

Researchers should identify the data used for model fitting, feature selection, preprocessing, tuning, and evaluation.

They should specify the internal validation method, including the resampling structure and whether the complete development process was repeated.

Apparent and optimism-corrected performance should be distinguished.

If external validation was conducted, the independent dataset and its relationship to the development population should be described.

TRIPOD+AI provides reporting guidance for clinical prediction-model research using regression or machine-learning methods.

Transparent reporting allows readers to determine whether the study supports internal performance assessment, external transportability, or both.

04 · A Practical Example

Why a Model Can Be Internally Validated Without an Independent Dataset

Hypothetical Example

Developing a One-Year Academic Withdrawal Prediction Model

Researchers have records for 1,200 newly enrolled students, of whom 180 withdrew within the first academic year.

They develop a prediction model using information available at enrollment and initially calculate an apparent AUC of 0.84.

The following results are hypothetical and illustrate the difference between apparent and internally validated performance.

Evaluation Stage Hypothetical AUC Interpretation
Apparent development performance 0.84 Evaluated in observations used for development
Estimated bootstrap optimism 0.05 Estimated optimism associated with development
Optimism-corrected performance 0.79 Internally validated estimate under the bootstrap procedure
Independent external validation Not yet conducted Transportability remains unestablished
Calculating Optimism-Corrected AUC
Corrected AUC = Apparent AUC − Estimated optimism
The subtraction applies to an AUC measure for which higher values indicate better discrimination. Estimated optimism comes from appropriately repeating the development procedure in bootstrap resamples.
0.84 − 0.05 = 0.79. The corrected estimate is lower than apparent performance, illustrating why evaluating only the fitted model's training observations can be misleading.
Develop the model

The researchers prespecify the prediction task and fit a model using the available development cohort.

Repeat development during bootstrapping

Each resampling iteration includes the relevant preprocessing, predictor selection, and model fitting procedures.

Estimate optimism

The researchers compare performance within each bootstrap sample with performance when the bootstrap-developed model is applied to the original dataset.

Evaluate more than discrimination

They also assess calibration and whether predicted withdrawal probabilities are appropriate for the intended population.

Plan independent evaluation

The final model is subsequently evaluated in a new enrollment cohort to investigate performance beyond the original development data.

The corrected AUC does not guarantee that the model will achieve 0.79 in another institution or later cohort.

It estimates aspects of optimism under the development data and resampling procedure. External validation remains necessary to evaluate performance under independent conditions.

05 · What Researchers Often Get Wrong

Common Misconceptions About Using the Same Dataset for Development and Validation

Misconception

Prediction Models Cannot Be Validated Using Development Data

Internal validation can use the same overall dataset through appropriate resampling procedures. It should not be confused with independent external validation.

Misconception

Training-Set Performance Is Evidence of Validation

Performance calculated in the observations used to fit the model is apparent performance and may be optimistic.

Misconception

A Random Train-Test Split Automatically Provides External Validation

A random split usually assesses performance within the same source population. It does not necessarily evaluate transportability to other settings or periods.

Misconception

Cross-Validation Prevents All Forms of Data Leakage

Leakage can persist when preprocessing, feature selection, or tuning uses evaluation-fold information. The full development procedure must be appropriately separated within resampling.

Misconception

Bootstrap Validation Makes External Validation Unnecessary

Bootstrapping estimates aspects of optimism within the development source. It does not establish performance in different populations or operational conditions.

Misconception

Excellent Internal Validation Corrects Poor Participant Selection

Resampling does not automatically remove systematic selection bias, outcome misclassification, or limitations in the representativeness of the development population.

06 · What This Means for You

How to Plan Development and Validation With Limited Data

Begin by distinguishing the evidence required at the current research stage.

If the objective is initial model development, use the available data efficiently and plan appropriate internal validation.

If the objective is to establish performance in a new population, obtain independent data relevant to that application.

A simple decision framework

If only one development dataset is available
Consider bootstrap or appropriately implemented cross-validation and describe the findings as internal validation.
If the dataset is relatively small
Avoid automatically reserving a large test subset; evaluate whether resampling provides a more efficient assessment.
If preprocessing or model tuning is extensive
Include the complete development process within resampling and use appropriately separated tuning and evaluation procedures.
If observations are clustered or repeated
Use validation partitions that respect the dependence structure and intended prediction setting.
If the model will support consequential decisions in another setting
Seek independent external validation and evaluate calibration, discrimination, and relevant decision consequences.

Report the complete development procedure, apparent performance, internal validation method, and optimism-adjusted estimates where applicable.

Do not describe internal resampling results as evidence that the model has been externally validated.

Watch Out

Repeatedly evaluating alternative models against the same nominally held-out test set can turn that set into part of the development process. Once test outcomes influence model selection or tuning, the reported performance is no longer an untouched independent assessment.

The goal is to make the most appropriate use of available observations while preserving a clear distinction between estimated internal performance and evidence of transportability.

07 · A Quick Checklist

Before Developing and Validating a Model Using the Same Dataset

Before finalizing the modeling strategy, check:
Distinguish apparent performance, internal validation, and external validation.
Define the target population, outcome, prediction time, and intended application.
Assess whether the development data contain sufficient outcome information and predictor variation.
Choose an internal validation procedure appropriate to the sample size and data structure.
Include predictor selection, preprocessing, and tuning within the validation procedure where required.
Prevent leakage between training and evaluation observations or clusters.
Report apparent and internally validated performance separately.
Evaluate calibration and discrimination where appropriate, rather than AUC alone.
Avoid describing random-split testing as external validation without justification.
Plan independent external validation before making broad implementation claims.
08 · Frequently Asked Questions

Frequently Asked Questions About Development and Validation in One Dataset

Can I develop and validate a prediction model using the same dataset?

Yes, for internal validation using appropriate resampling or data-partitioning procedures. Evaluating a model on its own training observations does not constitute independent validation.

Is a 70:30 train-test split sufficient?

Not automatically. A single split may be inefficient and produce imprecise performance estimates, particularly when the dataset contains relatively few outcome events.

Does bootstrapping count as validation?

Yes. Properly implemented bootstrap procedures provide internal validation by estimating optimism associated with model development.

Is cross-validation the same as external validation?

Ordinary cross-validation within one development dataset is internal validation. External validation evaluates a fixed model in independent observations relevant to the intended use.

Should feature selection occur before cross-validation?

Outcome-informed feature selection should generally be repeated within training folds. Performing it on the complete dataset beforehand can leak evaluation information into development.

Can I use all development observations to fit the final model?

Yes, after establishing the modeling procedure and conducting appropriate internal validation, the final model is commonly fitted using the available development observations.

Does internal validation establish generalizability?

It assesses performance within the development data source under relevant assumptions. Independent external validation is needed to investigate performance beyond those conditions.

Can a later cohort from the same institution provide external validation?

Yes, when it is independent of development. Such temporal validation can evaluate performance in a later period, although it may provide limited evidence about other institutions.

09 · The Bottom Line

One Dataset Can Support Internal Validation, but Not Every Claim of Validation

The Bottom Line

Prediction models can be developed and internally validated using the same overall dataset when resampling procedures appropriately account for model development. However, apparent training performance is not validation, and internal validation does not establish external transportability.

Use development data efficiently, prevent information leakage, and report the validation procedure transparently. Independent evaluation in a relevant population remains important before relying on predictions for consequential decisions.

10 · Sources and Further Reading

Foundational Sources on Internal and External Prediction Model Validation

11 · Cite this Guide

How to Cite This Guide

This guide is intended to be read, shared, and used in research, teaching, and academic work. If you draw on its ideas, explanations, or other content, please acknowledge the source by citing the guide. Doing so gives appropriate credit and helps your readers locate the original resource.

Has the Field Guide helped your research?

If a guide helped clarify a question, inform a research decision, or move your work forward, I would love to hear about your experience. Your story may also help other researchers discover the Field Guide.

Share Your Experience
Takes only a few minutes