Home / DOE / Charts / Main Effects Plots / Math Details
Math Details¶
This page gives the values a main effects panel 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 value axis is chosen.
One engine builds Main Effects Plots, Interaction Plots and the Thumbnail Plot. A main effects panel is that engine asked for a chart of a factor against itself, which is why the panel carries one line rather than one per level of a second factor. The differences between the three are collected in the last section.
Notation¶
| Term | Description |
|---|---|
| \(A\) | the factor of the panel, on the horizontal axis |
| \(u\) | one setting of \(A\) that appears in the design's runs; a value for a quantitative factor, a level for a categorical one |
| \(R_u\), \(n_u\) | the runs at that setting, and how many of them there are |
| \(y_r\) | the response measured on run \(r\) |
| \(\bar{y}_u\) | the value plotted at \(u\) from a design sheet |
| \(G_u\) | the replicate groups the runs of \(R_u\) fall into |
| \(G^{+}_u\) | those groups of \(G_u\) that hold two or more runs, the only ones that produce a standard deviation |
| \(R_{ug}\), \(n_{ug}\) | the runs of replicate group \(g\) within \(R_u\), and how many of them there are |
| \(\bar{y}_{ug}\) | the mean of the responses in \(R_{ug}\) |
| \(s_{ug}\) | the sample standard deviation of the responses in \(R_{ug}\) |
| \(\bar{s}_u\) | the standard deviation plotted at \(u\) 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 the panel |
| \(N\) | the number of points in a drawn curve, fixed at \(100\) |
| \(y_{\min}\), \(y_{\max}\) | the smallest and the largest value plotted anywhere in one report |
| \(\Delta\) | the tick spacing of the value axis |
| \(r\) | the rounded range the value axis is built from |
| \(y_{\text{low}}\), \(y_{\text{high}}\) | the two ends of the value axis |
| \(n\) | the number of ticked factors |
Where the points sit¶
The horizontal positions come from the design sheet under either source. The engine reads the runs and collects every distinct setting of \(A\) that appears among them, in the order the runs present them. Only then, and only when the source is a regression sheet, does it replace each point's value with a prediction. So a panel never shows a setting of \(A\) that the experiment did not visit, whichever source it was built from.
The points are then sorted by \(u\), so the horizontal axis reads left to right. 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.
A value read from a design sheet¶
The response level. The point at \(u\) is the mean of the responses of every run at that setting:
The average runs over every run at that setting of \(A\), whatever the remaining factors were doing in those runs, which is why this is also called a marginal mean.
The standard deviation level. The runs at \(u\) are first split into their replicate groups. Each group of two or more runs gives one sample standard deviation:
and the point is the mean of the standard deviations that were produced, which is one per group of two or more runs:
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 and hands it to the prediction equation. The entry for the panel's own factor is the point's position; every other entry is that factor's set point:
The set point of \(A\) is overwritten before every prediction, so it is never read. Its row stays on the dialog and stays editable, and what is typed in it has no effect on this panel. It does still act on every other panel of the sheet, where \(A\) is one of the held factors.
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:
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\).
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:
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
The \(1\) in the denominator is the reference level, whose \(e^{\eta}\) is \(1\) by construction. So the reference level's own probability is
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 panels 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 at that setting.
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 panel and a regression-source panel of the same factor 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, the panel's line carries a second series in addition to its points at the settings that were run. The series holds \(N = 100\) points spread across the panel's range of horizontal positions:
Each \(x_i\) carries the prediction with \(A\) at \(x_i\) and every other 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 panel 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.
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 value axis¶
Every panel of one report contributes its plotted values to a pool, and the axis is computed once from that pool, so the panels of one row share one value axis and their heights can be read against each other. Curve points count toward \(y_{\min}\) and \(y_{\max}\) alongside the points at the run settings; points with no value are skipped.
One row, one axis. Each ticked output level is computed as its own report before the rows are written to the shared sheet, so a row is scaled from its own panels alone. Two rows of the same sheet do not share a value axis, and their heights are not comparable.
The axis ends are chosen by rounding to a nice number. Write
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:
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 the horizontal axis ends when \(A\) is quantitative, from the smallest and the largest horizontal position instead of from the values.
The number of decimal places on the value axis labels comes from the points at the run settings, the curve points not counting toward it: the most any one of them needs, or one place when every one of them is identical.
Panels that are not drawn¶
A panel is written as NA rather than a chart in two cases: when its factor is nested inside another factor, and when not one of its points carries a value. The second covers a standard deviation panel 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.
- Main Effects Plots builds only charts of a factor against itself, one per ticked factor, so \(n\) ticked factors give \(n\) panels in one row. There is no layout choice and no pair to name.
- Interaction Plots builds a chart for each ordered pair of two different ticked factors and none for a factor against itself, so \(n\) ticked factors give \(n(n-1)\) charts.
- Thumbnail Plot builds both kinds, \(n\) of the first and \(n(n-1)\) of the second, filling all \(n^2\) cells, and keeps two separate value axes for them.
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¶
- 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.