Home / DOE / Charts / Observed vs Predicted / Math Details
Math Details¶
This page gives the two numbers behind every point of an observed vs predicted plot, which runs become points, and how the one axis scale shared by both axes is chosen.
Notation¶
| Term | Description |
|---|---|
| \(i\) | one used run of the design, \(i = 1, \dots, n\) |
| \(n\) | the number of used runs, which is the number of points |
| \(y_i\) | the observed value at run \(i\), plotted on the horizontal axis |
| \(\hat{y}_i\) | the predicted value at run \(i\), plotted on the vertical axis |
| \(\mathbf{z}_i\) | the vector of that run's own uncoded factor settings |
| \(c_j\), \(b_j\) | the coded value and the coefficient of model term \(j\) |
| \(v_{\min}\), \(v_{\max}\) | the smallest and the largest value among all the observed and all the predicted values together |
| \(\Delta\) | the tick spacing of the shared axis |
| \(r\) | the rounded range the shared axis is built from |
| \(v_{\text{low}}\), \(v_{\text{high}}\) | the two ends of the shared axis |
Observed goes on the horizontal axis¶
This is the reverse of the more common convention and it is worth stating plainly, because a plot read the wrong way round looks the same at a glance. The measured response is the horizontal coordinate and the model's fitted value is the vertical one. A run the model under-predicts therefore sits below the reference line, not above it.
The reference line is the 45 degree line \(\hat{y} = y\). There is no confidence band.
Which runs become points¶
One point per used run, in the order the model holds those runs. A run the model did not use, because its response was missing or its row was not valid, contributes no point, so the count of points is the count of used runs rather than the count of rows on the design sheet.
The two levels do not have the same number of points. On the Y-Hat level the observed values are the raw responses, one per used run. On the S-Hat level they are the per-group standard deviations the standard deviation model was fitted against, read from that model's own loaded response with its own grouped-row structure, so a design with replication gives fewer points on S-Hat than on Y-Hat.
The two coordinates¶
The observed value is read, not computed. It is the response the standard deviation model or the response model was fitted against, taken from the model's loaded response vector at that run.
The predicted value is the prediction equation evaluated at that run's own settings. The engine assembles the run's uncoded factor values, the block first when the design has blocks, then each factor in order, and hands them to the same prediction equation every other model-source chart uses:
Every quantitative factor is put on a common scale before the regression runs. One expression does it, whichever coding is in force, using a centre \(m_c\) and a scale \(s_c\) that the coding chooses:
A categorical factor is never coded this way. Its coded value is \(1\), and the level it sits at selects which coefficient is used instead.
An interaction's coded value is the product of the coded values of the factors in it.
A prediction is the sum, over every term in the model, of that term's coded value times its coefficient:
where \(c_j\) is the coded value of term \(j\) at the settings you asked about and \(b_j\) is its coefficient from the regression table. The constant term has \(c_j = 1\), so its coefficient enters as itself.
A term that is absent from the regression table, or switched off for the level being predicted, contributes \(b_j = 0\).
No set point takes any part in this. Every entry of \(\mathbf{z}_i\) is the run's own value. That is what separates this chart from the surface, cube and interaction charts, all of which hold the factors they do not plot at a chosen value.
Which coefficients are used follows the level you ticked. The Y-Hat level reads the response model's coefficients, the S-Hat level the standard deviation model's, and on that level both coordinates are standard deviations.
A categorical factor contributes its level and the block contributes its block index, in the same uncoded form the other model-source charts use, so a categorical design is plotted exactly as a quantitative one is.
The shared axis¶
Both axes get the same scale, and that is what makes the 45 degree line a true diagonal. If the two axes were scaled independently the reference line would still be drawn, but it would no longer sit at 45 degrees on the page and the distance of a point from it would no longer read as its error.
The engine pools every observed value and every predicted value into one set, takes the smallest and the largest, and rounds them out to nice numbers:
where \(e\) is the base ten exponent of \(r\), \(\phi\) is its leading fraction, and \(f\) is a nice fraction read from \(\phi\) by one of two tables. Rounding to the nearest takes \(f = 1, 2, 5, 10\) as \(\phi\) falls below \(1.5\), below \(3\), below \(7\), or higher; rounding up takes \(f = 1, 2, 5, 10\) as \(\phi\) is at most \(1\), at most \(2\), at most \(5\), or higher. The range is rounded up and the tick spacing to the nearest:
with the same three guards the other charts use: a range below \(10^{-5}\) is replaced by the largest power of ten not exceeding the larger of \(\lvert v_{\min} \rvert\) and \(\lvert v_{\max} \rvert\), and failing that by \(10^{-5}\); an end that rounding moved inside the data is pulled back to the data; and two ends that come out equal are each moved by \(r/2\).
Here the tick spacing is used. \(v_{\text{low}}\), \(v_{\text{high}}\) and \(\Delta\) are all written onto the chart, \(\Delta\) as the major unit of both axes. This chart is the exception in the family: a surface takes the finished span divided by ten instead, and a trellis computes a tick spacing it never uses.
A plot with no points takes a fixed axis of \(0\) to \(1\) with a tick spacing of \(1\), rather than being left to Excel.
Shared Math Details used here¶
This chart uses shared formulas defined once in Shared Math Details. See those pages for the exact definitions.
| Shared concept | Used here for | Reference |
|---|---|---|
| Prediction equation | the vertical coordinate of every point | Prediction Equation |
| Design coding | turning a run's own settings into the coded values the prediction uses | Design Coding |
See Also¶
- Observed vs Predicted
- Options
- Residual Plots Math Details, where the same fitted values become residuals
- Chart Source
References¶
- Montgomery, D. C. (2013). Design and Analysis of Experiments, 8th edition. Wiley.
- Heckbert, P. S. (1990). Nice Numbers for Graph Labels. In A. S. Glassner (Ed.), Graphics Gems. Academic Press.