Expert system for statistical design of experiments
FIELD OF THE INVENTION 
     This invention relates generally to expert systems and more particularly to an expert system that interacts with users to statistically design experiments. 
     BACKGROUND OF THE INVENTION 
     Since its introduction by R. A. Fisher, the design of experiments has played an important role in agricultural and scientific studies. Genichi Taguchi has recently renewed the interest of product and process engineers in design of experiments techniques. 
     Design of experiments is the first step in a process to evaluate how factors influence response variables. An experiment design may be defined as a data collection sheet which specifies how the values of the input factors of the experiment are to be set for each trial of the experiment. This data collection sheet is an essential ingredient for accurate, efficient experimentation. To produce an efficient experiment design the statistician makes use of a statistical analysis software package, such as for example, SAS available from SAS Institute. They may then go further and evaluate this design by hand, a long and tedious process even with the use of a computer. 
     Currently expert systems are available for designing experiments but are limited to selection from a limited class of designs. See for example, &#34;An expert system for experimental design in off-line quality control&#34; by Lee, Phadke, and Keny in Expert Systems, November, 1989, Vol. 6, No. 4 page 238. Prior to this invention there were no other means available for automatically generating and analyzing the power of balanced experimental designs. Rather than forcing the user to accept one of a predetermined set of experiment designs, the expert system of the present invention generates a design meeting the user&#39;s requirements and evaluates that design. 
     SUMMARY OF THE INVENTION 
     In accordance with the present invention an expert system is provided which can interface with a client to generate and analyze balanced designs using a linear models approach, expert reasoning abilities, and existing software packages. The expert system of the present invention emulates the role of a consulting statistician, interacting with the client to gather information needed to generate the descriptive mathematical model and physical layout of the experiment. 
     The role of the expert system of the present invention is to bridge the gap between the user, an engineer who is inexperienced in statistical techniques, and the SAS package. It interacts with the user to identify the goal of the experiment, the input factors involved, how they relate to one another, whether there are nested factors (i.e. factors whose levels depend on the levels of other factors). Once the necessary information has been collected from the user the expert system writes appropriate SAS code to generate an experiment design. The results returned from these procedures will constitute enough information to produce an experimental design. 
     However, before producing a data collection sheet, the expert system evaluates and refines the design through the use of a mathematical model. The expert system advises the user about any problems with the design, presents alternatives for improving the design, and identifies advantages and disadvantages of each alternative. Once the user is satisfied with the tradeoffs associated with a particular experiment design, the expert system generates the data collection sheet of that design. When this data collection sheet has been filled in with actual experimental results, it requires only a simple call to a few SAS procedures to determine which particular input factors or interactions affect the response variable(s). 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The above and other advantages of the invention will become more apparent from the following description taken in conjunction with the accompanying drawings wherein like references refer to like parts and wherein: 
     FIG. 1 is a generalize flow chart of the present invention. 
     FIG. 2 and 3 are forms for gathering user inputs. 
     FIG. 4 is a form for displaying design information. 
     FIG. 5 is a form for displaying analysis information. 
     FIG. 6 and 7 are forms for gathering user inputs. 
     FIG. 8 is a form for displaying analysis information. 
    
    
     DETAILED DESCRIPTION 
     Referring now to the drawings and initially to FIG. 1, the expert system of the present invention requires five basic pieces of information. In the preferred embodiment the expert system is primarily programmed in KEE, a Lisp based knowledge engineering environment, running on a Sun 4 Workstation. The inputs required, as indicated by block 10, are: 
     1. The goal of the experiment, which must be one of the following: 
     a. Complicated Influence 
     b. Screening 
     c. Robust Design 
     d. Model Response 
     2. The Response Variables, which are the names of the numerical measurements which will be taken after each trial of the experiment--there must be at least one. 
     3. The Factors, which are the names of the variables in the experiment--those things which the experimenter changes from one trial to the next. 
     4. Factor Properties, i.e. information which is required about each factor&#39;s statistical properties and (potentially) about possible interactions between different factors. The information required will differ somewhat depending on the type of experiment. 
     5. Run Order Restrictions wherein the user restricts the order in which the experiment trials may be run in order to make the experiment more practical. This restriction is represented as an ordered list of factors, hardest to change factors listed first. 
     Some additional information may be required depending on the type of experiment. This will become apparent hereinafter. 
     The data as input by step 10 provides the necessary information to generate the design as indicated in block 12. The method for generating the design will depend on the goal of the experiment. 
     The design generation block 12 provides the necessary information to produce a math model representation of the experiment as indicated at Block 14. This model consists of the addition of a series of terms which represent the effect of: 
     1. Factors 
     2. Factor Interactions 
     3. Restrictions on Run Order 
     4. Experimental Error 
     The inputs of step 10, the design generated in step 12 and the math model generated in step 14 provide the basis for evaluating the experiment design as indicated in block 16. For each term in the math model a detectable difference (delta) value is calculated. This information helps the user determine whether or not an experiment is worthwhile before it is run. 
     The calculations in block 16 are displayed to the user in a forms interface as indicated in block 18. A suitable forms software package is available from IntelliCorp. The system also provides an English summary of the design information upon request. 
     Having viewed the design, a user may wish to make modifications to the original input information of block 10 in order to produce a design which better suits their requirements. Upon request, the expert system suggests potential ways to modify the input information to achieve desired design objectives as indicated in block 20. 
     Once a design is approved a layout sheet is produced as indicated in block 22 which serves as a detailed plan for how to run the experiment. For each trial of the experiment the layout sheet lists the combination of factor levels (settings) and leaves space for recording the results in terms of response variable values. The layout sheet is produced using the SAS package. 
     After the user runs the experiment and collects results, the expert system analyzes the experiment data as indicated in block 24. The type of analysis used will depend on the goal of the experiment. 
     The calculations in block 24 are presented to the user in a forms interface as indicated at block 26. 
     COMPLICATED INFLUENCE 
     Inputs (block 10) 
     When the complicated influence goal is selected by the user, inputs are gathered from the user through a series of interactive forms which are shown in FIGS. 2 and 3. The factor information is stored in the KEE frames structure. A class unit is set up, called FACTORS which contains slots for storing critical information about the factors of the experiment. Each factor is represented as an individual unit which is a child of the FACTORS class. Each child of the FACTORS class inherits slots for storing the user&#39;s input. The following slots store the critical information for each of the user&#39;s factors in complicated influence: 
     1. Abbreviation--a short string used to represent the factors effect in the math model representation. 
     2. Number of Levels--The number of distinct values that each factor can take on. 
     3. Type--Must be either fixed or random. A factor is fixed if a specific level for that factor is selected and inferences are to be made about that specific level. A factor is random if the level is representative of an entire population and the inference is to be made to the population, not the specific level. 
     4. Quantitative-or-Qualitative--A factor is quantitative if it has meaningful numbers associated with its levels. Otherwise it is qualitative. 
     5. Nesting--A random factor may be nested in one or more other factors. This implies that the levels of this factor will depend on the levels of another factor or factors. 
     6. Sliding--A fixed factor may be sliding in one or more other factors. This implies that the levels of this factor will depend on the levels of another factor or factors. 
     In addition to information on individual factors the user also enters the number of repetitions (i.e. number of times each combination of factor levels will be run in the experiment) and any run order restrictions (i.e. an inability or disinclination to change the levels of a factor frequently from one experiment trial to the next). 
     Generate Design (block 12) 
     Complicated influence experiments begin by generating a full factorial design. Every possible combination of factor levels is represented in this design. 
     Generate Math Model (block 14) 
     A full Mathematical model that includes all possible factor interactions, is generated to correspond with this design. This is generated using the following algorithm. 
     1. Start with the first factor abbreviation, for example A, and attach the lower case subscript i yielding A[i]. 
     2. (Non-nested case) Take the next factor abbreviation, for example B, and attach the next subscript (alphabetically) and form all interactions with the previous terms. For example, add B[j] yielding the terms A[i), B[j), and AB[ij]. Continue in this fashion for all non-nested factors. 
     2. (Nested-case) For nested factors attach the next subscript (alphabetically) but also attach the subscripts associated with all nesting factors inside the parentheses. For example, if C were nested within A, use the notation C[k(i)]. If C were nested in A and B use the notation C[k(i,j)]. Again form the interaction with all other terms separately combining subscripts outside parentheses and inside parentheses. Do not include any terms that have the same index inside and outside the parentheses. For example, if B were nested in A, and D within C, the complete set of terms would be A[i], B[j(i)], C[k], AC[ik], BC[jk(i)], D[l(k)], AD[il(k), and BD[jl(ik). AB[ij(i)] is not included because i appears inside and outside the parentheses. 
     3. Restrictions on run order randomization are included in the mathematical model as follows. If the factor abbreviated as A is restricted this indicates that complete randomization is replaced by the process of selecting a level of A and running all factor levels combinations involving this level before selecting another level of A. This is denoted with the addition of a random term &#34;restr&#34; having one level and nested in A. Restriction error terms do not interact with any other term in the model. If it is desired to restrict both A and B (equally) then this would cause a restriction to fall on the AB interaction. If A is harder to change than B, we can add to restrictions--one on A and another on the AB interaction. 
     4. All effects in the experiment which are not fixed at a given level and not related to the input factors are represented by the error term which is nested in every other factor. Thus the error term for a three factor experiment would be error[l(ijk)]. 
     The mathematical model for the experiment then becomes the sum of all the individual terms. For example, an experiment with two factors A and B having no nesting or restrictions would have the following mathematical model: 
     
         A[i]+B[j]+AB[ij]+error[k(ij)] 
    
     Design Evaluation (block 16) 
     The mathematical model generated (block 14) and the inputs (block 10) and the design (block 12) are the basis for evaluating the properties of the design. These properties include: 
     1. Degrees of Freedom for each Term (df) 
     2. The type of test available on each Term 
     3. The terms testing each Term 
     4. The test degrees of freedom for each Term 
     5. The detectability of each term (delta) 
     6. A classification for the detectability for each term 
     7. The Expected Mean Squares for each term (EMS) 
     8. The required experiment size (number of runs) 
     Since all of these designs are balanced, the df are computed using well-known formulae, e.g. Peng, K. C. (1967), The Design and Analysis of Scientific Experiments. The formulae depend on the number of levels for each factor and the nesting pattern. The total experiment size is simply the product of the levels of each factor times the number of repetitions. The remainder of the calculations are based on the EMS. 
     The calculation of the EMS is based on an algorithm published by Lorenzen, T. J. (1977), Derivation of Expected Mean Squares of Fetests in Statistical Experimental Design, Research Publication GMR-2442: Mathematics Department, General Motors Research Laboratories, Warren Mich. 48090-9055 incorporated herein by reference. This algorithm is equivalent to the standard algorithm given by Bennett and Franklin (1954), Statistical Analysis in Chemistry and the Chemical Industries. The EMS&#39;s are represented as a square matrix with dimension equal to the number of terms in the mathematical model. Each row corresponds to a given term in the mathematical model. The matrix is filled with zeros and ones. The matrix is set up so that all values below the diagonal are zero. A one in a column indicates the corresponding column term is in the EMS for that row term. If df =0 for a term, all elements in the corresponding row are 0. Separate vectors store the coefficients associated with each column and whether the row terms are fixed or random. The square matrix, coefficient vector, an term type vector completely determines the EMS for each term. For a detailed example, see page 9 of Research Publication GMR 7111 dated Jul. 31, 1990 by Lorenzen and Truss available from the General Motors Research Laboratories, Warren Mich. 48090-9055, which is incorporated herein in its entirety. 
     The next step is to determine the type of test available on each term. The test is a ratio. The numerator is the row of the matrix which represent the EMS of the term we are trying to test and the denominator refers to the row of the matrix which represents the EMS of the term which provides the test. 
     DIRECT tests are looked for first. A term Y directly tests term X if the EMS for Y equals the EMS for X with the X component (diagonal element) set to zero. 
     If there is not a direct test available then the expert system looks for an APPROXIMATE test. An APPROXIMATE test is a linear combination of terms whose EMS form a DIRECT test. With a square matrix, add and subtract linear combinations of rows to equal the row corresponding to x with the diagonal element set to zero. The approximate df associated with this test is the harmonic mean of the terms involved in the linear combination. The search algorithm to find this linear combination is as follows: 
     1. Start with the row in the matrix corresponding to the term of interest. Call this row R. 
     2. Set the diagonal element of R to zero. 
     3. Find the first non-zero element in R. Call this element [e] 
     4. Find the corresponding row in the matrix which has zeros to the left of column (e) and a 1 in column [e). Call this row S. 
     5. If R[i]=1 then subtract S from R. if R[i]=1 then add S to R. 
     6. Continue with steps 3,4, and 5 until there are no non-zero values left or no row can be found in step 4. In the first case, you have determined an APPROXIMATE test (based on the columns used in the addition or subtraction). In the second case, there is no approximate test available. 
     If there is neither a DIRECT nor an APPROXIMATE test, next look for a conservative test. There are two types of conservative tests: CONCLUDE SIGNIFICANT ONLY and CONCLUDE INSIGNIFICANT ONLY. A CONCLUDE SIGNIFICANT only test occurs when the denominator contains an extra term and is therefore too big. If the test is significant with a denominator that is too big, then the test with a proper sized denominator would surely have been significant. If the test is insignificant, perhaps the term being tested is insignificant or perhaps the extra term in the denominator is significant. You cannot tell. That is why the test is CONCLUDE SIGNIFICANT ONLY. 
     A CONCLUDE INSIGNIFICANT ONLY test type has one extra term in the numerator (one too few in the denominator). If the test is insignificant, then both terms in the numerator are insignificant; so in particular the tested term is insignificant. If the test is significant, we cannot tell which term is the cause. 
     Having computed all possible tests (both test type and term tested by) the next step is to compute the minimal detectable difference. The minimal detectable difference is the magnitude of an effect that can be detected by this experiment design. In particular, we assume an alpha error of 0.05 and a beta error of 0.10 and express the minimal detectable difference as the number of standard deviations of the denominator in the test. For example, a minimal detectable difference of 2.0 means the effect of that term must be twice as big as the denominator in the test in order to be 90% certain the experiment will declare it significant. The minimal detectable difference depends on four quantities: the df for the numerator, the df for the denominator, the coefficient preceding the term in the EMS, and whether the term is fixed or random. In particular, the minimal detectable difference (delta) for a fixed term is given by ##EQU1## where lambda is the non-centrality parameter of the non-central F distribution achieving alpha error =0.05 and beta error =0.10, and C the coefficient from the EMS. For a random term delta is given by ##EQU2## where F represents the central F distribution. For significant only tests a heuristic correction is made to the delta value. If the extra term in the denominator is a two factor interaction, then 0.5 is added to delta. If it is a three factor interaction then 0.25 is added. Otherwise the delta is unchanged. To help the user in understanding minimal detectable differences, we categorize the deltas according to the following scheme: ##EQU3## 
     Within the expert system the results of this design evaluation are represented in KEE frames. A class unit is set up, called TERMS which contains slots for storing critical information about the terms of the math model. Each term is represented as an individual unit which is a child of the TERMS class. Each child of the TERMS class inherits slots for storing the calculated values. Thus, for each term, there are slots available for storing degrees of freedom, test type, minimal detectable differences, etc. 
     Communicating the Design (Block 18) 
     FIG. 4 shows a sample screen which summarizes the design information calculated in block 16. 
     The system also provides an English summary upon request. For example, the English summary of the design displayed in FIG. 4 would be as follows: 
     &#34;The following terms have a direct test: main effects, and AB. This is the best type of test. The following terms have medium detectable differences in this design: main effects, and AB. This means that you have moderate information available on these terms.&#34; 
     Redesigning (Block 22) 
     Once the user has viewed the initial design they may wish to change some of the input characteristics to achieve the appropriate delta while still keeping the experiment cost within budget. The user has the option of changing the design in any one of several ways: 
     1. The user may change the original input information directly by going back to the Experiment Information form (FIG. 2). 
     2. The user may ask the system to find a design with the appropriate detectable sizes. If so, the system does a state space search (varying the number of factor levels for each factor) using branch and bound search with a dynamic programming algorithm Artificial Intelligence by P. H. Winston (1984) . The system returns the smallest design satisfying the user&#39;s criteria for delta. 
     3. The user may tell the system to assume some terms negligible in its calculation of tests in block 16. Those terms which the user specifies will automatically be set to zero in the EMS matrix thus allowing more tests to be found. These assumptions may later be verified during data analysis. 
     4. The user may fractionate the design. The process of fractionation will be described hereinafter under the Screening goal. 
     The expert system suggests potential changes to a design based on a set of forward chaining rules. A copy of the rule set for non-regression experiments is shown in Appendix A. 
     The expert system stores all designs which are generated during the redesign process. This is accomplished through a &#34;worlds&#34; mechanism (KEE feature) which provides the means of representing context. Every value which is calculated and stored in the expert system is context dependent. The context will change depending on which design the user is working with. As an example Term AC[il]may have the value 5 for its degrees of freedom slot in Design 1, and have the value 6 for its degrees of freedom slot in Design 2. The unit and slot are the same but the context (design world) is different. 
     Each design inherits all information from its parent design (the design from which it was created). User changes and values calculated from user changes override this inheritance. This provides an efficient means of storing a large number of design alternatives at once. 
     Creating a Layout Sheet (Block 22) 
     Once the user approves a design, a layout sheet may be generated. This layout sheet acts as a blue print for the experiment, describing exactly which combinations of factor levels to run and in what order to run them. 
     The expert system obtains from the user the level settings for each of the factors and then writes an input program in SAS code to generate the layout sheet. The expert system calls SAS from KEE via UNIX. This is done in the following manner: 
     1. Create flat Unix file &#34;infile&#34; (SAS program) 
     2. Call SAS on the program specified in &#34;infile&#34; 
     3. SAS produces &#34;outfile&#34; as per &#34;infile&#34; instruction. 
     4Read &#34;outfile&#34; Shown below is example SAS code for an experiment which two factors A and B. The levels for A are 1,2,3, and 4 and the levels for B are one and two. 
     
         ______________________________________                                    
filename outfile &#39;/ . . . ;                                               
filename outfile2 &#39;/ . . . ;                                              
filename prntfile &#39;/ . . . ;                                              
proc printto print=prntfile log=logfile new;                              
data .sub.-- sheet.sub.-- ;                                               
Y = `.sub.---- `;                                                         
do .sub.-- A =1 to 4;                                                     
do .sub.-- B =1 to 2;                                                     
do .sub.-- rep .sub.-- =1 to 2;                                           
.sub.-- random.sub.-- =ranuni (0);                                        
output;                                                                   
end;                                                                      
end;                                                                      
end;                                                                      
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
length                                                                    
 B $ 4;                                                                   
if .sub.-- A = 1 then A = 1;                                              
if .sub.-- A = 2 then A = 2;                                              
if .sub.-- A = 3 then A = 3;                                              
if .sub.-- A = 4 then A = 4;                                              
if .sub.-- B = 1 then B = `one`;                                          
if .sub.-- B = 2 then B = `two`;                                          
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
label                                                                     
 A = `A`                                                                  
 B = `B`                                                                  
 Y = `Y`                                                                  
run;                                                                      
proc sort;                                                                
by .sub.-- random.sub.-- ;                                                
run;                                                                      
proc fsprint;                                                             
var  A B  Y;                                                              
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
file outfile;                                                             
put .sub.-- n.sub.--  A B  Y;                                             
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
file outfile2;                                                            
put .sub.-- n.sub.--  A B .sub.-- rep.sub.--  ;                           
run;                                                                      
The input code directs SAS to create the                                  
layout sheet which is shown below.                                        
OBS  A     B      Y                                                       
1    4     one    .sub.----                                               
2    3     one    .sub.----                                               
3    1     one    .sub.----                                               
4    2     one    .sub.----                                               
5    3     two    .sub.----                                               
6    3     two    .sub.----                                               
7    1     two    .sub.----                                               
8    2     two    .sub. ----                                              
9    4     two    .sub.----                                               
10   4     two    .sub.----                                               
11   2     one    .sub.----                                               
12   1     two    .sub.----                                               
13   1     one    .sub.----                                               
14   2     two    .sub.----                                               
15   3     one    .sub.----                                               
16   4     one    .sub.----                                               
______________________________________                                    
 
    
     In this layout sheet the numbers in the left hand column are observation numbers. The blanks in the far right hand column indicate spaces for the user to record the observations from the experiment. 
     Analysis of Data (Block 24) 
     Once the user returns with experimental data, the expert system writes SAS code to do the analysis. As an example, for the experiment with factors A and B, no nesting, the following represents the relevant SAS code for computing Sums of Squares over the data set. 
     
         ______________________________________                                    
1    infile datafile;                                                     
2    input .sub.-- num.sub.--  A $ B $ Y1;                                
3    run;  /* input data from file */                                     
4    proc glm outstat = stat.sub.-- s;                                    
5    class A B;                                                           
6    model Y1 = A B A*B / ss1;                                            
7    output out=pout;                                                     
8    run;  /* calculate sums of squares */                                
9    data stat.sub.-- s; set stat.sub.-- s; file statfile;                
10   put `((&#34;` .sub.-- source.sub.--  `&#34; ` .sub.-- name.sub.--  `) ` ss   
     df  `)`;                                                             
11   run; /* output sums of squares and df to a                           
           file called statfile */                                        
______________________________________                                    
 
    
     The math model representation generated in block 14, easily converts to the SAS model specified in line 6. The sum of squares values output to a file for each term in line 10 are read back in by the expert system after the SAS program finishes running and are stored in slots for each term. From the Sum of Squares and information previously determined in creating the design, the expert system uses standard formulas to compute the mean Squares, F Tests and P Values for each term in the model. 
     Communicating the Analysis (Block 26) 
     In FIG. 5 a sample screen is displayed which shows how the user sees the summary of analysis information calculated in block 24. 
     SCREENING 
     Inputs (Block 10) 
     When the goal is Screening the inputs gathered from the user in block 10 include those used in complicated influence. The user is also required to enter information about the interactions between the factors to be studied. This information is input through the KEE form shown in FIG. 6. The user tells the system which terms are of interest and which terms are not to be confounded with terms of interest. Optionally the user may specify a maximum experiment size, factors which are expensive (or inexpensive) to generate combinations for, a maximum term order to study, or any terms to be assumed negligible. 
     Design Generation (Block 12) 
     Fractionation is the procedure for finding the smallest experiment which studies the terms of interest without violating any other user restrictions on confounding. There are two modes of doing fractionation in the expert system of the present invention. The first is to minimize the number of runs based on a set of user constraints for terms of interest the second is to find the maximum information given a maximum experiment size. 
     Mode 1. Minimize Total Experiment Size 
     The user supplies two sets of terms: interesting (terms of interest) and non-negligible (terms not confounded with terms of interest). The set of interesting terms consists of all terms that the user thinks may be important and wants to estimate. This set includes all main effects plus all user-specified interactions: two factor interactions, three factor interactions, etc. The set of non-negligible terms consists of all other terms that could have an effect on the response variable. The set of interesting terms will not be confounded with themselves nor with any non-negligible term. However, the non-negligible terms can be confounded among themselves. 
     To find the smallest balanced design, the expert system starts by decomposing each factor into its prime components. For example, if A has six levels, break A into Al having two levels and A2 having three levels. Next, translate interactions on the original factors into interactions on the prime components. Separately collect all interactions having the same prime components and find the smallest design meeting the requirements. The expert system uses the SAS procedure FACTEX to find the smallest design for each of the individual prime components. The expert system then crosses all of the components. The interactions involving different prime components are automatically estimated by the nature of the crossing. 
     An example helps illustrate the procedure. Suppose factor A has 2 levels, B has 4 levels, C has 3 levels, and D has 6 levels. Suppose the interesting set consists of the main effects only and the non-negligible set is empty. Break B into B1 and B2 each at 2 levels. Break D into D1 at 2 levels and D2 at 3 levels. The entire interesting set becomes A, B1, B2, B1B2, C, D1, D2, and D1D2. The interesting set for the 2 level primes is (A, B1, B2, B1B2, D1). The interesting set for the 3 level primes is (C, D2). 
     Input SAS code for the FACTEX procedure for the above experiment is shown below. For a more detailed example of this procedure, see pages 11-14  of the aforementioned Research Publication GMR 7111. 
     
         ______________________________________                                    
FILENAME OUTFILE &#34;/ . . . &#34;;                                              
FILENAME NOTESFIL &#34;/ . . . &#34;;                                             
PROC FACTEX NOCHECK;                                                      
TITLE `2`;                                                                
FACTORS A .sub.-- 2.sub.-- 1B .sub.-- 2.sub.-- 2B .sub.-- 2.sub.-- 1D     
/NLEV=2;                                                                  
SIZE DESIGN = MIN;                                                        
MODEL ESTIMATE = (A .sub.-- 2.sub.-- 1B .sub.-- 2.sub.-- 2B .sub.--       
2.sub.-- 1B*.sub.-- 2.sub.-- 2B .sub.-- 2.sub.-- 1D);                     
EXAMINE ALIASING (4);                                                     
OUTPUT OUT = TMP1                                                         
[ A]=A2 NVALS=(1,2)                                                       
[ .sub.-- 2.sub.-- 1B .sub.-- 2.sub.-- 2B]=B2 NVALS=(1,2,3,4)             
[ .sub.-- 2.sub.-- 1D]=D2 NVALS=(1,2);                                    
RUN;                                                                      
PROC FACTEX;                                                              
TITLE `3`;                                                                
FACTORS  C .sub.-- 3.sub.-- 1D /NLEV=3;                                   
SIZE DESIGN = MIN;                                                        
MODEL ESTIMATE = (C .sub.-- 3.sub.-- 1D);                                 
EXAMINE ALIASING (2);                                                     
OUTPUT OUT = TMP2 OUTER.sub.-- REP=TMP1                                   
[ C]=C3 NVALS= (1,2,3)                                                    
[ .sub.-- 3.sub.-- 1D]=D3 NVALS=(1,2,3);                                  
RUN;                                                                      
DATA; SET TMP2;                                                           
A=A2;                                                                     
B=B2;                                                                     
C=C3;                                                                     
D=D3+3*(D2-1);                                                            
FILE OUTFILE;                                                             
PUT A B C D;                                                              
RUN;                                                                      
PROC MEANS DATA=TMP1 NOPRINT;                                             
TITLE;                                                                    
OUTPUT OUT=MTMP1 N=N;                                                     
RUN;                                                                      
DATA;SET MTMP1;                                                           
FILE NOTESFIL;                                                            
PUT N;                                                                    
RUN;                                                                      
PROC MEANS DATA=TMP2 NOPRINT;                                             
TITLE;                                                                    
OUTPUT OUT=MTMP2 N=N;                                                     
RUN;                                                                      
DATA;SET MTMP2;                                                           
FILE NOTESFIL MOD;                                                        
PUT N;                                                                    
RUN;                                                                      
______________________________________                                    
 
    
     Handling expensive combinations is accomplished as follows. Collect all the expensive factors, collect all the inexpensive factors, and perform the above procedure on each set, crossing the results when completed. By working with the expensive factor separately we assure that the number of expensive combinations is minimized. However, since we cross this design with the inexpensive combinations, the total size of the experiment is likely to be larger than a combined design with no expensive factor specified. 
     Mode 2: Maximize Information Given An Experiment Size Limitation 
     This is accomplished similarly to Mode 1 but with an iterative procedure added to find the best possible design which meets the users criteria. 
     Step 1--Decompose each factor into its prime components. 
     Step 2--Collect all similar prime components, i.e., all two level components, all three level components, all five level components, etc. 
     Step 3--Find the minimal size for each prime component using the SAS procedure FACTEX. Estimate all main effects. If no design is found then stop. 
     Step 4--If the product of the minimal sizes is less than the maximum allowed, repeat step 3 but estimate main effects and include 2 factor interactions as non-negligible. 
     Step 5--If the product of the minimal sizes is less than the maximum allowed, repeat step 3 but estimate main effects and 2 factor interactions. 
     Step 6--Continue incrementally increasing the order of terms to be estimated (or considered non-negligible) until the experiment size limitation is violated or a full factorial design is generated. In the latter case return the full factorial design, in the former case return the largest design which was generated that did not violate the size limitation. 
     In both Mode 1 and Mode 2 a confounding pattern must be discovered which corresponds to the design. For basic cases, where all factors have the same prime number of levels, the confounding pattern is simply returned by the FACTEX procedure. However, added computation must be performed whenever any kind of crossing of designs or any kind of prime level factorization occurs. Crossing occurs whenever there are mixed primes, whenever there are non-prime level factors, whenever there is nesting, and whenever there are expensive combinations. 
     To find the confounding in factors that are not primes, simply replace any occurrence of the prime component with the original factor. For example, if A has 4 levels, with prime components A1 and A2, then all of the following interactions equal AB: A1B, A2B, A1A2B. Any occurrences of these prime components should be replaced with the interaction involving the original factors. 
     Whenever two components are crossed, the confounding generated by the crossing must be determined. The following description illustrates crossing two components. This should illustrate the procedure for any number of components. Start with the confounding pattern for component 1. Additional confoundings are generated by multiplying each term in component 1 by the identity pattern in component 2. Next, multiply each term in component 2 by the identity pattern in component 1. Complete this pattern by multiplying each line in component 1 by each line in component 2. By convention we will assign the whole confounding string to the lowest order term, breaking ties alphabetically. Common terms are combined. For a more detailed example of this procedure, see pages 13-14 of the aforementioned Research Publication GMR 7111. 
     Constructing a Mathematical Model (Block 14) 
     The procedure for generating a mathematical model for fractional designs is the same as that for full factorial designs under Complicated Influence. The only differences that is allowed is that the user may specify a maximum order beyond which the system will stop generating terms. So for instance, if the user specifies a maximum order of 3, the system would not generate the ABCD interaction. 
     Design Evaluation (Block 16) 
     The evaluation of fractionated designs is similar to that of Complicated Influence. The differences are described below. 
     Computation of degree of freedom is based on the eventual analysis of data using the type I(one) computational method for analysis, sorted by order and alphabetically within an order. This is handled using the prime factorization technique discussed in connection with block 12. For each confounding string, define the primary term as the term with the lowest order, breaking ties alphabetically. Then the df for that string gets assigned to the primary term. The df for each confounding string in a p-level fractional design is p-1. When a p1-level design is crossed with a p2-level design, the cross product terms each have p1-l)(p2-l) df. 
     A slight alteration of the full factorial EMS algorithm handles the fractionation case. Start by computing the EMS for every term using the full factorial algorithm (Lorenzen 1977). Next alter every coefficient by multiplying by the fraction in the experiment (e.g. 1/2, 1/3, 1/6). Any coefficient less than one gets replaced by one. Finally, calculate the EMS for every primary term by forming the union of all confounded terms. 
     The search for tests is the same as describe in block 16 of Complicated Influence except that we look for a test on the primary term before looking for a test on the confounding string. 
     The number of runs in Screening is calculated simply by counting the number of lines in the design generated by FACTEX in block 12. 
     Communicating the Design (Block 18) 
     This step is the same as for Complicated Influence. 
     Redesigning (Block 20) 
     Once the user has viewed the initial design he/she may wish to change some of the input characteristics to achieve the appropriate delta while still keeping the experiment cost within budget. The user has the option of changing the design in any one of several ways: 
     1. The user may change the original input information directly by going back to the Experiment Information form of FIG. 2. 
     2. The user may tell the system to assume some terms negligible in its calculation of tests in block 16. Those terms which the user specifies will automatically be set to zero in the EMS matrix thus allowing more tests to be found. These assumptions may later be verified during data analysis. 
     3. The user may re-fractionate the design, changing the terms of interest or terms not to be confounded with terms of interest. 
     4. The user may tell the system to generate a full factorial design. 
     The expert system stores all designs which are generated during the redesign process as described in Complicated Influence. The expert system will suggest potential redesign options using the rule set listed in Appendix A. 
     Creating a Layout Sheet (Block 22) 
     Once the user approves a design, a layout sheet is generated. This layout sheet acts as a blue print for the experiment, describing exactly which combinations of factor levels to run and in what order to run them. In fractional designs the layout sheet is generated based on the design created by FACTEX. An example of the SAS code for doing this is as follows: 
     
         ______________________________________                                    
filename datafile &#39;/ . . . ;                                              
filename outfile &#39;/ . . . .;                                              
filename outfile2 &#39;/ . . . ;                                              
filename prntfile &#39;/ . . . ;                                              
proc printto print=prntfile log=logfile new;                              
data .sub.-- sheet.sub.-- ;                                               
Y = `.sub.---- `;                                                         
infile datafile;                                                          
input  .sub.-- A .sub.-- B .sub.-- C .sub.-- D ;                          
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
.sub.-- random.sub.-- =ranuni(0);                                         
.sub.-- count.sub.--  = .sub.-- n.sub.--  - 1;                            
.sub.-- rep.sub.--  = mod(.sub.-- count.sub.--,1) + 1;                    
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
length;                                                                   
if .sub.-- A = 1 then A = 1;                                              
if .sub.-- A = 2 then A = 2;                                              
if .sub.-- B = 1 then B = 1;                                              
if .sub.-- B = 2 then B = 2;                                              
if .sub.-- B = 3 then B = 3;                                              
if .sub.-- B = 4 then B = 4;                                              
if .sub.-- C = 1 then C = 1;                                              
if .sub.-- C = 2 then C = 2;                                              
if .sub.-- C = 3 then C = 3;                                              
if .sub.-- D = 1 then D = 1;                                              
if .sub.-- D = 2 then D = 2;                                              
if .sub.-- D = 3 then D = 3;                                              
if .sub.-- D = 4 then D = 4;                                              
if .sub.-- D = 5 then D = 5;                                              
if .sub.-- D = 6 then D = 6;                                              
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
label                                                                     
 A = `A`                                                                  
 B = `B`                                                                  
 C = `C`                                                                  
 D = `D`                                                                  
 Y = `Y`;                                                                 
run;                                                                      
proc sort;                                                                
by .sub.-- random.sub.-- ;                                                
run;                                                                      
proc fsprint;                                                             
var  A B C D  Y;                                                          
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.--;                      
file outfile;                                                             
put  .sub.-- n.sub.--  A B C D  Y;                                        
run;                                                                      
data .sub.-- sheet.sub.-- ;set .sub.-- sheet.sub.-- ;                     
file outfile2;                                                            
put  .sub.-- n.sub.--  A B C D .sub.--rep.sub.--  ;                       
run;                                                                      
______________________________________                                    
 
    
     Analysis of Data (Block 24) 
     Formal analysis of variance is performed for each response variable. To analyze the data the proper model is generated for SAS. The terms must be in a specific order: the lowest order terms appearing first, and within each order the terms must appear in the order that the factors were entered into the system. Only the primary term in each confounding list is used. Given this model, PROC GLM in SAS is used to compute the Type 1 Sum of Squares and from this to compute means squares, F-tests and P-values. (see discussion under Complicated Influence) 
     Communicating the Analysis (block 26) 
     The analysis is communicated as in complicated influence. 
     ROBUST DESIGN 
     Inputting to the Computer (Block 10) 
     See the discussion&#39;s under Complicated Influence and Screening. In addition the following information is stored for each factor. 
     Control/Noise--The user indicates whether the factor is a control factor or a noise factor. The purpose of a robust design is to find the values of the control factors which minimize the effect of the noise factors. 
     Fractionation (Block 12) 
     This feature is available for Robust Designs and operates the same as described in Screening. 
     Constructing a Mathematical model (Block 14) 
     Two math models are constructed for Robust Experiments. An All factors math model and a Control factors only math model. 
     The procedure for generating a mathematical model for All Factors in robust designs is the same as that for full factorial designs in Complicated Influence or fractional designs in Screening depending on whether or not the user fractionates. 
     For Control Factors a second Mathematical Model is derived using only the control factors to generate the terms in the model. 
     Design Evaluation (Block 16) 
     For All Factors the evaluation of robust designs is similar to that of Screening or Complicated Influence. 
     For Control Factors design evaluation is done using the same procedure described for All Factors with the exception that the coefficient for each term is computed using the following algorithm. 
     1. Compute the number of different control factor combinations which exist in the design. 
     2. Compute the fraction of the noise combinations that are run for each control combination. 
     3. Multiply each coefficient in the model by the fraction of noise combinations considered. 
     The Control Factors design information is stored in a separate world within the worlds mechanism (described in Complicated Influence). This world inherits from the All Factors design world any information which is not calculated. 
     Communicating the Design (Block 18) 
     Both design models are communicated to the user in the same form as Complicated Influence and Screening experiments. 
     Redesigning (Block 20) 
     Redesign is accomplished in the same way as in Screening and Complicated Influence. Redesign worlds are always created as children of the All Factors design world. 
     Creating a Layout Sheet (Block 22) 
     Creating a layout sheet is the same as in Screening and Complicated Influence. 
     Analysis of Data (Block 24) 
     Formal analysis of variance is performed for each response variable in the same way for the All Factors design as in Complicated Influence or Screening. 
     For the Control Factors design three types of analysis are offered: 
     1. means calculated over the noise factors 
     2. log of the standard deviation calculated over the noise factors 
     3. quadratic loss function, combining closeness to target and variability caused by the noise factors. 
     Using SAS, a data set is created which contains the means, variance, and standard deviation of the response variable calculated over the noise factors. This data set is then analyzed according to the users selection of the type of analysis required. Example SAS code for a three factor experiment (A and B control, and a noise factor) where the user wished to analyze the log of the quadratic loss function is shown below: 
     
         ______________________________________                                    
1   infile datafile;                                                      
2   input .sub.-- n.sub.--  A B mY1  vY1  sY1 ;                           
3   .sub.-- M = mY1;                                                      
4   .sub.-- V = vY1;                                                      
5   .sub.-- S = sY1;                                                      
6   .sub.-- Y = log(1*(.sub.-- M**2+.sub.-- V));  /* loss function with   
    target = 0                                                            
                and k = 1 */                                              
7   run;                                                                  
8   proc glm outstat=stat.sub.-- s;                                       
9   class A B;                                                            
10  model .sub.-- Y = A B A*B / ss1;                                      
11  output out=pout p=pY r=rY;                                            
12  run;                                                                  
13  data stat.sub.-- s; set stat.sub.-- s;file statfile;                  
14  put `((&#34;` .sub.-- source.sub.--  `&#34; ` .sub.-- name.sub.--  `) ` ss df 
     `)`;                                                                 
15  run;                                                                  
______________________________________                                    
 
    
     The equation in line 6 will vary according to the type of Control Factors analysis the user requests. Line 14 outputs Type 1 Sums of Squares and from this, mean squares, F-tests and P-values are calculated (see Complicated Influence) 
     Communicating the Analysis (Block 26) 
     The analysis is communicated as in Screening or Complicated Influence for both the All FACTORS analysis and the Control Factors analysis. 
     MODEL RESPONSE 
     Inputting to the Computer (Block 10) 
     Inputs are gathered from the user through a series of interactive forms which are shown in FIG. 7. The factor information is stored in the KEE frames structure, with each factor represented as an individual unit which is a child of the FACTORS class. Each child of the FACTORS class inherits slots for storing the user&#39;s input. The following slots store the critical information for each of the user&#39;s factors in complicated influence: 
     1. Abbreviation--a short string used to represent the factors effect in the math model representation. 
     2. Lower Bound--The lower bound on the factor range in a production setting. 
     3. Upper Bound--The upper bound on the factor range in a production setting. 
     4. Type--Must be fixed. 
     5. Quantitative-or-Qualitative--A factor is quantitative if it has meaningful numbers associated with its levels. Otherwise it is qualitative. 
     In addition to information on individual factors the user also enters the type of Model (one of Plackett-Burman, Central Composite, Box-Behnkan, or D-Optimal), and any run order restrictions (i.e. an inability of disinclination to change the levels of a factor frequently from one experiment trial to the next). 
     Generating a Design (Block 12) 
     The design which is generated depends on the inputs provided by the user. Plackett-Burman designs are generated using SAS. An example input SAS file generated by the expert system for a 4 factor Plackett-Burman experiment is as follows: 
     
         __________________________________________________________________________
%INCLUDE &#34;!sasroot/sasmacro/adxgen.sas&#34;;                                  
%INCLUDE &#34;!sasroot/sasmacro/adxff.sas&#34;;                                   
%adxinit                                                                  
%adxpbd(out,4)                                                            
FILENAME OUTFILE &#34;/users/doe/users/scott/sasfiles/fract.des&#34;;             
DATA OUT;SET OUT;                                                         
FILE OUTFILE;                                                             
PUT .sub.-- N.sub.--  T1-T4;                                              
RUN;                                                                      
PROC PRINT DATA=OUT; RUN;                                                 
Box-Behnkan designs are stored in tables in                               
Unix files. These can be referenced by the number of                      
factors in the design. The tables are stored assuming                     
upper bounds of 1 and lower bounds of negative 1 and                      
then scaled by the users inputs.                                          
Central Composite designs are generated using                             
SAS. An example input SAS file generated by the expert                    
system for a 3 factor Central Composite experiments is                    
as follows:                                                               
%INCLUDE &#34;!sasroot/sasmacro/adxgen.sas&#34;;                                  
%INCLUDE &#34;!sasroot/sasmacro/adxcc.sas&#34;;                                   
%INCLUDE &#34;!sasroot/sasmacro/adxff.sas&#34;;                                   
%adxinit                                                                  
%adxccd(out,3,8,9,1.668)                                                  
FILENAME OUTFILE &#34;/users/doe/users/scott/sasfiles/fract.des&#34;;             
DATA OUT;SET OUT;                                                         
FILE OUTFILE;                                                             
PUT .sub.-- N.sub.--  T1-T3;                                              
RUN;                                                                      
PROC PRINT DATA=OUT; RUN;                                                 
__________________________________________________________________________
 
    
     D-optimal designs are generated using SAS. An example input SAS file generated by the expert system for a 3 factor D-optimal experiment with A linear and qualitiative (three levels), B quadratic quantitative and C quantitative cubic is as follows: 
     
         __________________________________________________________________________
data cand;                                                                
do A=1.0,5.0;                                                             
do B=1.0,3.0,5.0;                                                         
do C=1.0,2.333,3.667,5.0;                                                 
output;                                                                   
end;                                                                      
end;                                                                      
end;                                                                      
run;                                                                      
data cand; set cand;                                                      
A=0.5*A-1.5;                                                              
B=0.5*B-1.5;                                                              
C=0.5*C-1.5;                                                              
run;                                                                      
proc optex data=cand nocode;                                              
model  A B B*B C C*C C*C*C A*B A*C B*C ;                                  
examine design;                                                           
generate n=20;                                                            
output out=out;                                                           
run;                                                                      
FILENAME OUTFILE &#34;/users/doe/users/scott/sasfiles/fract.des&#34;;             
DATA OUT;SET OUT;                                                         
FILE OUTFILE;                                                             
PUT .sub.-- N.sub.--  A B C;                                              
RUN;                                                                      
PROC PRINT DATA=OUT;                                                      
RUN;                                                                      
__________________________________________________________________________
 
    
     Constructing a Mathematical Model (Block 14) 
     For model response experiments the mathematical model is simply the polynomial equation that will be fit using regression techniques. This model is determined by the type of design the user asks for. The types of designs offered by the expert system along with their associated model are listed below: 
     1. Plackett-Burman--Linear model 
     2. Box-Behnkan--Quadratic Model 
     3. Central Composite--Quadratic Model 
     4. D-Optimal--General 
     In the D-Optimal case, the user specifies the polynomial model to be fit. 
     Restrictions on randomization are added as terms in the model in the same manner as for Complicated Influence experiments. 
     All effects in the experiment which are not fixed at a given level and not related to the input factors are represented by the error term which is nested in every other factor. 
     Design Evaluation (Block 16) 
     The mathematical model and the design are the basis for evaluating the properties of the design. These properties include: 
     1. Degrees of Freedom for each Term (df) 
     2. The type of test available on each Term 
     3. The terms testing each Term 
     4. The test degrees of freedom for each Term 
     5. The detectability of each term (delta) 
     6. A classification for the detectability for each term 
     7. The Expected Mean Squares for each term (EMS) 
     8. The required experiment size (number of runs) 
     Each quantitative term in the model has one df. The df for qualitative factors are one less than the number of levels. 
     All terms are tested by error and have DIRECT tests unless there is a restriction on randomization. In this case, the tests are of the type CONCLUDE INSIGNIFICANT ONLY. 
     EMS is calculated using the algorithm described in Sample Size Choice, by Odeh and Fox, Published in 1975 by Marcell Decker, page 31ff. 
     The calculation of the minimal detectable difference uses the same algorithm described in Complicated Influence by determining the appropriate coefficient C. This is done using the following procedure: 
     1) Rescale the problem so that the lowest value corresponds to 1 and the highest value to -1. 
     2) For scaled X levels of the term, ##EQU4## 
     3) For qualitative term, ##EQU5## where I is the number of levels of the term in the design and n(i) is the number of times the ith level of X occurs in the design. 
     4) If the term is the product of a quantitative term Y and a qualitative term Z, ##EQU6## where I is the number of levels of Z in the design and Y i  is summed over the i th  level of Z. 
     The detectable difference classification is accomplished as described in Complicated Influence. The number of runs in the design is simply the size of the design generated in block 12. 
     Communicating the Design (Block 18) 
     The design is communicated as in Complicated Influence. 
     Redesigning (Block 20) 
     Once the user has viewed the initial design he/she may wish to change some of the input characteristics to achieve the appropriate delta while still keeping the experiment cost within budget. The user has the option of changing the design in any one of several ways: 
     1. The user may change the original input information directly by going back to the Experiment Information form (FIG. 7). 
     2. In some model types the user may change the number of Center Repeats. 
     3. The user may change some properties of the design, such as Rotatability or Orthoganality or the alpha value for Central Composite. 
     4. In D-Optimal Designs, the user may exclude points from the candidate space or enter specific points to run in the design. 
     Suggestions for Redesign are given based on the rule base listed in Appendix B. Designs are stored in the same manner as described in Complicated Influence. 
     Creating a Layout Sheet (Block 22) 
     A layout sheet is generated as described in Screening. 
     Analysis of Data (Block 24) 
     Once the user returns with experimental data, the expert system writes SAS code to do the analysis. As an example, for the experiment with factors A, B and C all quantitative and quadratic the following SAS code would be generated. 
     
         __________________________________________________________________________
1 infile datafile;                                                        
2 input .sub.-- num.sub.--  A B C Y1;                                     
3 run;  /* input data from file */                                        
4 data .sub.-- sheet.sub.-- ; set .sub.-- sheet.sub.-- ;                  
5 C1 = A;                                                                 
6 C2 = A*A;                                                               
7 C3 = B;                                                                 
8 C4 = B*B;  /* define parameters */                                      
9 C5 = A*B;                                                               
10                                                                        
  C6 = C;                                                                 
11                                                                        
  C7 = C*C;                                                               
12                                                                        
  C8 = A*C;                                                               
13                                                                        
  C9 = B*C;                                                               
14                                                                        
  proc reg covout outest=eststats singular=1E-15                          
15                                                                        
  model Y1 = C1 C2 C3 C4 C5 C6 C7 C8 C9 ;                                 
16                                                                        
  data eststats; set eststats; file estfile;                              
17                                                                        
  put .sub.-- depvar.sub.-- -- type.sub.--  intercep C1 C2 C3 C4 C5 C6 C7 
  C8 C9 ;                                                                 
18                                                                        
  run; /* output parameter estimates and standard error                   
                     to file */                                           
__________________________________________________________________________
 
    
     The math model representation created in block 14 is used to create parameters C1-C9 in steps 4 through 13 above. The parameter estimates and standard error which are output to a file for each term in line 18 are read in by the expert system after the SAS program finishes running. 
     Using the standard error, test degrees of freedom, and the parameter estimates, the expert system calculates T values and P values using standard formulas. 
     Communicating the Analysis (Block 26) 
     In FIG. 8 a sample screen is displayed which shows how the user sees the summary of analysis information calculated in block 24. ##SPC1##