I left you with a number of questions to think about in the prior videos. How do we climb up the surface? Which direction should we go up? And how big should our steps be? How are we going to handle the nonlinear surface as we climb? And, when do we stop? Because remember, we don't have a map of what the surface looks like. So we need a way to know that we've reached the peak. Before we get start answering those questions, please take a look again at the course logo. It's going to show you what we've been working towards. The answers to all of those questions can be provided with a single, comprehensive case study. This case study runs for the rest of the module, and is split over several videos, starting with this one. You have all the tools now to climb the mountain, to optimize your system. Let's get going! In this case study, we are considering the manufacture of a mass produced product. For example, it could be plastic parts. Maybe it's frozen food such as pizza, petroleum, cars, metals, electronics. In fact, this example can apply to most anything that you can imagine. When goods are manufactured, a company can vary its production rate, measured as the number of parts per unit time. We call this throughput, and it will be factor T. Another variable the company can change is the selling price. This is our price measured in "dollars per unit". The outcome variable here is profit, measured as "dollars per hour". Now, I mentioned in a prior video, that if you're stuck thinking of a good outcome variable, the profit often works well. In this example, if we go to higher and higher throughput rates, we create more product. But our expenses to make that product also go up, we need more labour, more electricity, more material. And at higher throughput, we might also make more scrap. So, we could suffer some losses over there. At higher throughput, we also have more product now to sell. So my profit could go up, or it could go down. I'm really not sure. There is an optimally profitable point, not too fast, and not too slow. Another bonus is that the profit value is relatively easy to calculate if you have all the costs and incomes available. And it is relatively precise, there's a low amount of noise. So let's get going. Your company has been making parts for some time, at a production throughput of 325 per hour, and selling them for $0.75 per part. At these conditions, they make $407 per hour. Now let's run a full factorial around this baseline. We need to choose high levels and low levels for the factors. I'm going to pick these, 320 and 330 parts per hour for factor T, and $0.50 and $1.00 for the price, P. How did I choose these? What are suitable low and high level values? I will give this advice, based on my experience. And this won't always work, but it helps answer questions that I see experimenters struggling with. The range from low to high should be large enough that you notice a difference in the outcome. If you choose values too close together, you may not notice a difference, and you're just really picking up noise. If they are too far apart, you might cover such a wide range that you expose the system to serious nonlinearities. Let me give you an example of an experiment that uses water. If your current baseline is 25°C, then your low level might be 15 and your high level 35°C. If you went too far though, say from -35°C at the low and +85°C at the high. Now you cover a range where water has frozen down here, and is close to boiling up there. It's very nonlinear over this range. Secondly, consider the typical ranges of the variable. Everything we work with is finite, and there are extreme lower and upper bounds determined by safety constraints, physical limitations, and just practicality. Let's call these the extreme lower and upper bounds. For example in the previous video, we looked at the height of product on a grocery store shelf. There were limits of zero centimeters and two centimeters. In this example, we cannot sell the product for less than $0.25, else we'll make a loss. And we have an upper limit of about $3 in mind, based on market conditions. Never run your first experiments at these extreme points. Because remember, it will likely violate the previous rule of nonlinear behaviour. And secondly, the whole point of this optimization is that you move outside the box. If you are already at the extremes of the box, you cannot move outside of it. And lastly, if you're really stuck, pick a starting factorial range that is about 25% of the extreme range you calculated in the prior point. In this example, our equipment cannot really go much lower than 300 parts per hour, and cannot exceed 350 parts per hour due to safety issues. These are the physical limitations in the equipment's design. That's an extreme range of 50 units, so 25% of that is 12.5, and I'm going to round that down to 10. So my lower limit for the starting factorial is 325 - 5, and my upper limit is 325 + 5. That's how I came to that range. For the price, I'm going to use my business knowledge of the process and try $0.50 and $1.00 as the low and high levels, respectively. That corresponds to a $0.50 range, and when I compare it to the extreme range of $2.50, it's about 20%, so it matches that guide. You usually will have a good idea of what a low and high value should be based on your experience. So go ahead, use a large dose of intuition, and just try running a few experiments if you're not sure. Here's another expression from George Box that really is suitable for this situation. He said: "the best time to run an experiment is after an experiment". So let's go use that formula from class 5B that shows how to convert between real-world units and coded units. In this formula, the center point is just another name for the baseline. So the coded value for a low level of 320 is equal to (320 - 325) divided by half of 10, which equals -1. You can prove to yourself that the coded value for the high level is equal to +1. And you can also try proving to yourself what the coded values for price are. The coded value for the baseline is trivial to calculate. It is at the (0, 0) point. So we go ahead, and run off 4 experiments here in random order, but we will show them in the table in standard order. And here are the profit values as well. Take a minute now, and draw a cube plot of the system, showing these five values, and try to draw an approximate set of contours on the plot. Here's the solution for you. We can add contours using techniques we've seen in the prior videos, where we connect points that have equal value. This time though, we have a fifth baseline point to include in our contours. Now we can also use computer software to draw the contours. To do that we need the linear model first, so let's start R and add these five data points and build a single linear model. Here's the code, we have 5 entries in the vector this time because of that additional baseline point. But otherwise, it is the same as you've seen before. Click the button over here to run the code and it will generate the model. Now here is some additional code to draw the contour plot. The results show you what you might have expected intuitively, higher production rates lead to higher profits. Higher prices also lead to higher profit. But which direction should we move in next? Do we increase prices more? Or do we increase the throughput more? Or do we increase both, roughly equally? The concept of response surface optimization is that to reach the peak of the mountain efficiently, we should take the fastest way up, and the fastest way up is the steepest path of ascent. Now we don't actually know what the shape of the mountain is, but we do have these five data points here, using that idea of the ski pole from a prior video. These five points can be used to fit a local model, and that local model, even though it's going to be wrong, will be useful in telling us how to climb up the mountain. Let me show you by revealing the true profit surface shown here in the dashed grey lines. Superimposed in blue is the local model you've just built in R. Now this plot looks a little bit different than the contour plot from R, because I've used real world units on the axes. Otherwise it is pretty much the same. As you can see, this is a pretty realistic model of the underlying surface. It deviates a little bit down here in the bottom left and the top right, but overall it's telling us the right direction to go. Now in practice, we don't really know where these true contours in the dashed grey really are. But let's go use the model and test its prediction ability, and right at the center point, where the coded values are 0 and 0 for x_T and x_P respectively, we can use the model and predict a value of $390. Notice that the actual value at the center is $407. That's a $17 difference. It gives an idea of what statisticians call goodness of fit of the model. In other words, it tells us how well that model approximates the true surface. I'm going to ask you to remember that number. We can, and if we have time and money, we should repeat several experiments at the baseline to get an idea of the reproducibility, or noise, in the system. Now, pause the video, and use the model to predict the values of the four corner points in the factorial. You should see that there's prediction error of about $4 to $5. We will come back to all these points again, but for now let's go climb that mountain. The prediction model tells us which direction to go up. And the model shows a one unit increase in the coded value of selling price, x_P, raises profit by $134 per hour. For every one unit increase in the coded value of throughput, we should expect a $55 increase in profit. That's what that coefficient in front of x_T means. Now, what does it mean to say to increase by "one coded unit of throughput"? What does that mean in the real world? We have to communicate our results with our colleagues, and they don't understand coded units. Here's the connection between coded units and real-world units from before. And below it, I've written how you can determine a change in coded units, with a corresponding change in real-world units. There are those delta symbols again. So to answer the question then, one coded unit change in throughput, corresponds to a 5 part per hour increase. That implies increasing production by 5 parts per hour will lead to an increase in profit by $55. Similarly, a one coded unit change in sales price corresponds to a $0.25 increase in the real world. Now we can take the steepest path up the mountain, starting at the (0, 0) baseline. One can prove mathematically, the steepest path is perpendicular, or 90 degrees, with the contour line. A way of saying that mathematically, is every 55 steps we increase in throughput, we should also increase by 134 steps in price. So to keep that ratio in proportion, we can write the following mathematical equation. To use this equation, we pick either the change in P here in the numerator, and solve for the denominator change in T. Or we can pick the denominator change and solve for the numerator. Either approach works. I'm going to pick a change in T, and going to increase it by one coded unit from the baseline. So then, the change in coded units for P is 134 divided by 55 times 1. Let's convert these changes to real world units. For selling price, that's an increase of $0.61 per part. For throughput, that is an increase of plus 5 parts per hour, using our previous formula. So that's my fifth experiment, over here, with a throughput of 330 parts per hour, and a price of $1.36. Notice how this is a greater change in price, than the change is in throughput, and that's exactly correct in what we saw in the model. What are the corresponding x_T and x_P values for these in coded units? Using the formula from before, that corresponds to x_T equals 1 and x_P equals 2.44. It's always good practice, before we run the experiment, to predict what the outcome is going to be. Using those coded values, we can see that it's 390 from the baseline, and another $327 increase due to the price, plus $55 increase due to the throughput change. Finally, there's a small interaction that reduces profit by $8.50 so the total prediction here is $764. When I actually run the experiment though, I record a value of $669. That's a $95 difference. That's quite substantial. In fact, it's much larger than a single coded step in factor T, and just under the effect size of a coded step in factor P. That's a large deviation, and it indicates my model has broken down over here. If I keep going along this path of steepest ascent, I will end up in this general direction. But it really isn't worth exploring, because that direction we are climbing along is based on a model that we've shown needs some refitting. It is no different to the prior popcorn example. Recall in an earlier video, I mention that response surface methods are about sequential experimentation as we seek out the optimum. And the way we do that is to start a new factorial that better approximates the new region. So somewhere over here, we have to start a new factorial to refit the local surface. As with the first factorial, we can choose the range in real world units, that define the minus one and plus one positions. Once we pick the range, we have the center point defined as well. Now, there are several locations I could pick for this new factorial. In the course textbook, I show you one option, which is actually slightly further along the direction of steepest descent. That's a valid approach, and especially so if experiments are cheap. If we assume experiments are expensive, we might want to reuse as many of our prior factorial points as possible. And that's what I'm going to show. Place experiments 6, 7 and 8 over here. That decision means that my range for factor P is now fixed. I only have to select the range for factor T. Now, here's another tip. As you sense you're approaching the optimum, it is generally wise to reduce your step size. For two reasons, you don't want to overshoot that optimum, and secondly, remember the definition of an optimum is that it is at the peak of a mountain. Well, the peak of a mountain is definitely nonlinear. We want to retain a fairly linear model, if possible, as we climb that direction of steepest ascent. We're going to have to deal with nonlinearity at some point, and you'll see that in a coming video. For now, however, let's go select a smaller range here, for the throughput of eight units. So our low level is going to be 330 and our high level at 338 parts per hour. The range for factor P, the price, is already defined with a low of $1 and a high of $1.36, so that's a $0.36 range. The baseline is going to be right here, in the center. Now, I'm not going to show you the next steps in this video. I'm going to ask you to try the calculations yourself. Here are the outcome values from those new experiments. Use these data, and try to follow these steps. Start by visualizing the system. Then build a model in R, using these 5 new data points. Sketch some contours, either by hand, or with the software. Find the direction to climb up the path of steepest ascent. In the next video, I'm going to use a step of delta x_P of 1.5 units. So try that. What is the corresponding delta x_T? But if you want to use a different delta x_P, go ahead. Give that a try. What do these delta x_T and x_P values correspond to in real world units? Calculate what those are. Also predict what your next experiment's outcome is going to be. And finally, when you're ready to go run the experiments, go use this tool on the course website and run those experiments for yourself. If you're adventurous, go ahead and try climbing the rest of the mountain on your own.These experiments cost you no money and won't lead to any negative consequence if you get it wrong. This is the perfect opportunity to give that a try. Challenge yourself. Go see if the ideas from this class can be used to reach the peak and keep track of the number of experiments it takes you to get there. Also, try to answer this important question: "how do you really know that you're at the top?"