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 (x1,…,xk) 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.

y=f(x1,x2,…,xk)+ε

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

x=ξ−ch

first-order model
A formula that approximates the response surface near the runs with a plane. The coefficients b are fitted by least squares.

y^=b0+b1x1+b2x2+⋯+bkxk

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.

y^=b0+∑i=1kbixi+∑i=1kbiixi2+∑i<jbijxixj

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.

∇y^=(∂y^∂x1,…,∂y^∂xk)=(b1,…,bk)

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

∂y^∂x1=∂y^∂x2=⋯=∂y^∂xk=0

central composite design
A design made of the corners (±1) of a 2k factorial design, 2k axial points that move one factor by ±α from the centre, and nc 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.

N=2k+2k+nc

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.

StageWhereFormula fittedRunsWhat you do
Stage 1Far from the best spotPlane (first-order model)Four corners + centreMove the steepest way up
Stage 2Near the top (when curvature shows)Second-order modelFour corners + four axial points + centreSolve 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=b0+b1x1+b2x2+b11x12+b22x22+b12x1x2

TermMeaning
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.

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.

y^=87.8+1.9x1+3.16x2−9.73x12−6.83x22+9.02x1x2

∂y^∂x1=b1+2b11x1+b12x2=1.9−19.46x1+9.02x2=0

∂y^∂x2=b2+b12x1+2b22x2=3.16+9.02x1−13.66x2=0

D=4b11b22−b122=4×(−9.73)×(−6.83)−9.022≈184.46

x1=b12b2−2b22b1D≈54.44184.46≈0.30,x2=b12b1−2b11b2D≈78.6184.46≈0.43

165+15×0.30≈169.4 °C,55+10×0.43≈59.3 min

  1. The fitted formula. ŷ = 87.8 + 1.9x₁ + 3.16x₂ − 9.73x₁² − 6.83x₂² + 9.02x₁x₂.
  2. 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.
  3. Partial derivative in x₂, set to zero. ∂ŷ/∂x₂ = 3.16 + 9.02x₁ − 13.66x₂ = 0. These are the places where the contours stand upright.
  4. 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 is 165 + 15 × 0.30 ≈ 169.4 °C and 55 + 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.

ConditionShapeContours
D > 0, b₁₁ < 0top (a maximum)closed ellipses, higher inside
D > 0, b₁₁ > 0valley (a minimum)closed ellipses, lower inside
D < 0saddle (a saddle point)cross in an X. Up in one direction, down in the other
D near 0ridge (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

OptionGoodBadUse when
Plane + steepest ascent (corners + centre)Few runs (5 for two settings). The centre point also checks curvatureCannot solve for a top. Does not fit near the topAt 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 pointsAxial points go outside the original range. Five levels per settingNear the top, when you can run outside the range
Face-centred central composite design (α = 1)Every point stays inside the range. Three levels per settingNot rotatableWhen equipment or safety limits stop you going past the ends of the range
Box-Behnken designAvoids the corners where every setting is at an extreme at once. Three levelsUsed with three or more settings. Hard to build on a stage 1 factorial experimentWhen extreme combinations are dangerous or costly
One factor at a time (OFAT)Easy. No calculation neededMisses 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

Where it is 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 hereTextbook term
settingfactor, independent variable
resultresponse, response variable
the surface the results form over the settingsresponse surface
approximating the surface to find the best spotresponse surface methodology (RSM)
the scale with the centre at 0 and the corners at ±1coded units, coded variables
plane formulafirst-order model
the steepest way up(path of) steepest ascent; going down, steepest descent
centre pointcenter point
bendcurvature
formula with squared and cross termssecond-order model
corners + axial points + centrecentral composite design (CCD)
point on an axisaxial point, star point
predictions wobble equally at equal distance from the centrerotatable design
spot where the slope is zerostationary point
saddle shapesaddle point
matrix of second derivativesHessian
changing one thing at a timeone-factor-at-a-time (OFAT)
trying the spot you found againconfirmation run

Sources

← Fractional factorials and confoundingANCOVA →