Welcome back to our experimental design class. This is the start of module 6. This is based on chapter 6 in the textbook and it's all about the 2 to the K factorial design. Now, these designs are special cases of the general factorial which we talked about in module 5, chapter 5 of the book. There we focused mainly on the on the two factor case. Here, we'll talk about the general case of the 2 to the K factorial, that is K factors all at two levels. And these two levels are rather arbitrarily called low and high, and these factors could either be quantitative factors or they could be qualitative factors, either one. The treatment is very similar in both cases. These designs are very widely used in industrial, and scientific, and experiments in marketing and business. They are extremely powerful and useful in their own right, but they're also a building block that we can use to create other useful experimental designs. I sort of think of them as kind of like the DNA of designed experiments. These designs have a history that goes back into the 20s and 30s, and because of that there are some special shortcut methods for doing the analysis that facilitate doing ANOVA calculations manually. I'll show you a bit about that. But mainly we're going to make use of computer software, particularly JMP, in order to do this. This is the outline for chapter 5, and we're going to cover just about everything, at least the first eight sections of this chapter. Here's the simplest case of a 2 to the K factorial. Two factors, each at two levels, we would call this a 2 square design, or 2 to the 2. This is an example of one of these experiments. This is a real experiment in which we are looking at a response variable, which is metal recovery from a casting operation. And there are two variables here, reactant concentration and amount of catalyst. Now, the catalyst is actually a fluxing agent more than a catalyst. But basically, this is an operation that is done after a crucible of metal has been cast and there's extra metal left in that crucible. And after you've cast two or three pours, you want to get that remaining metal out of there and cast it as well. And so that's what's going on here. And the response variable is pounds of metal recovered. The reactant is a material that you add to try to facilitate liquefying the material in the crucible, and the fluxing agent is a fluxing or cleaning agent. This is a 2 square factorial, the low and high levels are denoted by minus and a plus sign. And remember, these names low and high are really rather arbitrary. The low level of reactant concentration was 15%, the high level with 25%. The the low level of catalyst or flux was one pound, the high level was two pounds. This fluxing or catalyst material was actually a powder that came in one-pound bags, and the standard recipe used one pound. This design, this experiment was replicated three times. So in each one of the corners of the square, you will see three numbers in parentheses. For example, at the lower left hand, you see 28, 25, and 27. Those were the pounds of metal recovered on each of the replicants. And then the sum of those three numbers is the 80 that you see there. So associated with each test combination, there is a single number which represents the total of all of the response values at that test combination. Now, look at the test combinations themselves. Notice that they have labels. The labeling system goes throughout the 2 to the K system. And here's how the labeling system works. If, at a particular test combination, a factor is at the high level, then the lowercase letter is included in that label. On the other hand, if at a test combination a factor's at the low level, then that lower case letter is missing from the label. So for example, if we look here at the lower right-hand corner, there we have a high and b low. So the label is a little a. Up here, we have be high and a low, so the label is a little b. And of course, here both factors were at the high level, so the label there is little ab. Now, the lower left-hand corner is a little bit different. That labeling scheme doesn't work very well there because the label would be a blank, and that doesn't work. You and I might be able to figure that out, but a computer might not. So the convention that's used is the test combination or everything is at the low level has a label of one, and the one is enclosed in parentheses so that you'll know it's a label rather than a number, rather than a number one. Here's the results from this experiment in sort of a more conventional kind of form. The left-hand side shows the test matrix, and you notice the four test combinations are represented by the minus and plus signs. And then, toward the right hand side of the table, you see the data from each replicate and then, of course, the total. When we analyze factorial designs, I think it's useful to have a step-by-step analysis procedure to guide you through the through the process. And here's a six-step process that will work very well in most cases. Step one, estimate the factor effects. We will see how to do that shortly. Then formulate the model that you want to use. Now, if you have a full factorial model, and you have replication, use the full factorial model when you do this step. Now, if designs are unreplicated, which we'll talk about later, there's a another couple of ways to do this. Then we do statistical testing to see which factors or interactions are significant. Analysis of variance is used to do this. We may end up having to refine the model by perhaps eliminating some terms that aren't important, or maybe going back and reformulating the model in some way. And we may loop through this process a couple of times until we think we've found the final model that best represents the data from the experiment. Then the next step is to check assumptions. That's typically analyzing residuals, graphical methods we've talked about can be used here as well. And then, finally, interpret the results and draw conclusions from the experiment that you've run. Estimating the factor effects, here's how we do that. Okay, for the two-factor factorial here, it's really easy. The estimate of factor a is the average of all the runs were a is at the high level minus the average of all the runs were a is at the low level. And if you go back and look at the design, that's all of these runs, the average of those runs minus the average of those runs. That turns out to be ab + a / 2n- b + 1 over 2n. And you can rearrange that in the form 1 over 2n times ab + a- b- 1. That term that you see here is called the contrast. And we can generate a contrast for every single factor effect. For example, b is y bar b plus minus y bar b minus, that's the average of all the runs at the top of the design, at the top of the square, minus the average of all the runs at the bottom. And so this is the contrast, the resulting contrast for the b main effect. And then the ab interaction is the right-to-left diagonal average minus the left-to-right diagonal average. And that, in turn, produces the contrast that you see here. You can look in the textbook for the manual calculations if you want to see those. The effect estimates here are quite easy to do. All you have to do is substitute the totals in for the letters that you see in the contrast, and remember that n is equal to 3, and you find that a is equal to 8.33, b is equal to -5 and ab is 1.67. Practical interpretation of this. Well, it looks like a is fairly large. a has a fairly large effect, large and positive. b has a somewhat smaller effect, but it's a negative effect. Increasing the amount of flux doesn't improve the pounds of metal recovered. And then there's a small interaction, ab, maybe it's statistically significant. And even if it is, I don't know how much practical value it has. That interaction effect is less than a third of the average of the absolute values of your main effects. So chances are that, even if it's statistically significant, it may not have a really big impact on the answer. Now, we're going to see how to do this via computer. By the way, here are the estimates of the effects again, shown in a tabular form. And I've also shown you the sum of squares for each factor. It turns out that the effect, Is always equal, To the contrast divided by half the number of runs. So if you can compute that contrast, the contrast divided by half the number of runs is always the estimate of the effect. And the contrast is also instrumental in calculating the sum of squares. The sum of squares is equal to the contrast, Squared divided by the total number of runs. So once you know the contrast, you can calculate the effect estimates and you can calculate the sums of squares quite easily without a lot of effort. Here is the ANOVA for this problem. I simply took the sums of squares and arranged them into an analysis of variants table. The total sum of squares computed in the usual way was 323, so the error sum of squares is 31.34, I get that by subtraction. Each one of your main effects and interactions has a single degree of freedom. There are 12 runs, so there are 11 total degrees of freedom. So by subtraction, there are eight degrees of freedom for error. Another way to see that is that there are three replicates at each test combination. Each one of those test combinations then produces two degrees of freedom for error because of the three replicates. Then there are four tests combinations, 4 times 2 is 8. The next column are the mean squares, that's simply the sum of squares divided by the degrees of freedom. Then we have the F ratio, those are the mean squares for ab, or ab divided by the mean square for error, and then the p-values. And from the p-values, we see that the main effects of A and B are, in fact, statistically significant, but there does not appear to be a significant AB interaction effect. Here is the computer output. This is from JMP, and a lot of this, I hope, looks kind of familiar. At the top of the page is a plot of actual versus predicted values, and you notice that the actual versus predicted values lie very close to that straight line. So indication that the fit here is pretty good. And then you have the effect summary, and you see that all of the p-values for the main effects are highly significant and there isn't any indication of interaction. Over in the right-hand column, there is the overall analysis of variance. Now, remember, the model here is actually the sum of the sums of squares for a, b and ab. And so the F statistic here is testing the hypothesis that at least one of those model terms is statistically significant. And it turns out that this portion of the display shows you the ANOVA tests on the individual effects. And clearly, once again, you can see that we have two significant main effects and a non-significant interaction. This portion of the display gives you the model regression coefficients. You're going to be able to fit a regression model to this data, and the model coefficients, the beta hats are equal to the effect estimate divided by 2. And we'll see that when we look at the regression equation later. Over on the left-hand side are residual plots. A plot of residuals versus predicted, a plot of residuals versus run order, neither of those plots convey any information about inequality of variance. Everything looks pretty good from the assumptions viewpoint. And the last thing you see over here on the right is the JMP prediction profiler. And this shows you how the response changes as you change the levels of concentration and flux. And if you're actually running this on the computer, you'll see that these graphs are interactive. Here's a following analysis, a follow-up analysis where I have eliminated the non-significant interaction. So this model really contains only the two main effects, and the results here are very similar to what we saw in the full model. Here are a couple of other residual plots. This is the normal probability plot that you see on the left, and there's another plot of residuals versus predicted that you see on the right. I think it's always helpful to use graphics for interpretation. On the left is a response surface plot of this fitted regression model. And since we don't have any interaction, the regression surface, the response surface is a plane and the contour plot that you get from looking down on that from above is shown on the right. And so this is showing you contour lines of constant pounds of metal recovery versus reactant concentration and catalyst amount. And you can see that as you increase the amount of reactant concentration and keep the amount of catalyst or flux low, that aids metal recovery. You get your best results in this region of the plot.