Skip to main content

Week 10 Module: Building Predictive Models

Fitting the Virtual Rheometer's models to noisy data — least squares, residuals, and how to tell a good model fit from a lucky one.

Ω (rotation)specimen, h
Apparatus — parallel-plate rheometerThe instrument, not the specimen. A thin disc of material sheared between two plates is how every flow curve on this site was (synthetically) generated.
Try it in the labVirtual RheometerOpen the instrument →

Research question

Module 2 asserted that doubanjiang is a Herschel-Bulkley fluid and honey is Newtonian. What actually justifies choosing one model over another from data, rather than from a name pinned to a food in advance — and what does it mean for one model to be a better fit than another?

Specimen doubanjiang & honey, Virtual Rheometer flow-curve fits

Where this sits

Opening module of Stage 4, Prediction and Material Design. Stages 1–3 gave you the governing models one at a time, each anchored to a food system chosen because that model fits it well. This module turns the process around: given real (noisy) data and several candidate models, how do you choose, and how confident should you be in the choice? Module 12 depends on this module’s fitting discipline to solve its inverse-design problem responsibly.

The model: least squares and residuals

Fitting a model means choosing its parameters to minimise the total squared disagreement between the model’s prediction and the data:

RSS = Σᵢ (τᵢ,measured − τᵢ,model)²
R² = 1 − RSS / TSS
RSS (residual sum of squares)
total squared error between the fitted model and the data — lower is a closer fit, but is not comparable across models with different numbers of parameters without care.
τᵢ,measured / τᵢ,model
the measured and model-predicted shear stress at the i-th shear rate tested.
TSS (total sum of squares)
total squared deviation of the data from its own mean — the "no model at all" baseline.
R² (coefficient of determination, dimensionless, ≤ 1)
the fraction of the data's variation the model explains; higher is better, but a high R² alone does not prove the model is *correct*, only that it tracks the data closely.

A subtler and more useful check than R² alone is a residual plot — model error plotted against shear rate. A good model’s residuals scatter randomly around zero across the whole range. A wrong model’s residuals show a pattern — for instance, fitting a Newtonian model to a fluid with a real yield stress systematically under-predicts stress at low shear rate and over-predicts it at high shear rate, even if the overall R² looks respectable. The pattern, not the summary number, is what tells you the model family itself is wrong.

Figure — residuals reveal what R² alone hides Model residuals against shear rate: a good fit scatters randomly around zero while a wrong model family shows a systematic trend crossing zero shear rate γ̇ → residual (model − measured) Herschel–Bulkley: random scatter Newtonian fit to doubanjiang systematic trend, not noise
Two fits can share a similar overall R². The Herschel-Bulkley residuals scatter randomly around zero across the whole range; the Newtonian fit's residuals trend from negative to positive — under-predicting stress at low shear rate, over-predicting it at high shear rate. That trend, not the R² number, is what exposes the wrong model family.
Fit metric
R² = 1 − RSS/TSS
Tells more than R²
residual pattern
Models compared
≥ 2 per specimen

What you measure and analyse

In the Virtual Rheometer, fit both the power-law and Herschel-Bulkley models to the same doubanjiang flow curve, and compare R² and the residual plot for each. The power-law model, lacking a yield-stress term, should show a visible systematic residual pattern at low shear rate that the Herschel-Bulkley fit removes.

Activity

Fit the Newtonian model to the honey specimen and to the doubanjiang specimen in the Virtual Rheometer. Report the R² for each fit, then explain using the residual plot (not just the R² numbers) why a high R² for the Newtonian fit to doubanjiang, if you happen to get one over a narrow shear-rate range, would still be a bad reason to conclude doubanjiang has no yield stress.

References

The spec

What you bring to the session. Written so a reader can tell whether it has been met without asking you.

  • explain what a residual is and what a residual-vs-shear-rate plot can reveal that R² alone cannot
  • state why fitting the Herschel-Bulkley model to Newtonian data does not, by itself, prove doubanjiang has a yield stress
  • use the Virtual Rheometer to fit at least two candidate models to the same specimen and justify picking one

Teaching team