Goodness-of-fit measure
A goodness-of-fit measure quantifies how closely a statistical model or representation agrees with observed data or specified relationships.
Statistics Every Programmer Needs
Goodness of fit is the degree to which a statistical model's predictions agree with observed data.
- How it is used
- Assesses how well fitted regression or time-series models account for observed data and supports comparisons between competing fits.
- How deep it goes
- Derives linear-regression R² from sums of squares and interprets model outputs, while emphasizing diagnostics beyond a single statistic.
- Examples
- Uses marathon stage split times, a sum-of-squares table, a fitted-line plot, and time-series residual plots.
- What you can do after
- Apply it via NumPy and statsmodels to interpret fitted-model output and check whether a fit statistic warrants confidence.
Read how Statistics Every Programmer Needs explains goodness-of-fit measure →
Causal AI
A goodness-of-fit statistic quantifies how well a model fits or accounts for observed data.
- How it is used
- Evaluates how well a trained model fits its data and, in score-based discovery, ranks candidate causal DAGs.
- How deep it goes
- Defines fit against training data and contrasts it with held-out prediction, but stops short of identifying the true data-generating process.
- Examples
- Uses training-data fit statistics, held-out prediction statistics, and high-scoring causal DAGs as examples.
- What you can do after
- Evaluate model fit, distinguish it from predictive validation, and interpret goodness-of-fit scores during causal discovery.
Related concepts
- coefficient of determinationmeasured by · The coefficient of determination, or R-squared, is a regression metric measuring the proportion of target variation explained by a fitted model relative to a mean-value baseline.
- linear regressionmeasured by · Linear regression is a statistical modeling method that estimates a continuous response as a linear combination of predictor variables and fitted coefficients.
- McFadden's pseudo R-squaredmeasured by · McFadden's pseudo R-squared is a likelihood-based goodness-of-fit measure comparing a fitted discrete-choice model with an intercept-only null model.
- cross-validationcontrasts with · Cross-validation is a resampling technique that evaluates a model by repeatedly fitting it on some portions of available data and assessing it on held-out portions.
- chi-square testmeasured by · A chi-square test is a statistical hypothesis test that uses a chi-square-distributed statistic to evaluate hypotheses about categorical data, goodness of fit, or variance.
- AICmeasured by · The Akaike information criterion is a model-selection score that balances goodness of fit against model complexity, with lower values generally preferred among comparable models.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

