2-factorial design

From doenova, import the 2-factorial (2F) function and creates a new DOE.

from doenova import exp2fplan
exp = exp2fplan()

In a 2F design, the number of factors must be specified. This is the first argument when calling the make_plan function:

plan = exp.make_plan(4,1)

The second argument is the number of generators to use for partial factorial plans. Each generator cut by the half the number of runs to perform. For full 2F designs, specify 0 as the second argument. The function returns the variable plan which is a Numpy Array containing the DOE. The plan can also be shown in the console with this function:

exp.show_plan()

If used, the generators can be shown with the following line:

exp.show_generators()

By default, there is no replicate in the DOE. The number of replicates can be specified as the third input argument in the make_plan function:

plan = exp.make_plan(4,1,2)

By default, there is no center points in the plan. The number of replicates can be specified as the fourth input argument in the make_plan function:

plan = exp.make_plan(4,1,2,3)

Once the experiments are completed, the results can be added to the exp variable. The same numbers of results must match with the number of runs. The results must be provided position-wise to the plan. Then, the first provided result is related to the first row presented with show_plan(), and so on. In the following line, 19 results are provided:

exp.insert_results([3.4,3.3,6.7,6.4,5.3,6.0,1.3,1.4,3.2,3.5,4.5,4.1,
                    3.4,3.6,4.5,4.1,3.3,3.4,3.7])

Once the results are provided, the ANOVA table can be calculated:

anova_comps = exp.anova()

By doing the previous line, the ANOVA table is automatically presented in the console. The ANOVA table components are also being found in the anova_comps dictionary variable.

By default, all factors and possible combinations of factors are considered in the ANOVA table. It is possible to only select some factors or combinations. For this, a Numpy Array must be created prior calling the anova function. The number of columns must match with the number of factors in the DOE. Each row of this Numpy Array corresponds to one selection of a single factor or a combination of factors. For example,

import numpy as np
selection = np.array([[1,0,0,0],
                      [0,0,1,0]])

The [1,0,0,0] row first says that the first factor must be included in the ANOVA table. The [0,0,1,0] second row says that the third factor must be included in the ANOVA table. The selection variable must be input as an argument when calling the anova function:

anova_comps = exp.anova(selection)

The updated ANOVA table does not include the second and fourth factors (without interactions) as it was not specified in the selection.

Finally, a regression model can be calculated with the following command:

exp.make_regression()

Only the variables and interactions of variables specified in the selection variable while calling the anova function will be considered in the model. To perform a prediction from the model, use the following command:

exp.predict_from_model([.5,.6,.2,-.5])