1 Sample Determination

From the problem, we got:

\(k = 4\)

\(\sigma^2 = 3.5\)

\(\alpha = 0.05\)

desired power = 0.8

since we know the estimated variance, power.anova.test can be used to determine the sample for every case:

  1. Min Variability case:

    Assumed means pattern: \(\{18, 19, 19, 20\}\)

    power.anova.test(group = 4, n = NULL, between.var = var(c(18, 19, 19, 20)), within.var = 3.5, sig.level = 0.05, power = 0.8 )
    ## 
    ##      Balanced one-way analysis of variance power calculation 
    ## 
    ##          groups = 4
    ##               n = 20.08368
    ##     between.var = 0.6666667
    ##      within.var = 3.5
    ##       sig.level = 0.05
    ##           power = 0.8
    ## 
    ## NOTE: n is number in each group

    Need to get 21 sample in each group.

  2. Intermediate Variability case:

    Assumed means pattern: \(\{18, 18.67, 19.33, 20\}\)

    power.anova.test(group = 4, n = NULL, between.var = var(c(18, 18.67, 19.33, 20)), within.var = 3.5, sig.level = 0.05, power = 0.8 )
    ## 
    ##      Balanced one-way analysis of variance power calculation 
    ## 
    ##          groups = 4
    ##               n = 18.21285
    ##     between.var = 0.7392667
    ##      within.var = 3.5
    ##       sig.level = 0.05
    ##           power = 0.8
    ## 
    ## NOTE: n is number in each group

    Need to get 19 sample in each group.

  3. Max Variability case:

    Assumed means pattern: \(\{18, 18, 20, 20\}\)

    power.anova.test(group = 4, n = NULL, between.var = var(c(18, 18, 20, 20)), within.var = 3.5, sig.level = 0.05, power = 0.8 )
    ## 
    ##      Balanced one-way analysis of variance power calculation 
    ## 
    ##          groups = 4
    ##               n = 10.56952
    ##     between.var = 1.333333
    ##      within.var = 3.5
    ##       sig.level = 0.05
    ##           power = 0.8
    ## 
    ## NOTE: n is number in each group

    Need to get 11 sample in each group.

2 One-Way ANOVA of the experiment

Tidying Test Data:

## # A tibble: 24 × 2
##    name    value
##    <chr>   <dbl>
##  1 fluid_1  17.6
##  2 fluid_2  16.9
##  3 fluid_3  21.4
##  4 fluid_4  19.3
##  5 fluid_1  18.9
##  6 fluid_2  15.3
##  7 fluid_3  23.6
##  8 fluid_4  21.1
##  9 fluid_1  16.3
## 10 fluid_2  18.6
## # ℹ 14 more rows

One-way ANOVA on tidy data:

\(H_0 : \mu_1 = \mu_2 = \mu_3 = \mu_4\)

\(H_1 :\) at least one of \(\mu_i\) different

##             Df Sum Sq Mean Sq F value Pr(>F)  
## name         3  30.16   10.05   3.047 0.0525 .
## Residuals   20  65.99    3.30                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Since p-value = 0.0525, enough evidence to reject \(H_0\) at \(0.10\) level of significance. At least one of the \(\mu\) is different.

Model Adequacy:

The normal Q-Q plot shows that most of the residuals are reasonably close to the reference line, indicating that residuals approximately normal. The residuals versus fitted values plot shows no clear pattern, and the spread of the residuals is relatively similar across the fitted values. Therefore, the constant variance assumption is also reasonable. Overall, there is no clear evidence of a violation of the ANOVA assumptions, so the model can be considered adequate.

Tukey’s HSD Test:

##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = value ~ name, data = dat)
## 
## $name
##                       diff         lwr       upr     p adj
## fluid_2-fluid_1 -0.7000000 -3.63540073 2.2354007 0.9080815
## fluid_3-fluid_1  2.3000000 -0.63540073 5.2354007 0.1593262
## fluid_4-fluid_1  0.1666667 -2.76873407 3.1020674 0.9985213
## fluid_3-fluid_2  3.0000000  0.06459927 5.9354007 0.0440578
## fluid_4-fluid_2  0.8666667 -2.06873407 3.8020674 0.8413288
## fluid_4-fluid_3 -2.1333333 -5.06873407 0.8020674 0.2090635

Tukey’s HSD test was conducted to determine which pairs of fluids have significantly different mean effective lives while controlling the familywise error rate at 0.10. The results show that only Fluids 2 and 3 have a significant difference in mean effective life. Fluid 3 has a higher mean effective life than Fluid 2. The other pairwise comparisons are not statistically significant.

3 Executed Code

#min case
power.anova.test(group = 4, n = NULL, between.var = var(c(18, 19, 19, 20)), within.var = 3.5, sig.level = 0.05, power = 0.8 )
#inter case
power.anova.test(group = 4, n = NULL, between.var = var(c(18, 18.67, 19.33, 20)), within.var = 3.5, sig.level = 0.05, power = 0.8 )
#max case
power.anova.test(group = 4, n = NULL, between.var = var(c(18, 18, 20, 20)), within.var = 3.5, sig.level = 0.05, power = 0.8 )

#tidy data
library (tidyr)

fluid_1 <- c(17.6, 18.9, 16.3, 17.4, 20.1, 21.6)
fluid_2 <- c(16.9, 15.3, 18.6, 17.1, 19.5, 20.3)
fluid_3 <- c(21.4, 23.6, 19.4, 18.5, 20.5, 22.3)
fluid_4 <- c(19.3, 21.1, 16.9, 17.5, 18.3, 19.8)
dat <- data.frame(fluid_1, fluid_2, fluid_3, fluid_4)

dat<- pivot_longer(dat, cols = c("fluid_1", "fluid_2", "fluid_3", "fluid_4") )
dat

#anova model 
aov.model <- aov(value ~ name, data = dat)
summary(aov.model)

#adequecy
plot(aov.model)

#tukey's HSD Test
library(car)
TukeyHSD(aov.model)
plot(TukeyHSD(aov.model))