Skip to content

Home / DOE / Charts / Thumbnail Plot / Math Details

Math Details

This page gives the values a thumbnail cell draws and how each one is formed: where the points sit, what number each point carries under each of the two sources, how the smooth curve between them is built, and how the two value axes are chosen.

One engine builds the Thumbnail Plot, Interaction Plots and Main Effects Plots. A thumbnail is that engine asked for both kinds of chart in one report: a diagonal cell is a chart of a factor against itself, an off diagonal cell is a chart of two different factors. The differences between the three are collected in the last section.

Notation

Term Description
\(A\) the factor on the cell's horizontal axis, which is its column factor
\(B\) the factor whose levels give the separate lines, which is its row factor; \(B = A\) on a diagonal cell
\((u, v)\) one setting of the pair \((A, B)\) that appears in the design's runs; a value for a quantitative factor, a level for a categorical one
\(R_{uv}\), \(n_{uv}\) the runs at that setting, and how many of them there are
\(y_r\) the response measured on run \(r\)
\(\bar{y}_{uv}\) the value plotted at \((u, v)\) from a design sheet
\(G_{uv}\) the replicate groups the runs of \(R_{uv}\) fall into
\(G^{+}_{uv}\) those groups of \(G_{uv}\) that hold two or more runs, the only ones that produce a standard deviation
\(R_{uvg}\), \(n_{uvg}\) the runs of replicate group \(g\) within \(R_{uv}\), and how many of them there are
\(\bar{y}_{uvg}\) the mean of the responses in \(R_{uvg}\)
\(s_{uvg}\) the sample standard deviation of the responses in \(R_{uvg}\)
\(\bar{s}_{uv}\) the standard deviation plotted at \((u, v)\) from a design sheet
\(t_k\) the set point typed or picked for factor \(k\)
\(\mathbf{z}\), \(z_k\) the vector of factor settings handed to the prediction equation, and its entry for factor \(k\)
\(\hat{y}\) the value plotted from a regression sheet: a fitted response on the response level, a fitted standard deviation on the standard deviation level
\(c_j\), \(b_j\) the coded value and the coefficient of model term \(j\)
\(x_{\min}\), \(x_{\max}\) the smallest and the largest horizontal position on one line
\(N\) the number of points in a drawn curve, fixed at \(100\)
\(y_{\min}\), \(y_{\max}\) the smallest and the largest value in one of the two pools
\(\Delta\) the tick spacing of a value axis
\(r\) the rounded range a value axis is built from
\(y_{\text{low}}\), \(y_{\text{high}}\) the two ends of a value axis
\(n\) the number of ticked factors

Where the points sit

The horizontal positions come from the design sheet under either source. For each cell the engine first reads the runs and collects every distinct setting of the pair \((A, B)\) that appears among them, in the order the runs present them. On a diagonal cell, where \(B\) is \(A\), that collapses to the distinct settings of the one factor. Only then, and only when the source is a regression sheet, does the engine replace each point's value with a prediction. So a cell never shows a combination its runs did not visit, whichever source it was built from, and a combination that was not run has no point rather than a predicted one.

The points are then sorted by \(u\), and by \(v\) where \(u\) ties, so the horizontal axis reads left to right. The lines are ordered by \(v\): by the level order for a categorical \(B\), by the value for a quantitative one. Within a line the points are ordered by horizontal position, and where \(A\) is quantitative any point with no value is moved to the end. Where \(A\) is categorical the order is the level order alone, so a valueless point keeps its place in the run of levels rather than moving.

When \(A\) is categorical and a line is missing one of its levels, that line is padded with a valueless point at the missing level, so every line of the cell carries the same number of points.

A value read from a design sheet

The response level. The point at \((u, v)\) is the mean of the responses of the runs at that setting:

\[ \bar{y}_{uv} = \frac{1}{n_{uv}} \sum_{r \in R_{uv}} y_r \]

The average is taken over every run at that setting, whatever the remaining factors were doing in those runs.

The standard deviation level. The runs at \((u, v)\) are first split into their replicate groups. Each group of two or more runs gives one sample standard deviation:

