 Welcome back in this lecture we will be solving a few problems involving factorial design of experiments. The mini tab plots in this exercise set comprises of residuals, normal probability plots and the effects and their interactions. Number 1, a chemical reactor is used in a small scale industry for the production of an important ingredient in a popular perfume. The reactor operates at constant pressure of 5 atmospheres and is fed with the reactant. It is found from the design manual that the temperature of the reactor and the initial concentration of the reactant play important roles in the conversion to the required ingredient. Recruit freshly hired through campus placement, volunteers to study the reactor performance using the factorial design method. Follow her analysis in the following slides. So this is the data, you can see that it involves 2 factors temperature in degree centigrade and initial concentration in moles per liter. 8 runs have been performed, it is a 2 power 2 design repeated twice and the conversion values are given here and there are certain operating conditions where the conversion is pretty high at 96% and 93%. There are also certain conditions where the conversion is very low even going down to 3%. So it may be said that the performance of the reactor is sensitive to the operating conditions. To obtain an idea about the experimental error, the experiments have been repeated. So it is very important for us to first convert the given raw data into a coded format – plus or – 1 plus 1 format so that it is conforming with the factorial design scheme. So how do you do the coding? There are 2 levels of temperature at 200 and 400 degree centigrade. So the average would be 300 degree centigrade. So you have the coding formula t-t average divided by t max-t average. Average is 300 degree centigrade so we have t-300 divided by 400-300. Similarly the concentration values may also be coded and expressed as either minus 1 or plus 1. So we have c-c average divided by c max-c average which is c-45 divided by 60-45. The maximum concentration is 60 and the minimum concentration was 30 moles per liter, 60 and 30. So when t is t max the value would be plus 1 and when t is t min this will be 200-300 which is minus 100, minus 100 by plus 100 would be minus 1. Similarly here it would be c max would be 60 then this would become 1 and when c min is 30 that will be minus 15 by plus 15 that will be minus 1. So now we have coded the raw data, the experimental settings and this is what we have and we can also create a column of t-c0 which is the product of the elements in these 2 columns and we get 1 minus 1 minus 1 and so on. You can see that when both temperature and concentration are at the highest levels then that is called as setting AB. For setting A temperatures at level 1 and initial concentration is at minus 1. So obviously temperature is in factor A and c0 is factor B. There should be a correction here now that we have expressed these in terms of dimensionless variables we need to remove the units okay now they are in coded format. So we may as well call them as AB and AB. So this is the corrected version of this slide. So the temperatures and concentrations are no longer expressed in units since they have been converted into dimensionless form and they are expressed in coded form they simply take 1 and minus 1 values. For example AB again this is a repeat. So 1 BA and AB are the 4 corners of the square and again these experiments have been repeated. Even though they are expressed in the same sequence the experiments have been done through proper randomization so that any systematic effect is not influencing one particular run or a couple of runs. So experiments have been randomized and so here you have the conversions. Now how to calculate the effects we have already seen the table involving contrasts. So the contrast for A would be AB plus A minus B minus 1 AB plus A minus B minus 1 and that we divided by half because we are taking the average of AB and A and then subtracting it from the average of B and 1 and then we are dividing it by N also to account for the repeats. Similarly you can calculate the effect for B and the interaction effect AB also may be calculated. The effect is defined as contrast. The contrast is what we have inside these brackets divided by N where N is the number of repeats and 2 power k minus 1 k is the number of factors so this would be contrast divided by N into 2 to the power of 2 minus 1 which would be 2N and that is what we have here. So after we do the calculations correctly we get the main effect A as 19.5 the main effect B is 31 and the interaction effect AB is quite significant at minus 59. So in the model equation expressing the relationship between the conversion and the coded form of the variables A and B the effect value is divided by 2. The model equation indicates the change in response to a unit change in the variables or the independent variables in the equation. Now the effects have been calculated based on a change from minus 1 to plus 1 a jump of 2 units and hence we have to account for that change and so we divide the effect value by 2 to get the value of the coefficient. That is what the slide says and hence we have the coefficients as 19.5 divided by 2 that would be 9.75, 31 divided by 2 is 15.5 minus 59 divided by 2 minus 29.5 okay and hence we have the equation y hat is equal to beta naught plus beta 1 x 1 plus beta 2 x 2 plus beta 1 2 x 1 x 2. We have the hat over these entities y and betas to indicate that they have been predicted and hence we have y hat is 59.25 plus 9.75 x 1 plus 15.5 x 2 and minus 29.5 x 1 x 2. A word of caution about using these equations you cannot plug in the value of x 1 at let us say 1.5 and x 2 as minus 2 and hope this equation would give you the correct conversion. It may even give absurd conversions of exceeding 100% or below 0%. This equation is only meant for the range of variables studied. This is also true for any correlation developed from experimental data. The correlation is only valid in the range of the experimental data it considered and another thing about this correlation is we really do not know how well the correlation would predict for an x 1 value within the range. For example even though you are saying you are done the experiments at minus 1 and plus 1 what would happen if I substitute the value of 0 and 0 is lying within the range it is not outside the range of minus 1 and plus 1. So if I plug in the value of 0 will I get a proper conversion? You may or you may not because this is a kind of a fixed FX model and only applicable at the experimental conditions at which the runs were carried. And this is where we have the main effects for factors A and B. It shows that when the temperature rises from a lower level to a higher level the mean conversion increases and similarly when the initial concentration of factor B in the coded form changes from minus 1 to plus 1 the mean conversion also increases. So it looks like you perform the experiment at the maximum value of temperature and the maximum value of initial concentration to get the maximum conversion. But this is not the complete story. Here we see the interaction a strong one at that between the 2 factors. If the 2 lines had been parallel to each other then interaction effects could have been ignored. But the very fact that they are crossing one another indicates a very strong interaction between the 2 factors A and B. So this tells that at the lower level of temperature when the initial concentration rises from minus 1 to plus 1. So at the lower level of temperature when the initial concentration goes from a lower value to a higher value the percentage yield increases. But on the other hand when you perform the experiments at the higher temperature when the initial concentration rises from a lower level to a higher level the mean yield actually decreases. So the yield or the percentage conversion let me just check what percentage conversion. The percentage conversion depends upon the setting of the variables. If the temperature is at a lower setting then increasing concentration leads to higher conversion. On the other hand if the temperature is at a higher value increasing the initial concentration actually reduces the percentage conversion. So just do not go with the main effect plots because they seem to indicate that when you increase the temperature and the initial concentration the percentage conversion increases. It is more important to look at the interaction plots rather than the main plots as they are more indicative of the direction taken by a process to change in the level of the factors. Now we have to construct the ANOVA table or the analysis of variance table in order to see which of the effects are significant. By looking at the model equations coefficients we get a rough idea. We do not have to worry about the actual value taken by the factors because this is these values are coded. So the A is all minus 1 and plus 1 and B is also at minus 1 and plus 1. It is not as if one factor is in the order of thousands so its coefficient would be in the order of 10 power minus 3 whereas another factor is in the order of 1. So the coefficient would be in the order of again 10 power 0 or 1. So you cannot claim that factor B coefficient is higher than factor A coefficient. The coefficient sometimes have to also reflect on the value of the independent variable it is attached with. But when you do coding both the factors are varying from minus 1 to plus 1. They have been scaled nicely so that you do not have to really worry about the magnitude of the independent variables or the magnitude of the factors. So by looking at the coefficients themselves you can very well say whether a factor is likely to be significant or not. But in order to confirm this we have to do the analysis of variance or the ANOVA. Let us see how to calculate the ANOVA table for that we need the sum of squares. Again calculating the sum of squares is pretty easy it involves the contrast. We use the contrast for finding the effects we will also use the same contrast to find the sum of squares. So you have SSA is equal to AB plus A minus B minus 1 whole square divided by 4N. Sum of squares due to factor B would be AB plus B minus A minus 1 whole square divided by 4N. Please look at the table of contrasts or the design matrix and indeed confirm that the sum of squares are given by these formulae. The total sum of squares may be calculated by using this shortcut formula yijk square each entity in the table is squared. The sum of squares of error may be easily computed by taking the difference of the total sum of squares or taking the difference between total sum of squares and the combined sum of squares due to AB and AB. So this is very interesting and very straightforward. Please do the calculations using a spreadsheet or even a hand calculator and please confirm whether the results which I am going to show next are correct. So you have example one the sum of squares the main effect A is having a total sum of squares of 760.5, main effect B is having a sum of squares of 1922 and interaction effect AB is having sum of squares of 6962. The degrees of freedom associated with each of these would be 1 and the mean square would be you just simply divide the sum of squares by the degrees of freedom and you will get these values. Total sum of squares you can also use the shortcut formula I told you earlier. So you first find the deviation of each and every individual value from the mean and then that difference you square and when you sum the square of such deviations you get 9679.5. So the mean value is 59.25 sum of deviations is 0 and sum of squares is 9679.5. Please note down the values of the other sum of squares A is 760.5, B is 1922 and interaction effects AB is 6962 and the total value is 9679.5. To calculate the error sum of squares you can reduce or deduct the sum of squares of AB and AB from the total sum of squares that is one way of doing it. Another way of doing it also I am showing here. Here the repeats are having percentage conversions of 53 and 57. Please remember that repeats also indicate the same setting for both these runs. So 53 and 57 let us go back to the table 53 and 57 correspond to 460, 460 would be plus 1 plus 1 again this is plus 1 plus 1 the coded format you get 53 and 57% conversion. And so the deviation from the mean would be minus 2 and plus 2 the mean of course is 55. So the deviation from the mean is minus 2 and plus 2 the deviation squared is 4 and 4 and then the mean square would be 8 divided by 2 minus 1 that is only 8 arises from 4 plus 4 is 8 and then you are having n minus 1. So it is like taking the variance so it is 2 minus 1 and similarly 1886 would have an average value of 83 and so you have minus 3 and plus 3 which makes it 9 and 9 18 by 1. 96 and 93 would be 94.5 and so you have plus 1.5 minus 1.5 2.25 2.25 4.5 divided by 2 minus 1 where this 4.5 came from adding up 2.25 with 2.25. 3 and 6 will have an average of 4.5 again you get minus 1.5 and plus 1.5 3 minus 4.5 is minus 1.5 6 minus 4.5 is plus 1.5 and so the square of these 2 terms would be 2.25 plus 2.25 which is 4.5 divided by 1. So you add up all these things 26, 30.5, 31 plus 4, 35 so the sum of deviations square of the deviations would be 35 and once you have this you can find the error variance as nu i Si squared divided by nu i sum. Nu i is the degrees of freedom associated with each of the individual Si squared. So you are just calculating the variance of 53 and 57 and that you get as 8. So nu i would be 1 the degrees of freedom would be 1 so 1 into 8. So since all the degrees of freedom are 1 you get 35 1 into 8 plus 1 into 18 plus 1 into 4.5 plus 1 into 4.5 would be 35 as shown here divided by sum of the degrees of freedom would be 4. So the result would be 8.75 that is another way of doing it and so this is the overall sum of squares relation this is the total sum of squares and that is resolved or divided into the sum of squares contribution from factor A, sum of squares contribution from factor B and this represents the sum of squares contribution from AB and this is the error of sum of squares. So you have this and you can calculate the total sum of squares first calculate all these sum of squares and then calculate sum of squares of error or you can also calculate it independently as I have shown in the previous 2 slides. So we have 9679.5 is equal to 760.5 plus 1922 plus 6962 plus sum of square of the error and you can also see coincidentally that the sum of squares of the error based on this equation is 35 and this is exactly what we obtained by our independent calculations. So 2 plus 2 is 4, 4 plus 5 is 9 that matches here and then 6 plus 2, 8 plus 6, 14 plus 3 is 17. So that 7 matches here 8 plus 9, 17 plus 9, 26 so 6 matches here and 3 plus 6, 9. So 9679 and then this extra 0.5 is there so the totaling is correct and hence now that we have calculated all the sum of squares for the different factors we can divided by the number of degrees of freedom and get the mean square for AB, AB and also for the error. So you can find it as 760.5, 1922, 6962 and 8.75 here. Now we can carry out the F tests, the F statistic is given by mean square of the effect divided by mean square error and for A it is 86.91, for B it is 219.66 and for AB it is 795.66. These values are pretty high and so it is likely that these values are lying in the rejection region. Please remember that the null hypothesis we have taken is all the effects are negligible and the alternate hypothesis at least one of the effects is important and it contributes to the variability in the process. Now it can be seen from these F values which are pretty high that all these effects AB as well as the interaction they are likely to be important. So what we have to do is we have chosen alpha the level of significance at 0.05 which is a common value by default we can take it as 0.05 unless and otherwise specified AB into n-1. 2 repeats A into B is 4 and hence we have the denominator degrees of freedom in the F test to be 4 and the numerator degrees of freedom would be A-1 the levels of A are the levels of A is 2 and so we have 2-1. So numerator degrees of freedom is 1 for all the factors and the denominator degrees of freedom is 4 and we calculate all the F alpha values and if F actual is greater than F critical then we reject the null hypothesis and these are all the critical F values and the critical F value comes to be 7.71 you may verify this using the F distribution charts and the appropriate degrees of freedom in our case now it is 1 and 4 numerator and denominator degrees of freedom respectively and we are looking at that table corresponding to alpha is equal to 0.05 and this value comes as 7.71 but the actual value is much higher than this. So the F statistic is firmly lying in the rejection region and so we can reject the null hypothesis that factor A is insignificant, factor B is insignificant and the interaction between the 2 factors is also insignificant. So all the 3 hypothesis are rejected and hence we have to conclude that all the factors A and B as well as the interaction between them AB are significant. So now we can construct the ANOVA table here you have the source of variation from temperature initial concentration and the interaction between the 2 and then you also have the error source of variation and you have the sum of squares 760.5 1922 6962 35 and this adds up 9679.5 just checking it 2 plus 2 4 plus 5 9 6 plus 2 8 14 17 8 17 26 29 wait a second 5 2 plus 2 4 9 6 plus 2 8 14 17 8 17 26 correct 6 and then you have 3 plus 6 9 that is fine. Please check all the calculations at every intermediate step there is a likelihood that there may be a small error here and there anyway these values are correct as we saw 9679.5 and that is also the same value which we saw earlier 9679.5 so there is no problem here and you can see the degrees of freedom also listed we have 4 degrees of freedom for the error and it would be AB into n-1 A is 2 and B is 2 so 2 into 2 4 n-1 is 1 4 into 1 is equal to 4. So we have totally 7 degrees of freedom and then what we do is we divide the sum of squares by the degrees of freedom we get the mean squares we also get the f0 value and the f0 value is much higher than the f critical value so we reject the null hypothesis and this ANOVA table tells how we got all these numbers. So if you are stuck you may kindly refer to this table and see that the calculations have been done according to the formulae given here. So these are nice contour plots and this really tells that you get pretty high conversion when you are having high levels of initial concentration and low levels of temperature and also the contour plots are not showing any straight lines they shows considerable curvature which is also indicative of considerable interaction between the 2 factors. We will be now looking at example 2 in this example we will be looking at design involving 3 factors 2 level factorial design with 3 factors so basic set would be 2 power 3 which is 8 runs but we also need repeats to get an estimate of the experimental error. So the problem statement is the extraction of a medicinal compound from a certain leaves is carried out in an R and D facility the leaves cut to nearly uniform sizes are suspended in the aqueous solvent and well mixed with an agitator the temperature of the process vessel is maintained at a constant value the yield of the medicinal substance depends upon the rpm revolutions per minute of the stirrer particle size and temperature the experiments are conducted in triplicate that means we have a total of 8 x 3 24 runs the results are given in the table which will be shown in the next slide construct the ANOVA table and identify the significant effects analyze the residuals and the yield percentage of dry mass of the medicinal product depends upon the temperature rpm of the stirrer and the particle size. So these will represent the 3 factors for our experiment even though the results are reported in a same sequence in reality they were performed in a randomized fashion. So these are the results the temperature was either kept at 40 degree centigrade or at 60 degrees centigrade the rpm of the stirrer was at 200 rpm or at 400 rpm well you can go for higher rpm but there may be a possibility of vortex formation in the stirred vessel and for removing the vortices you may have to go for baffles apparently in this study the rpm was restricted to 400 perhaps to minimize or avoid the formation of vortices. And the particle size was either kept at 5 millimeters or at 20 millimeters and of course you can cut the particles to a smaller size but that would require more energy. You will cut the particle sizes into smaller and smaller bits to increase or improve the surface area for mass transfer. The percentage yield is pretty low but the probably the medicine is of rare type and hence expensive and hence even though the yield is at very low levels you may want to concentrate it further and then sell it off with due processing. The yield values are reported here in percentage of dry mass of the sample taken. This is the second set of repeats and this is the third set of repeats. The experimental conditions are the same but they have been repeated 3 times. So as before we have to convert the variables values into the coded form. Here the particle size is ranging from 5 to 20 and the rpm is ranging from 200 to 400 a factor of 40 to 80 times okay and here the temperature is changing from 40 to 60. So there is a considerable difference between the values taken by the factors. So to put them on the same basis we need to scale them and code them and that is what we have here. I have already told you the method for coding in the previous example following exactly the same methodology we can represent the coded form of temperature rpm and particle size as shown in these slides. So rpm would be rpm-rpm average which would be 300 rpm max-rpm average. So 400-300 divided by 400-300 would be plus 1. If it is 200, 200-300 is minus 100, minus 100 by 2 by minus 100 by plus 100 would be minus 1. Similarly, you have the coded form for the particle size. So you can now report the values in the coded form and this is the lowest level setting for all the 3 factors and that is represented by the symbol 1. A is represented by only A at a high level. So you have plus 1 here, minus 1, minus 1, B is at minus 1, plus 1, minus 1 and so on. And here you have the variability because of the 3 repeats. So you can see that there is some variability when you repeat the experiment. See when anyone reports the values as identical then there is some reason to doubt those data. There should be some variability in the reported results when they are repeated. So we construct the design matrix, A is equal to temperature, B is equal to rpm, C is equal to particle diameter. So we have I which is the column where all the entities are plus 1, A for 1 it will be minus 1, for small a it will be plus 1 and so on. For AB, A is at a higher level so it will be plus 1 for A. We have come across this several times in the previous lectures but just for the sake of completion let me do for factor A. All the factors are at the lower level so you have minus 1 here, factor A is at a higher level so you have plus 1, factor B is at a higher level so A is at a lower level so it is minus 1, AB both A and B are at the higher levels so A will be having plus 1, C A and B would be at the lower level so A would be having minus 1, AC both A and C would be at the higher level so A would be having plus 1, B and C except A both B and C would be at the higher level so A would be having minus 1, ABC all the 3 factors would be at the higher level so A would have plus 1. Similarly you can fill up the values for the other columns. So you have in addition to AB you have AB which is nothing but the product of the elements in each of the columns minus 1 into minus 1 you get plus 1 for AB for 1. So AB would be having plus 1 procedure and then you have ABC which is A into B into C minus 1 into minus 1 plus 1 into minus 1 minus 1. ABC obviously is also equal to AB into C. So setting up this table is quite straight forward. Now to estimate the main effects you adopt the same procedure you identify the table of contrast for each factor and their respective interactions and here you have A minus 1 plus AB minus B plus AC minus C plus ABC minus BC. This exactly corresponds to the table we saw earlier for A it will be minus 1 plus A, minus 1 plus A. Then you have minus B plus AB, minus B plus AB and then you have minus C plus AC minus C plus AC then you have minus BC plus ABC minus BC plus ABC. So setting up the factor A would be quite straight forward and that represents the average value of A at the higher level of A minus the average value at the lower level of A and so you can calculate the effect of A pretty easily. Similarly you can use the same methodology to calculate the effects of factors B and C. AB also the same procedure is involved. Please look at AB here you have ABC minus BC ABC minus BC same as what we saw in that equation and then you have minus AC plus C minus AC plus C and so on. I think you got the point minus A minus B plus 1 minus A minus B plus 1. So pretty straight forward and easy to calculate the effects. If you recollect it was n into 2 power k minus 1. So to calculate the effects you had to divide it by n into 2 power k minus 1 k here is 3 2 power k minus 1 is 2 power 3 minus 1 which is 2 power 2 4 4 into n. So that is what you have here. Similarly you can calculate the 3 factor interaction ABC and you can find the effect. Sum of squares of ABC and AB may be also found from the table of contrast. The same contrast is used and squared divided by 8 into n where n represents the number of repeats. You can do it for ABC AB and also BC AC and ABC. So that is what you have here. Every place the contrast is squared and then divided by 8 n as shown in this slide. So finally after having written all these things we can write down the model. This is the intercept so called intercept in the multi dimensional plane and this would be the coefficient associated with factor 1 or factor A coefficient associated with factor 2 or factor B coefficient associated with factor 3 or factor C. Binary interaction between A and B factors, binary interaction between A and C factors, binary interaction between B and C factors and then you also have the ternary interaction between AB and C given by beta 1 2 3. But before the hats here indicate that these are predicted. This is the predicted value using this equation involving the predictors beta 0 hat, beta 1 hat so on to beta 1 2 3 hat. Then you have the calculations carried out and you can find that the coefficients are 1.567 divided by 2. The effect of factor A is 1.567, effect of factor B is 0.453, effect of factor C is minus 1.347 and effect of factors interaction between factors A and B was 0.7. And as I said earlier since you are jumping from 1-1 level to plus 1 level we have to divide the effects by 2 to get the coefficients in this equation. So finally after all the calculation dust has settled we get y hat is equal to 3.5 plus 0.7833 x1 plus 0.2265 x2 minus 0.6735 x3 and so on. You can see that the interactions are of the same magnitude order of magnitude as the main effects for x1, x2 lower for x2 and x3 and 2 orders of magnitude lesser for the third level interaction between A, B and C. So I have summarized the effects, the coefficients on the sum of squares. I request you to do the calculations on your own using the formulae given in these slides and ensure that the values you get are matching with my values. I am reasonably sure or even pretty sure about my calculations but who knows even I may have made a mistake and if I had done so please bring it to my notice and I will correct it. So you have the value coefficient and sum of squares and the sum of squares are written down here. Obviously the sum of squares cannot be negative whereas the value and the effect value and the coefficient which is nothing but the effect value divided by 2 they may be either positive or negative. So this is where the main effects are plotted and they show a pretty consistent and monotonic trend. Temperature improves the yield, RPM improves the yield and particle diameter or particle size reduces the yield here. So if you increase the particle size the yield reduces that is what this graph is telling you which is also pretty logical. When you increase the temperature the mass transfer kinetics are improved and hence you have higher yield. When you have more RPM you have higher turbulence and hence the extraction is improved and when you decrease the particle size your interfacial area for mass transfer improves and hence the yield is also increased. So the values seem to be pretty logical here. When you look at the interactions this is the interaction between temperature and RPM this is quite interesting at low levels of temperature actually increasing the RPM brings down the yield. At high levels of temperature increasing the RPM increases the yield. This is quite interesting. So depending upon the level of temperature RPM is having a negative effect or a positive effect and this was not picked up by the main factor plots okay. Whereas on the other hand the interaction between temperature and particle diameter or particle size and the interaction between RPM and particle diameter or particle size is pretty much negligible. The interactions are not there because the lines are parallel. So when I am increasing the particle diameter irrespective of the level of temperature when I am increasing the particle diameter the yield decreases by the same amount so there is not much interaction in these 2 plots. So the error sum of squares okay before I go to that let me also tell you something. These are only for illustration purposes actually the interactions may become a bit complicated to understand when you have more factors for qualitative interpretation these kind of graphs are useful but they cease to be really so beyond a certain point beyond a certain number of variables okay. So when you have more than 3 factors you have to consider the interaction effects between A and B with the other factors like C and D kept at their average values. So even the computing of the interactions becomes a cumbersome task. So what we need to do in such situations is to rely on mathematical or statistical software and get those results and interpret them. We can also do the analysis of variance and quantify strictly the effects of the interactions and the main factors. So these are only for qualitative interpretation we have to do the analysis of variance and the F test to really see which interactions are significant which main factors are significant. So this completes the first part of our lecture we will continue shortly for the second part. Thanks for your attention.