Q1a)

library(pwr)
pwr.anova.test(k=4,n=NULL,f=sqrt(((1)^2)/4.5) ,sig.level = 0.05,power = 0.8)
## 
##      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

Answer to Q1)a) We will have to take 14 samples from each group

Q1b)

library(pwr)
pwr.anova.test(k=4,n=NULL,f=sqrt(((0.5)^2)/4.5) ,sig.level = 0.05,power = 0.8)
## 
##      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

Answer to Q1)b) We will have to take 51 samples from each group.

Q2)

FType <- 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")
Obs <- 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)
dat1 <- cbind(FType,Obs)
dat1 <- as.data.frame(dat1)
dat1$FType <- as.factor(dat1$FType)
dat1$Obs <- as.numeric(dat1$Obs)

Q2)a)

library(pwr)
pwr.anova.test(k=4,n=6,f=sqrt(((1)^2)/var(dat1$Obs)) ,sig.level = 0.10,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

Answer to Q2)a) Power is 56.18%

Q2)b)

Null Hypotheses : Ho : \(H_o: \mu_1= \mu_2 = \mu_3 = \mu_4 = \mu\)

Alternative Hypothese : Ha: at least one of the \(\mu_i\) differs

library(pwr)
first.model <- aov(dat1$Obs~dat1$FType,data = dat1)

summary(first.model)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## dat1$FType   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

Answer to Q2)b) We reject Ho as p value < 0.1 , hence the mean differ

Q2)c)

plot(first.model)

Answer Q2)c) From the plots we can see residual points fall in fairly straight line , hence assumption of normality is adequate .

The Residual Vs Fitted plot shows that we have a constant variance , as the maximum and minimum points of all groups fall as in a rectangular.

As we know for adequacy we have two assumptions i.e. Normality and Constant variance , and in our experiment both are adequate.

Q2)d)

tukey_firstmodel <- TukeyHSD(first.model,conf.level = 0.90)

plot(tukey_firstmodel)

Answer Q2)d) From Tukey HSD and from plot we found out that pair 3-2 differ from other with family wise error of alpha = 0.10 .