Functions > Design of Experiments > Factor Screening > Example: 1 Factor ANOVA
Example: 1 Factor ANOVA
Use the fullfact function to design an experiment, and the anova function to analyze the result of the experiment.
1. Define the number of factors in an experiment testing the effect of the amount of cotton fiber on the strength of a new synthetic fiber.
Click to copy this expression
2. Define the cotton settings used in the experiment.
Click to copy this expression
3. Use function length to define the number of levels for the factor.
Click to copy this expression
4. Call function fullfact to create a full factorial design matrix representing the experiment and its runs.
Click to copy this expression
In the design matrix X, A represents the cotton factor, and its levels are shown in coded form:
Coded Values of A
Real Values of A
0
15%
1
20%
2
25%
3
30%
4
35%
5. Measure the strength of the synthetic fiber for the first run when the weight of the cotton fiber is 15%.
Click to copy this expression
6. Take measurements for the four other runs.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
7. Call function randomize to shuffle the run order.
Click to copy this expression
8. Replicate the measurements in the order determined by the randomize function.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Repeating experiments is useful to average out the effect of uncontrolled variables. Calling the randomize function before repeating the experiments helps to reduce any order of correlation between the input factors.
9. Repeat steps 7 and 8 for all the desired replicates. Record all the measurements in matrix Y.
Click to copy this expression
Each column contains the data of one of the replicates, and each row contains the data for a particular run.
10. Call function boxplot to prepare data for a box plot that has a box for each run.
Click to copy this expression
Matrix Y is transposed because the results for each run are recorded in matrix rows, but the data sets that are fed to boxplot must be matrix columns.
11. Call function boxplotgraph.
Click to copy this expression
12. Create a box plot.
a. Plot the output of the boxplotgraph function:
Click to copy this expression
b. Create text regions with the labels for each factor:
Click to copy this expression
When looking at the box plot, it seems that the cotton weight percentage influences the tensile strength of the fiber. The tensile strength of the fiber reaches a maximum when the cotton weight is about 30% of the fiber weight.
13. Call function anova to test if the cotton weight percentage influences the tensile strength.
Click to copy this expression
14. Define r to be the number of runs and x to be the number of replicates then calculate the sum of squares in the SSE column.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
15. Define N to be the total number of measurements then calculate the degrees of freedom in the df column.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
16. Calculate the mean squares in the MSE column.
Click to copy this expression
Click to copy this expression
17. Calculate the F-value for factor A.
Click to copy this expression
The P-value in the P column is less than 0.05 which indicates that factor A is significant.
18. Use the F-value to test the hypothesis that A is a significant factor. Calculate the critical F value for a 5% significance level.
Click to copy this expression
Click to copy this expression
The F-value for factor A is greater than the critical F value which confirms once more that the cotton weight percentage does influence the tensile strength of the fiber.
Reference
Montgomery, D.C., Design and Analysis of Experiments, 5th ed., John Wiley & Sons, New York, 2001. 62.
Was this helpful?