Problem 3.7

The tensile strength of Portland cement is being studied. Four different mixing techniques can be used economically.

library(agricolae)
library(tidyr)
Mixing_Technique_1 <- c(3129,3000,2865,2890)
Mixing_Technique_2<-    c(3200  ,3300   ,2975   ,3150)
Mixing_Technique_3<-    c(2800  ,2900,  2985    ,3050)
Mixing_Technique_4<-    c(2600  ,2700,  2600    ,2765)


Mixing_Techniques <- cbind.data.frame(Mixing_Technique_1,Mixing_Technique_2,Mixing_Technique_3,Mixing_Technique_4)

Mixing <- pivot_longer(data = Mixing_Techniques, c(Mixing_Technique_1,Mixing_Technique_2,Mixing_Technique_3,Mixing_Technique_4))


Anov_test <- aov(value~name,data = Mixing)
summary(Anov_test)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## name         3 489740  163247   12.73 0.000489 ***
## Residuals   12 153908   12826                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(Anov_test)

## hat values (leverages) are all = 0.25
##  and there are no factor predictors; no plot no. 5

drug_test<- LSD.test(Anov_test,"name")
plot(drug_test)

summary(drug_test$groups)
##      value         groups         
##  Min.   :2666   Length:4          
##  1st Qu.:2867   Class :character  
##  Median :2952   Mode  :character  
##  Mean   :2932                     
##  3rd Qu.:3017                     
##  Max.   :3156
plot(Mixing$value)

  1. Use the Fisher LSD method with alpha = 0.05 to make comparisons between pairs of means.

    Groups and Ranges ids which groups have simmialar means values.The groups are the following Group C is Mixing Technique 4 Group B is Mixing Technique 1 and Mixing Technique 3 Group A is Mixing Technique 2

  2. Construct a normal probability plot of the residuals. What conclusion would you draw about the validity of the normality assumption?

    Looking at the qq plot, the data looks to follow a striaght line and I would say the normallity assuption holds for the data.

  3. Plot the residuals versus the predicted tensile strength. Comment on the plot.

    The resiudals look to form a box and I dont see anything interesting in them. I would say that constant variance holds

  4. Prepare a scatter plot of the results to aid the interpretation of the results of this experiment.

Problem 3.10

A product developer is investigating the tensile strength of a new synthetic fiber that will be used to make cloth for men’s shirts. Strength is usually affected by the percentage of cotton used in the blend of materials for the fiber. The engineer conducts a completely randomized experiment with five levels of cotton content and replicates the experiment five times.

percent_15 <-c( 7,  7,  15, 11, 9)
percent_20<-c(12    ,17 ,12 ,18 ,18)
percent_25<-    c(14,   19, 19, 18, 18)
percent_30<-    c(19    ,25 ,22 ,19 ,23)
percent_35 <-c( 7,  10, 11, 15, 11)


Mixing_Techniques <- cbind.data.frame(percent_15,percent_20,percent_25,percent_30,percent_35)

Mixing <- pivot_longer(data = Mixing_Techniques, c(percent_15,percent_20,percent_25,percent_30,percent_35))


Anov_test_percent <- aov(value~name,data = Mixing)

summary(Anov_test_percent)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## name         4  475.8  118.94   14.76 9.13e-06 ***
## Residuals   20  161.2    8.06                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(Anov_test_percent)

## hat values (leverages) are all = 0.2
##  and there are no factor predictors; no plot no. 5

drug_test_percent <- LSD.test(Anov_test_percent,"name")
plot(drug_test_percent)

summary(drug_test_percent)
##            Length Class      Mode
## statistics  6     data.frame list
## parameters  5     data.frame list
## means      10     data.frame list
## comparison  0     -none-     NULL
## groups      2     data.frame list
  1. Use the Fisher LSD method to make comparisons between the pairs of means. What conclusions can you draw?

    Groups and Ranges ids which groups have simmialar means values.The groups are the following Group C is 35% and 15% Group B is 20% and 25% Group A is 30%

  2. Analyze the residuals from this experiment and comment on model adequacy.

    Looking at the residuals, The residuals look to be constant. I don’t see any coning of the residuals.

Problem 3.44

Suppose that four normal populations have means of mu_1 = 50,mu_2= 60, mu_3= 50, and mu_4 =60. How many observations should be taken from each population so that the probability of rejecting the null hypothesis of equal population means is at least 0.90? Assume that alpha = 0.05 and that a reasonable estimate of the error variance is 25.

library(pwr)
Cool_means <- c(50,60,50,60)
grand_mean <- mean(c(50,60,50,60))
effect_of_the_means<-Cool_means-grand_mean


pwr.anova.test(k= 4, n=NULL,sig.level = .05,power = .9,f = sqrt((sum(effect_of_the_means^2))/(4*25)))
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 4.658119
##               f = 1
##       sig.level = 0.05
##           power = 0.9
## 
## NOTE: n is number in each group
The pwr.anova.test concluded that I need aobut 5 samples from each group

Problem 3.45

pwr.anova.test(k=4,n=NULL,sig.level = .05,power = .9,f =sqrt((sum(effect_of_the_means^2))/(4*36)))
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 6.180857
##               f = 0.8333333
##       sig.level = 0.05
##           power = 0.9
## 
## NOTE: n is number in each group
pwr.anova.test(k=4,n=NULL,sig.level = .05,power = .9,f =sqrt((sum(effect_of_the_means^2))/(4*49)))
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 7.998751
##               f = 0.7142857
##       sig.level = 0.05
##           power = 0.9
## 
## NOTE: n is number in each group
  1. How would your answer change if a reasonable estimate of the experimental error variance is 36?

    The pwr.anova.test concluded that I need aobut 7 samples from each group

  2. How would your answer change if a reasonable estimate of the experimental error variance is 49?

    The pwr.anova.test concluded that I need aobut 8 samples from each group

  3. Can you draw any conclusions about the sensitivity of your answer in this particular situation about how your estimate of standard deviation affects the decision about sample size?

    As the standard devaton incearse, I see that the number of samples per group increase.

  4. Can you make any recommendations about how we should use this general approach to choosing n in practice?

    If you standard devation is unkown, I would recommend looking at past reports or asking experts about the standard devation.