Problem 1

Background

Suppose we wish to design a new experiment that tests for a significant difference between the mean effective life of these 4 insulating fluids at an accelerated load of 35kV. The variance of fluid life is estimated to be 4.5hrs based on preliminary data. We would like this test to have a type 1 error probability of 0.05, and for this test to have an 80% probability of rejecting the assumption that the mean life of all the fluids are the same if there is a difference greater than 1 hour between the mean lives of the fluids.

a. How many samples of each fluid will need to be collected to achieve this design criterion?

b. Suppose we wish to have an 80% probability of detecting a difference between mean fluid lives of 30minutes, how many samples would need to be collected?

Problem 1 Set Up

library(pwr)
numTreat <- 4
alpha1 <- .05
prob <- .8
variance <- 4.5
difference1 <- 1
effectSize1 <- sqrt((difference1^2)/variance)

With the problem setup, we are now ready to solve the questions.

Problem 1 - a)

pwr.anova.test(k=numTreat,n=NULL,f=effectSize1,sig.level = alpha1, power = prob)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 13.28401
##               f = 0.4714045
##       sig.level = 0.05
##           power = 0.8
## 
## NOTE: n is number in each group

From the results of the power test where n = 13.284 we would need 14 samples from each group.

Problem 1 - b)

difference2 = .5
effectSize2 <- sqrt((difference2^2)/variance)
pwr.anova.test(k=numTreat,n=NULL,f=effectSize2,sig.level = alpha1, power = prob)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 50.04922
##               f = 0.2357023
##       sig.level = 0.05
##           power = 0.8
## 
## NOTE: n is number in each group

From the results of the power test where n = 50.049 we would need 51 samples from each group.

Problem 2

Background

The effective life of insulating fluids at an accelerated load of 35kV is being studied. Test data have been obtained for the four types of fluid.

a. Given that n=6 samples of each fluid type were collected, with what power will a hypothesis test with an alpha=0.10 level of significance be able to detect a difference of 1 hour between the mean lives of the tested fluids?

b. Test the hypothesis that the life of fluids is the same against the alternative that they differ at an alpha=0.10 level of significance (Remember to enter the data in a tidy format when using R, or to pivot_longer to a tidy format using tidyr )

c. Is the model adequate? (show plots and comment)

d. Assuming the null hypothesis in question 1 is rejected, which fluids significant differ using a familywise error rate of alpha=0.10 (use Tukey’s test). Include the plot of confidence intervals.

Problem 2 Set Up

life <- c(17.6, 18.9, 16.3, 17.4, 20.1, 21.6,
          16.9, 15.3, 18.6, 17.1, 19.5, 20.3,
          21.4, 23.6, 19.4, 18.5, 20.5, 22.3,
          19.3, 21.1, 16.9, 17.5, 18.3, 19.8)
fluidType <- as.factor(c(1, 1, 1, 1, 1, 1,
                         2, 2, 2, 2, 2, 2,
                         3, 3, 3, 3, 3, 3,
                         4, 4, 4, 4, 4, 4))
dat <- cbind.data.frame(life,fluidType)
alpha2 <- .1
difference3 <- 1
effectSize3 <- sqrt((difference3^2)/var(life))

With the problem setup, we are now ready to solve the questions.

Problem 2 - a)

pwr.anova.test(k = numTreat, n = 6, f = effectSize3, sig.level = alpha2, power=NULL)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 6
##               f = 0.4890694
##       sig.level = 0.1
##           power = 0.5618141
## 
## NOTE: n is number in each group

From the results of the power test, the power is equal to 56.18%.

Problem 2 - b)

aov1 <- aov(life ~ fluidType,data = dat)
summary(aov1)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## fluidType    3  30.17   10.05   3.047 0.0525 .
## Residuals   20  65.99    3.30                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

From the results of the anova test, p = .0525 so at the alpha = .1 level we can reject the null hypothesis.

Problem 2 - c)

plot(aov1)

The residuals all have roughly the same variance, so we do not have any issue there. Additionally, the normal probability plot roughly forms a straight line and there would have been concerns about the thickness of the tails but nothing to prevent from using One-Way ANOVA.

Problem 2 - d)

TukeyHSD(x = aov1, conf.level = .9)
##   Tukey multiple comparisons of means
##     90% family-wise confidence level
## 
## Fit: aov(formula = life ~ fluidType, data = dat)
## 
## $fluidType
##           diff        lwr       upr     p adj
## 2-1 -0.7000000 -3.2670196 1.8670196 0.9080815
## 3-1  2.3000000 -0.2670196 4.8670196 0.1593262
## 4-1  0.1666667 -2.4003529 2.7336862 0.9985213
## 3-2  3.0000000  0.4329804 5.5670196 0.0440578
## 4-2  0.8666667 -1.7003529 3.4336862 0.8413288
## 4-3 -2.1333333 -4.7003529 0.4336862 0.2090635
plot(TukeyHSD(x = aov1, conf.level = .9))

From the result of Tukey’s Test, fluids 2 and 3 significantly differ at the alpha = .1 level.

All Code Used

Below you will find a block containing all of the code used to generate this document

#Problem 1
library(pwr)
numTreat <- 4
alpha1 <- .05
prob <- .8
variance <- 4.5
difference1 <- 1
effectSize1 <- sqrt((difference1^2)/variance)
#Problem 1 a)
pwr.anova.test(k=numTreat,n=NULL,f=effectSize1,sig.level = alpha1, power = prob)
#Problem 1 b)
difference2 = .5
effectSize2 <- sqrt((difference2^2)/variance)
pwr.anova.test(k=numTreat,n=NULL,f=effectSize2,sig.level = alpha1, power = prob)
#Problem 2
life <- c(17.6, 18.9, 16.3, 17.4, 20.1, 21.6,
          16.9, 15.3, 18.6, 17.1, 19.5, 20.3,
          21.4, 23.6, 19.4, 18.5, 20.5, 22.3,
          19.3, 21.1, 16.9, 17.5, 18.3, 19.8)
fluidType <- as.factor(c(1, 1, 1, 1, 1, 1,
                         2, 2, 2, 2, 2, 2,
                         3, 3, 3, 3, 3, 3,
                         4, 4, 4, 4, 4, 4))
dat <- cbind.data.frame(life,fluidType)
alpha2 <- .1
difference3 <- 1
effectSize3 <- sqrt((difference3^2)/var(life))
#Problem 2 a)
pwr.anova.test(k = numTreat, n = 6, f = effectSize3, sig.level = alpha2, power=NULL)
#Problem 2 b)
aov1 <- aov(life ~ fluidType,data = dat)
summary(aov1)
#Problem 2 c)
plot(aov1)
#Problem 2 d)
TukeyHSD(x = aov1, conf.level = .9)
plot(TukeyHSD(x = aov1, conf.level = .9))