ANOVA/Model

ANOVA

Once the experiments are completed, the results can be added to the doe variable. The number of provided 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 lines, 16 results are provided, as the generated DOE requires 16 runs:

from doenova import doe_ff
doe = doe_2f()
plan = doe.make_plan(3,0,2,0,1)
doe.insert_results([3.3,3.6,5.6,5.3,7.8,7.0,5.6,5.2,
                    2.3,2.4,5.6,5.1,3.2,2.9,4.8,4.4])

If the DOE was created by importing a xlsx file containing the results, the previous line must be ignored.

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

anova_comps = doe.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
sel = np.array([[1,0,0,0],
                [0,0,1,0]])
                [0,1,0,1]])

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 [0,1,0,1] third row says that the interaction between the second and the fourth factors must be considered.

The sel variable must be input as an argument when calling the anova function:

anova_comps = doe.anova(sel)

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

The second step of the interactive designer can also be used to create the sel variable.

Model

For 2-level factorial and PB deisgns, a regression model is automatically calculated when calling the anova function. Only the selected variables and interactions of variables will be considered in the model. If no sel variable was provided, the model will only consider 1-order interactions.

To perform a prediction from the model, use the following command:

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

In the example above, the DOE contains 4 factors. The number of numbers to input in the predict_from_model function depends on the number of factors.