doex - Design and Analysis of Experiments

In [2]:
!pip install doex --upgrade
Requirement already up-to-date: doex in /Users/rohitsanjay/miniconda3/lib/python3.8/site-packages (0.0.2)
Requirement already satisfied, skipping upgrade: prettytable>=1.0.1 in /Users/rohitsanjay/miniconda3/lib/python3.8/site-packages (from doex) (1.0.1)
Requirement already satisfied, skipping upgrade: scipy>=1.5 in /Users/rohitsanjay/miniconda3/lib/python3.8/site-packages (from doex) (1.5.2)
Requirement already satisfied, skipping upgrade: numpy>=1.19 in /Users/rohitsanjay/miniconda3/lib/python3.8/site-packages (from doex) (1.19.2)
Requirement already satisfied, skipping upgrade: setuptools in /Users/rohitsanjay/miniconda3/lib/python3.8/site-packages (from prettytable>=1.0.1->doex) (49.6.0.post20200814)
Requirement already satisfied, skipping upgrade: wcwidth in /Users/rohitsanjay/miniconda3/lib/python3.8/site-packages (from prettytable>=1.0.1->doex) (0.2.5)

1. Completely Randomized Design

In [3]:
import doex

exp = doex.CompletelyRandomizedDesign(
    [24, 28, 37, 30], # Treatment 1
    [37, 44, 31, 35], # Treatment 2
    [42, 47, 52, 38], # Treatment 3
)
+---------------------+-----+----------------+---------------------+-------------+---------+
| Source of Variation | DOF | Sum of Squares | Mean Sum of Squares | F statistic | p value |
+---------------------+-----+----------------+---------------------+-------------+---------+
|      Treatments     |  2  |    450.6667    |       225.3333      |    7.0356   |  0.0145 |
|        Error        |  9  |    288.2500    |       32.0278       |             |         |
|        Total        |  11 |    738.9167    |                     |             |         |
+---------------------+-----+----------------+---------------------+-------------+---------+

2. One Way ANOVA

In [5]:
import doex

exp = doex.OneWayANOVA(
    [24, 28, 37, 30], # Treatment 1
    [37, 44, 31, 35], # Treatment 2
    [42, 47, 52, 38], # Treatment 3
)
+---------------------+-----+----------------+---------------------+-------------+---------+
| Source of Variation | DOF | Sum of Squares | Mean Sum of Squares | F statistic | p value |
+---------------------+-----+----------------+---------------------+-------------+---------+
|      Treatments     |  2  |    450.6667    |       225.3333      |    7.0356   |  0.0145 |
|        Error        |  9  |    288.2500    |       32.0278       |             |         |
|        Total        |  11 |    738.9167    |                     |             |         |
+---------------------+-----+----------------+---------------------+-------------+---------+

3. Randomized Complete Block Design

In [6]:
import doex

exp = doex.RandomizedCompleteBlockDesign(
    [
        [73, 68, 74, 71, 67],
        [73, 67, 75, 72, 70],
        [75, 68, 78, 73, 68],
        [73, 71, 75, 75, 69],
    ]
)
+---------------------+-----+----------------+---------------------+-------------+---------+
| Source of Variation | DOF | Sum of Squares | Mean Sum of Squares | F statistic | p value |
+---------------------+-----+----------------+---------------------+-------------+---------+
|      Treatments     |  3  |    12.9500     |        4.3167       |    2.3761   |  0.1211 |
|        Blocks       |  4  |    157.0000    |       39.2500       |   21.6055   |  0.0000 |
|        Error        |  12 |    21.8000     |        1.8167       |             |         |
|        Total        |  19 |    191.7500    |                     |             |         |
+---------------------+-----+----------------+---------------------+-------------+---------+

4. Two Way ANOVA

In [7]:
import doex

exp = doex.TwoWayANOVA(
    [
        [9.3, 9.4, 9.6, 10.0],
        [9.4, 9.3, 9.8, 9.9],
        [9.2, 9.4, 9.5, 9.7],
        [9.7, 9.6, 10.0, 10.2],
    ]
)
+---------------------+-----+----------------+---------------------+-------------+---------+
| Source of Variation | DOF | Sum of Squares | Mean Sum of Squares | F statistic | p value |
+---------------------+-----+----------------+---------------------+-------------+---------+
|      Treatments     |  3  |     0.3850     |        0.1283       |   14.4375   |  0.0009 |
|        Blocks       |  3  |     0.8250     |        0.2750       |   30.9375   |  0.0000 |
|        Error        |  9  |     0.0800     |        0.0089       |             |         |
|        Total        |  15 |     1.2900     |                     |             |         |
+---------------------+-----+----------------+---------------------+-------------+---------+

5. Latin Square Design

In [8]:
import doex

exp = doex.LatinSquare(
    [
        ["A", "B", "D", "C", "E"],
        ["C", "E", "A", "D", "B"],
        ["B", "A", "C", "E", "D"],
        ["D", "C", "E", "B", "A"],
        ["E", "D", "B", "A", "C"],
    ],
    [
        [8, 7, 1, 7, 3],
        [11, 2, 7, 3, 8],
        [4, 9, 10, 1, 5],
        [6, 8, 6, 6, 10],
        [4, 2, 3, 8, 8],
    ],
)
+---------------------+-----+----------------+---------------------+-------------+---------+
| Source of Variation | DOF | Sum of Squares | Mean Sum of Squares | F statistic | p value |
+---------------------+-----+----------------+---------------------+-------------+---------+
|      Treatments     |  4  |    141.4400    |       35.3600       |   11.3092   |  0.0005 |
|         Rows        |  4  |    15.4400     |        3.8600       |    1.2345   |  0.3476 |
|       Columns       |  4  |    12.2400     |        3.0600       |    0.9787   |  0.4550 |
|        Error        |  12 |    37.5200     |        3.1267       |             |         |
|        Total        |  24 |    206.6400    |                     |             |         |
+---------------------+-----+----------------+---------------------+-------------+---------+
In [ ]: