ANOVA

Perform 1- or 2-Way ANOVA.

 

aov

Performs single-factor analysis of variance test.


def aov(*args)->aov_results:

def tukey(alpha:float, aovresult:aov_results)->TukeyResults:
"""perform tukey test"""

Example


rf_160 = [575, 542, 530, 539, 570]
rf_180 = [565, 593, 590, 579, 610]
rf_200 = [600, 651, 610, 637, 629]
rf_220 = [725, 700, 715, 685, 710]

from scisuit.stats import aov
aovresult = aov(rf_160, rf_180, rf_200, rf_220)
print(aovresult)
One-Way ANOVA Results 
Source         df           SS              MS         F          p-value
Treatment      3         66870.55        22290.18      66.80     2.8829e-09
Error          16        5339.20          333.70
Total          19        72209.75

 

Performing Tukey's test:

Example


tukresult = tukey(alpha=0.05, aovresult=aovresult)
print(tukresult)
Tukey Test Results (alpha=0.05) 
Pairwise Diff      i-j             Interval
1 - 2            -36.20          (-69.25, -3.15)
1 - 3            -74.20          (-107.25, -41.15)
1 - 4            -155.80        (-188.85, -122.75)
2 - 3            -38.00          (-71.05, -4.95)
2 - 4            -119.60        (-152.65, -86.55)
3 - 4            -81.60          (-114.65, -48.55)

 

 

aov2

Performs two-factor analysis of variance test.


def aov2(y:Iterable, x1:Iterable, x2:Iterable)->aov2_results:
"""
y: Responses   
x1, x2: factors
"""

 

Example


from scisuit.stats import aov2

Catalyst = ["A", "A", "A", "A", "A", "A", "A", "A", "A", 
	"B", "B", "B", "B", "B", "B", "B", "B", "B", 
	"C", "C", "C", "C", "C", "C", "C", "C", "C"]

Temperature = ["L", "L", "L", "M", "M", "M", "H", "H", "H", 
	"L", "L", "L", "M", "M", "M", "H", "H", "H", 
	"L", "L", "L", "M", "M", "M", "H", "H", "H"]

Yield = [85, 88, 90, 80, 82, 84, 75, 78, 77, 90, 92, 91, 
	85, 87, 89, 80, 83, 82, 88, 90, 91, 84, 86, 85, 79, 80, 81]

result = aov2(y=Yield, x1=Temperature, x2=Catalyst)
print(result)
Two-way ANOVA Results    
Source             df              SS              MS               F         p-value
x1                  2          450.30          225.15           83.27      7.9886e-10
x2                  2           90.74           45.37           16.78      7.7004e-05
x1*x2               4            3.04            0.76            0.28      8.8654e-01