\[ s_{uvg} = \sqrt{\frac{1}{n_{uvg} - 1} \sum_{r \in R_{uvg}} \left(y_r - \bar{y}_{uvg}\right)^2} \]

and the point is the mean of the standard deviations that were produced, which is one per group of two or more runs:

\[ \bar{s}_{uv} = \frac{1}{\lvert G^{+}_{uv} \rvert} \sum_{g \in G^{+}_{uv}} s_{uvg} \]

The divisor counts only the groups that produced a standard deviation. A group holding a single run produces none, and it is left out of the average altogether: it adds nothing to the sum and it is not counted in the divisor either. So a setting with three replicate groups, one of them a single run, averages two standard deviations and divides by two, not by three.

A setting where no group holds two or more runs has nothing to report, and its point is left blank rather than set to zero.

A value predicted from a regression sheet

The engine builds one vector of factor settings per point and hands it to the prediction equation. The entries for the cell's own factors are the point's position; every other entry is that factor's set point:

\[ z_k = \begin{cases} u, & k = A \\ v, & k = B \\ t_k, & \text{otherwise} \end{cases} \]

On a diagonal cell the first two lines are the same entry, so exactly one entry is replaced.

The set points of a cell's own factors are overwritten before every prediction, so they are never read. Their rows stay on the dialog and stay editable, and what is typed in them has no effect on that cell. They do still act on every cell that does not carry them on an axis, which on a thumbnail is most of the grid, so one set point can move many cells and leave a few alone.

Each entry is then coded, and the coded values are combined with the coefficients already on the regression sheet:

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:

\[ x_{\text{coded}} = \frac{x - m_c}{s_c} \]

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:

\[ \hat{y} = \sum_{j} c_j \, b_j \]

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\).

For a binary output the same sum is formed and passed through the logistic function:

For a binary output the same sum is formed first, then passed through the logistic function to give a probability:

\[ p = \frac{1}{1 + e^{-\sum_j c_j b_j}} \]

That is the probability of the first level. The probability of the second is \(1 - p\).

For a nominal output there is one sum per level:

For a nominal output with \(L\) non-reference levels there is one sum per level, \(\eta_k = \sum_j c_j b_{jk}\), and the probability of level \(k\) is

\[ p_k = \frac{e^{\eta_k}}{1 + \sum_{l=1}^{L} e^{\eta_l}} \]

The \(1\) in the denominator is the reference level, whose \(e^{\eta}\) is \(1\) by construction. So the reference level's own probability is

\[ p_{\text{ref}} = \frac{1}{1 + \sum_{l=1}^{L} e^{\eta_l}} \]

and the probabilities across all levels sum to \(1\).

Which coefficients are used follows the level you ticked. On a quantitative output the response level reads the response model's coefficients and the standard deviation level reads the standard deviation model's, so on that level every \(\hat{y}\) above is a predicted standard deviation. The set-point vector, the coding and the sum are the same either way.

When the two sources agree

The two sources put their points at the same horizontal positions, so the two sheets can be laid side by side. Whether the values on them are the same number depends on where the held factors have been put, and there is one arrangement in which they agree exactly.

On a balanced design, with every held factor left at the default set point, the midpoint of its range, the two agree exactly at every point. At the midpoint a held quantitative factor codes to zero, so its own term and every interaction it appears in drop out of the sum, and what is left is the mean of the runs in that cell.

Move one held factor off its midpoint and the two part company, by an amount that depends on the coefficients of the terms that factor appears in. The agreement holds at one particular set of settings rather than in general, so a design-source thumbnail and a regression-source thumbnail are comparable only when you know where the held factors were put.

The smooth curve

When the source is a regression sheet and \(A\) is quantitative, each line of the cell carries a second series in addition to its points at the settings that were run. The series holds \(N = 100\) points spread across that line's own range of horizontal positions:

\[ x_i = \min\left(x_{\min} + i \cdot \frac{x_{\max} - x_{\min}}{N - 1},\ x_{\max}\right), \qquad i = 0, 1, \dots, N - 1 \]

Each \(x_i\) carries the prediction with \(A\) at \(x_i\), \(B\) at that line's own level, and every held factor at its set point, formed exactly as the section above describes. The code does not evaluate that expression. It adds the step to a running position and clamps the result to \(x_{\max}\) after each addition, so reproducing these numbers exactly means adding the step ninety nine times rather than multiplying it, and the two can part in the last bits. The clamp is also what stops accumulated rounding carrying the last point past the end of the range.

A line with only one horizontal position is left without a curve, since there is no range to spread points across. A categorical \(A\) gets no curve either, because there is nothing between two levels to draw through. Since the style follows the column factor, a whole column of the grid gains or loses its curves together.

The curve is built for every output type, not only for a fitted probability. It is what lets a square term, a logistic bend, or any other curvature of the fitted model show, where straight segments drawn between the settings that were run would hide it.

The two value axes

Every chart of one report contributes its plotted values to a pool, and there are two pools: one for the cells whose two factors are the same, which is the diagonal, and one for the cells whose factors differ, which is everything off it. A thumbnail fills both. So every diagonal cell shares one value axis and every off diagonal cell shares another, and the two are computed separately from each other. Curve points count toward \(y_{\min}\) and \(y_{\max}\) alongside the points at the run settings; points with no value are skipped.

Each axis is chosen from its own pool by rounding to a nice number. Write

\[ e = \lfloor \log_{10} r \rfloor, \qquad \phi = \frac{r}{10^{e}}, \qquad \mathrm{nice}(r) = f \cdot 10^{e} \]

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:

\[ r = \mathrm{nice}_{\text{up}}\left(y_{\max} - y_{\min}\right), \qquad \Delta = \mathrm{nice}_{\text{near}}\!\left(\frac{r}{10}\right) \]
\[ y_{\text{low}} = \Delta \left\lfloor \frac{y_{\min}}{\Delta} \right\rfloor, \qquad y_{\text{high}} = \Delta \left\lceil \frac{y_{\max}}{\Delta} \right\rceil \]

Three guards follow. A range below \(10^{-5}\) is replaced by the largest power of ten not exceeding the larger of \(\lvert y_{\min} \rvert\) and \(\lvert y_{\max} \rvert\), and failing that by \(10^{-5}\), so a flat set of values still gets an axis. An end that rounding moved inside the data is pulled back to the data, so the axis can never cut off a plotted point. And if the two ends come out equal, each of them is moved by \(r/2\), the low end down and the high end up, so the axis ends up spanning \(r\) rather than \(r/2\).

The same construction gives a cell's horizontal axis ends when \(A\) is quantitative, from that cell's own smallest and largest horizontal position.

The number of decimal places on each value axis comes from that axis's own pool, counting the points at the run settings and not the curve points: the most any one of them needs, or one place when every one of them is identical.

Cells that are not drawn

A cell is written as NA rather than a chart in two cases: when either of its factors is nested inside another factor, and when not one of its points carries a value. The second covers a standard deviation cell from a design sheet whose settings hold no replicate group of two or more runs.

How the three charts differ

The engine is one class and these are its three shapes.

  • Thumbnail Plot builds both kinds of chart, \(n\) charts of a factor against itself and \(n(n-1)\) of two different factors, filling all \(n^2\) cells of the grid, and keeps two separate value axes for them.
  • Interaction Plots builds only the \(n(n-1)\) of the second kind, so the diagonal cells of its grid carry the factor names rather than charts.
  • Main Effects Plots builds only the \(n\) of the first kind, laid out as one row rather than a grid.

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 plotted value when the source is a regression sheet Prediction Equation
Design coding turning a horizontal position or a set point into the coded value the prediction uses Design Coding

See Also

References

  1. Montgomery, D. C. (2013). Design and Analysis of Experiments, 8th edition. Wiley.
  2. Heckbert, P. S. (1990). Nice Numbers for Graph Labels. In A. S. Glassner (Ed.), Graphics Gems. Academic Press.