Response surface methodology: finding the best settings in a few runs
You want the reaction temperature and time that give the highest yield. You cannot try every combination. Here you estimate the "shape" of the result from a handful of runs and follow that shape up to the top, moving it yourself.
Short answer. Response surface methodology treats the result (yield) as a smooth surface over the settings (temperature, time), the response surface, approximates that surface with a formula fitted to a few runs, and uses it to find the best spot. Far from the best spot you fit a plane (a first-order model) and move the steepest way up. Near the top you fit a second-order model that can bend, y = b₀ + b₁x₁ + b₂x₂ + b₁₁x₁² + b₂₂x₂² + b₁₂x₁x₂, and solve for the spot where the slope is zero (the stationary point).
contours of the hidden true yieldcorner pointcentre pointway up (one step)path so far
Across is temperature (°C) and up is reaction time (min). The pale grey lines are contours of the hidden true yield (30 to 80%, every 10 points, higher towards the middle), which a real experiment never shows you. The four corners of the black box and the purple centre point are this round's five runs. Each run wobbles by a standard deviation of 1 point of yield (a fixed-seed random number generator, so the values are always the same). The orange arrow is one step the steepest way up on the fitted plane. "Take one step" runs five new experiments at the tip of the arrow. Every number and data point on this page is made up.
Definitions
These definitions are for k factors () and a response y. The example in the text has k = 2 (temperature x₁ and time x₂).
- response surface
- When the response y is a function f of the factors plus an error ε, the surface that f draws over the space of the factors.
- coded variable
- A value ξ in the original units, shifted and scaled so that the centre c of the experimental region is 0 and the corners are ±1. h is the half-range (the distance from the centre to a corner).
- first-order model
- A formula that approximates the response surface near the runs with a plane. The coefficients b are fitted by least squares.
- second-order model
- The first-order model plus squared terms and two-factor cross terms, so it can hold curvature and twist. It is second order in x but linear in the coefficients b, so it is fitted by least squares.
- steepest ascent
- Moving the design along the gradient of the fitted first-order model, that is in the direction (b₁, …, bk) in coded units. On the plane this is the direction in which the response grows fastest.
- stationary point
- The point where every partial derivative of the fitted second-order model is 0. Whether it is a maximum, a minimum or a saddle point is decided with the Hessian matrix (section 6).
- central composite design
- A design made of the corners (±1) of a factorial design, 2k axial points that move one factor by ±α from the centre, and centre points. When α ≠ 1 each factor has five levels (−α, −1, 0, 1, α), so the squared terms can be estimated separately. The number of runs is shown below.
1. What it does
Two settings affect the result (the factors): temperature x₁ and time x₂. The result (the response) is the yield y. Each pair of settings gives one result, so the results form a surface over the settings, like heights over a map. That is the response surface. The contours in the picture above are this surface seen from above.
We do not know the formula of this surface. Instead we run a few experiments and approximate the surface near them with a simple formula (a plane, or a curved second-order surface). We trust that approximation only near where we experimented. So the method goes in two stages rather than in one go.
| Stage | Where | Formula fitted | Runs | What you do |
|---|---|---|---|---|
| Stage 1 | Far from the best spot | Plane (first-order model) | Four corners + centre | Move the steepest way up |
| Stage 2 | Near the top (when curvature shows) | Second-order model | Four corners + four axial points + centre | Solve for the stationary point and run a confirmation |
The arithmetic is done in coded units. Writing x₁ = (temperature − centre temperature) ÷ half-width puts the centre of the design at 0 and the corners at ±1. This puts two settings with different units (°C and minutes) on the same scale. The four corners are the four cells of a 2×2 factorial design.
2. Stage 1: fit a plane and climb the steepest way
Fit the plane ŷ = b₀ + b₁x₁ + b₂x₂ to the five points by least squares. With this design the answer is simple. b₁ is (sum of the two right corners − sum of the two left corners) ÷ 4, b₂ is (sum of the two top corners − sum of the two bottom corners) ÷ 4, and b₀ is the mean of the five points.
On a plane, the fastest way up is the direction of the slope (b₁, b₂), because b₁ and b₂ are the plane's partial derivatives in x₁ and x₂. Moving that way is the path of steepest ascent. It is the same idea as gradient descent, which steps against the slope to go down, used the other way round. The lab moves 3 coded units per step. In practice you run a few points along this path, stop where the yield starts to fall, and start a new factorial experiment there. The lab keeps it simple and runs a new experiment at every step.
Try this. ① At the start (110 °C, 25 min) the yields are 27, 35.1, 23.9, 39.2 at the corners and 29.8 at the centre, and the fitted plane is ŷ = 31 + 5.85x₁ + 0.25x₂. b₁ is much larger, so the arrow points almost straight along temperature (+30 °C, +0.6 min). The curvature check is −1.5. ② Press "Take one step" and the design moves to 140 °C, 25.6 min. The plane is now ŷ = 45 + 2.78x₁ + 6.22x₂, so this time time is the steeper direction. The curvature check is 1.62. ③ Press once more and the curvature check is 5.4, beyond 3. ④ Press once more: 159.4 °C, 53.9 min, curvature check 6.53. The hidden yields at the places you visited were 31, 47, 70 and 86%. ⑤ Keep going and you overshoot the top, and the yield falls again. Big steps overshoot.
3. Stage 2: when the surface bends, switch to a second-order model
A plane has no top. It always rises in some direction. So near the top a plane does not fit. The centre point is what tells you. If the surface is a plane, the mean of the four corners equals the height at the centre exactly. If the surface bends upward like a dome (curvature), the centre is higher than the mean of the corners.
curvature check = value at the centre − mean of the four corners
If the runs wobble with standard deviation σ = 1, this value wobbles with standard deviation √(1 + 1/4) ≈ 1.12 (one centre run minus the mean of four corner runs). The lab says there is curvature when the value goes beyond ±3, about three times that. In practice you repeat the centre point several times to measure the wobble from the data and compare against it.
When curvature shows, add squared terms and a cross term to the formula.
y: the result (response), here the yield.x₁,x₂: the two settings (factors), temperature and time, in coded units: 0 at the centre, ±1 at the corners.b₀…b₁₂: the coefficients to fit. What each term means is in the table below.
| Term | Meaning |
|---|---|
| b₀ | height at the centre |
| b₁x₁, b₂x₂ | slope, as in the plane |
| b₁₁x₁², b₂₂x₂² | bend. Negative means the surface curves down on both sides in that direction (a top) |
| b₁₂x₁x₂ | twist. The slope in one setting depends on the other setting. The same thing as the interaction in a factorial design |
This formula is second-order in x but linear in the coefficients b. Put x₁², x₂² and x₁x₂ in as extra columns and it is fitted by least squares exactly like an ordinary regression. The script on this page solves the normal equations (6 × 6) itself with Gaussian elimination.
4. You need more points: the central composite design
Six coefficients need at least six points. But it is not only about the count. To see a bend you need at least three heights for each setting (two points only give a straight line). Four corners and a centre cannot do this. At the corners x₁² = x₂² = 1 and at the centre both are 0, so the x₁² column and the x₂² column are identical. The centre point only tells you the sum b₁₁ + b₂₂ (the curvature check estimates exactly −(b₁₁ + b₂₂)) and cannot separate the two.
A central composite design (CCD) adds four axial points (also called star points). Each one moves a single setting ±α away from the centre: (±α, 0) and (0, ±α). Now every setting has five heights (−α, −1, 0, 1, α), and the squared terms can be found separately.
- Number of points: 2^k corners + 2k axial points + the centre. With two settings and one centre run that is 4 + 4 + 1 = 9 points, fitted to 6 coefficients with 3 degrees of freedom left over.
- α = √2 ≈ 1.414: with two settings this puts the corners (at distance √2 from the centre) and the axial points on the same circle, so predictions at the same distance from the centre wobble by the same amount (a rotatable design).
- It builds on stage 1: keep the corners and centre you already ran and only add the axial points.
corners and centreaxial pointscontours of the fitted second-order formularegion you experimented onstationary point
"Near the top" centres the design at 165 °C, 55 min (near where the first lab arrived). "On the slope" centres it at 125 °C, 40 min. The half-widths are 15 °C and 10 min, and the axial points are at ±1.414 in coded units. The green contours are every 2 points and are drawn only inside the region you experimented on (dashed box). "Corners + centre" uses the same run results with the four axial points left out.
Try this. ① The formula fitted to the nine points near the top is ŷ = 87.8 + 1.9x₁ + 3.16x₂ − 9.73x₁² − 6.83x₂² + 9.02x₁x₂. The stationary point is at 169.4 °C, 59.3 min and it is a maximum, with a predicted yield of 88.8%. A confirmation run there gives 90%. ② Press "Corners + centre (5 points)" and the formula cannot be solved. ③ Press "On the slope": the formula is ŷ = 45.4 + 14.71x₁ + 0.44x₂ + 1.04x₁² − 2.91x₂² + 4.23x₁x₂, and its stationary point is a saddle point with D = −29.98 at 81.3 °C, 19.6 min, outside the picture. With b₁ = 14.71 the slope is still large, so this spot needs more of stage 1 (climbing).
5. How the formula is built: solving for the stationary point
At the top, a small move in any direction leaves the height unchanged. That means the slopes in both directions (the partial derivatives) are zero. Here is that spot worked out step by step from the formula fitted to the nine points "Near the top" in the lab above.
Press "Next" to go one step at a time. A line is added to the formula (the orange background marks the new line), a line is added to the picture, and the reason appears below.
Written as formulas only, the steps above look like this.
- The fitted formula.
ŷ = 87.8 + 1.9x₁ + 3.16x₂ − 9.73x₁² − 6.83x₂² + 9.02x₁x₂. - Partial derivative in x₁, set to zero. Treat x₂ as a constant. x₁² becomes 2x₁ and x₁x₂ becomes x₂.
∂ŷ/∂x₁ = 1.9 − 19.46x₁ + 9.02x₂ = 0. Why: on this line a small move in x₁ does not change the height. These are the places where the contours lie flat. - Partial derivative in x₂, set to zero.
∂ŷ/∂x₂ = 3.16 + 9.02x₁ − 13.66x₂ = 0. These are the places where the contours stand upright. - Solve the two together. They are two linear equations, so they solve directly.
D = 4b₁₁b₂₂ − b₁₂² = 4 × (−9.73) × (−6.83) − 9.02² ≈ 184.46,x₁ = (b₁₂b₂ − 2b₂₂b₁) ÷ D ≈ 54.44 ÷ 184.46 ≈ 0.30,x₂ = (b₁₂b₁ − 2b₁₁b₂) ÷ D ≈ 78.6 ÷ 184.46 ≈ 0.43. In the original units that is165 + 15 × 0.30 ≈ 169.4 °Cand55 + 10 × 0.43 ≈ 59.3 min. The fitted formula gives 88.8% there.
The hidden true top is at 170 °C, 60 min, 90% (we can know this because the page made it up). Nine runs got within 1 °C and 1 minute of it. But the 88.8% predicted by the second-order formula is a little below the true 90%, because the hidden surface is not a second-order formula. That is why you run a confirmation at the spot you found.
6. A top, a valley, or a saddle?
A spot where the slope is zero is not always a top. The matrix of second derivatives of the second-order formula (the Hessian) is H = [[2b₁₁, b₁₂], [b₁₂, 2b₂₂]], and its determinant is the D above. The signs of D and b₁₁ tell the shape.
| Condition | Shape | Contours |
|---|---|---|
| D > 0, b₁₁ < 0 | top (a maximum) | closed ellipses, higher inside |
| D > 0, b₁₁ > 0 | valley (a minimum) | closed ellipses, lower inside |
| D < 0 | saddle (a saddle point) | cross in an X. Up in one direction, down in the other |
| D near 0 | ridge (a long crest) | long and roughly parallel. No single stationary point |
If you get a saddle or a valley, or the stationary point lies outside the region you experimented on, do not use that spot as the answer. "On the slope" in lab ② is such a case. Move the design that way and experiment again. With three or more settings you look at the signs of the eigenvalues of this matrix, and books call this canonical analysis.
7. Which to use when
| Option | Good | Bad | Use when |
|---|---|---|---|
| Plane + steepest ascent (corners + centre) | Few runs (5 for two settings). The centre point also checks curvature | Cannot solve for a top. Does not fit near the top | At the start, far from the best spot |
| Central composite design (axial points outside the range, α = 1.414) | Fits a second-order model. Reuses the stage 1 runs and only adds axial points | Axial points go outside the original range. Five levels per setting | Near the top, when you can run outside the range |
| Face-centred central composite design (α = 1) | Every point stays inside the range. Three levels per setting | Not rotatable | When equipment or safety limits stop you going past the ends of the range |
| Box-Behnken design | Avoids the corners where every setting is at an extreme at once. Three levels | Used with three or more settings. Hard to build on a stage 1 factorial experiment | When extreme combinations are dangerous or costly |
| One factor at a time (OFAT) | Easy. No calculation needed | Misses the top when the hill lies at an angle. Cannot see the twist (b₁₂) | Only when you know the settings do not affect each other |
8. Common mistakes
- Do not extend beyond the region you experimented on. The fitted formula is an approximation near your runs. "On the slope" in lab ② points to a stationary point at 81.3 °C, 19.6 min, where nobody ran an experiment, and it is not even a top. Read an answer outside the region only as "go that way and experiment again".
- Run a confirmation at the spot you found. Check whether the prediction (88.8%) and the confirmation run (90%) agree within the wobble. If they differ a lot, the formula does not describe that spot well.
- Changing one setting at a time can miss the top. From the start (110 °C, 25 min), hold time at 25 min and change only temperature, and 144 °C is best. Hold that temperature and change only time, and 48 min is best. The hidden yield there is 69.5%, far from the top (170 °C, 60 min, 90%). (Computed without wobble, in steps of 1 °C and 1 min.) The hill lies at an angle (b₁₂ is large), so following one setting at a time zigzags, and it takes many rounds to get close.
- The steepest direction depends on the scale. The direction (b₁, b₂) is set in coded units. Change the half-width (±20 °C instead of ±10 °C) and the arrow points a different way on the same surface. Choose half-widths that you expect to change the result by similar amounts.
- A quiet curvature check does not prove the plane fits. The curvature check estimates −(b₁₁ + b₂₂). If the surface curves down one way and up the other (a saddle), the two can cancel and the check comes out near 0.
Where it is used
- Finding process conditions. Change reaction temperature, time, pressure or concentration to find the conditions with the best yield or purity.
- Setting a recipe. Change the amounts of two or three ingredients in a food or a material to find the best taste or strength.
- Tuning settings. Running a machine or a program a few times with two or three settings changed, to find where the result is best, is the same idea. When each run is cheap, other methods that try many more points are also used.
Frequently asked questions
Is steepest ascent the same as gradient descent?
It is the same idea used the other way round. Gradient descent goes down the steepest way, and here you go up. The difference is how you get the slope. Gradient descent differentiates a known formula. In an experiment you do not know the formula, so you estimate the slope by fitting a plane to five runs. Each run costs money and time and its result wobbles, so you take few steps.
Why repeat the centre point?
Repeating the same settings lets you measure from the data how much the runs wobble. You compare the curvature check and the fit of the second-order model against that size. To keep things simple, the labs on this page run the centre point once and assume the size of the wobble (standard deviation 1) is known.
What if there are three or more settings?
The method is the same. With k settings the second-order model has (k + 1)(k + 2) ÷ 2 coefficients, so 10 for k = 3. A central composite design has 2^k corners, 2k axial points and the centre, so 8 + 6 + 1 = 15 points for k = 3 with one centre run. The stationary point comes from solving the k linear equations you get by setting each partial derivative to zero.
Words
| Plain words used here | Textbook term |
|---|---|
| setting | factor, independent variable |
| result | response, response variable |
| the surface the results form over the settings | response surface |
| approximating the surface to find the best spot | response surface methodology (RSM) |
| the scale with the centre at 0 and the corners at ±1 | coded units, coded variables |
| plane formula | first-order model |
| the steepest way up | (path of) steepest ascent; going down, steepest descent |
| centre point | center point |
| bend | curvature |
| formula with squared and cross terms | second-order model |
| corners + axial points + centre | central composite design (CCD) |
| point on an axis | axial point, star point |
| predictions wobble equally at equal distance from the centre | rotatable design |
| spot where the slope is zero | stationary point |
| saddle shape | saddle point |
| matrix of second derivatives | Hessian |
| changing one thing at a time | one-factor-at-a-time (OFAT) |
| trying the spot you found again | confirmation run |
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 5.3.3.6 Response surface designs.