Question 1

A researcher is interested in studying three types of fertilization methods (100 lb., 150 lb., and 200 lb.) and two levels of irrigation (A and B) on biomass yield. The possible treatment combinations were randomly assigned to 30 plots of land, where each treatment was assigned the same number of plots. You can find the data you need for this exercise in the file Biomass.csv (Canvas/ Module 3/ Resources). Answer the following questions using a significance level of 0.05.

Note: You MUST read the Biomass.csv file into R using the following way:

setwd("E:\\S9510\\CAP3330")
Biomass_df = read.csv("Biomass.csv",colClasses = c("numeric","factor","factor"))
Biomass_df
str(Biomass_df)
## 'data.frame':    30 obs. of  3 variables:
##  $ biomass   : num  3250 3151 3300 3290 3300 ...
##  $ fertilizer: Factor w/ 3 levels "100","150","200": 1 1 1 1 1 2 2 2 2 2 ...
##  $ irrigation: Factor w/ 2 levels "A","B": 1 1 1 1 1 1 1 1 1 1 ...
  1. How many replications were taken in this study? Show how you got the answer.

3 Fertilizer (100 lb., 150 lb., and 200 lb.)

2 Irragation (A and B)

3 * 2 = 6 treatments

Number of replicates = Total observations / # treatments

Number of replicates = 30 / 6 = 5 replicates

replications <- table(Biomass_df$fertilizer, Biomass_df$irrigation)
replications
##      
##       A B
##   100 5 5
##   150 5 5
##   200 5 5

There are 5 replications for each irrigation level A and B

  1. Identify: ● The outcome variable —-> biomass yield ● The factor (or factors)—–> fertilizer method and type of irrigation ● The levels of the factor (or levels of the factors)
levels(Biomass_df$fertilizer)
## [1] "100" "150" "200"
levels(Biomass_df$irrigation)
## [1] "A" "B"

3 levels fertilizer 100, 150, 200 and 2 levels irrigation A and B

  1. Set up all the hypotheses that should be set up to run this ANOVA.

For the effect of the Fertilization Method:

Ho: mean biomass yield is the same for all fertilizers Ha: There is a difference in the mean biomass yield for at least 2 types of the fertilizers

For the effect of the Type of Irrigation:

Ho: mean biomass yield is the same for both irrigation types Ha: There is a difference in the mean biomass yield for both types of irrigation

For the interaction between Irrigation and Fertilization:

Ho: There is no interaction effect.The effect of fertilizer on biomass yield does not depend on irrigation. Ha: There is an interaction effect. The effect of fertilizer on biomass yield depends on irrigation.

Run the ANOVA test

twoway_irrigation= aov(biomass ~ fertilizer * irrigation, data=Biomass_df)

summary (twoway_irrigation)
##                       Df  Sum Sq Mean Sq F value  Pr(>F)   
## fertilizer             2  500454  250227   3.536 0.04508 * 
## irrigation             1  707175  707175   9.994 0.00422 **
## fertilizer:irrigation  2  557130  278565   3.937 0.03322 * 
## Residuals             24 1698195   70758                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  1. Analyze the results and discuss which effects (among all possible effects) are statistically significant. Justify your answer.
  1. Construct the interaction plot and explain why it clearly shows the presence of interaction in this problem.

Note: Stating that “the interaction is evident because the lines are not parallel” (or a similar statement based on observing that the lines are not parallel) does NOT count as a valid explanation.

interaction.plot(x.factor = Biomass_df$fertilizer, 
                 trace.factor = Biomass_df$irrigation,  
                 response = Biomass_df$biomass, fun = mean,
                 type = "b", 
                 legend = TRUE, 
                 col = c("red", "blue"), 
                 pch = c(1, 2),
                 xlab = "Fertilizer", ylab="Biomass", trace.label = "Irrigation")

The result is shown on the Y axis.The different weights of fertilizer are shown on the X axis. The two types of irrigations are represented with two different lines. The interaction plot shows how the effects of fertilizer levels on mean biomass yields differ between irrigation A and B. The difference responses indicates a significant interaction in effect like in the one observed in the ANOVA results.

The lines for each irrigation are not parallel. Instead, they show a pattern where the biomass changes differently for each type of irrigation as the fertilizer changes. For irrigation A, the biomass remains relatively stable across different fertilizer. For irrigation B, there is a noticeable increase in biomass as the fertilizer increases. The difference in biomass between the two irrigation is more pronounced at 200lb of Fertilizer. This indicates that the effect of fertilizer on biomass is dependent on the level of irrigation.

Question 2 (40 points)

A study is done to determine if there is a difference in the average strength of a filament fiber produced by three machines. Researchers are also interested in studying the possible effect of changing the filament diameter on strength. Researchers decided to do the analysis using an alpha of 0.10.

setwd("E:\\S9510\\CAP3330")
Filament_df = read.csv("Filament.csv",colClasses = c("numeric","factor","factor"))
Filament_df
str(Filament_df)
## 'data.frame':    15 obs. of  3 variables:
##  $ strength: num  36 41 39 42 49 40 48 39 45 44 ...
##  $ diameter: Factor w/ 3 levels "20","24","28": 1 2 3 1 2 3 1 2 3 1 ...
##  $ machine : Factor w/ 3 levels "M1","M2","M3": 1 1 1 1 1 2 2 2 2 2 ...
  1. Identify: ● The outcome variable —–> strength ● The factor (or factors) —–> diameter and machine ● The levels of the factor (or levels of the factors)
# Diameter
levels(Filament_df$diameter)
## [1] "20" "24" "28"

3 levels diameter 20, 24, 28

# Machine
levels(Filament_df$machine )
## [1] "M1" "M2" "M3"

and 3 levels machine M1, M2, M3

  1. Analyze the results and discuss which effects (among all possible effects) are statistically significant. Justify your answer.

For the effect of the Diameter:

For the effect of the Machine:

For the interaction between diameter and machine:

filament_anova = aov(strength ~ diameter * machine, Filament_df)
summary(filament_anova)
##                  Df Sum Sq Mean Sq F value Pr(>F)  
## diameter          2   38.8   19.40   1.394 0.3183  
## machine           2  120.9   60.43   4.343 0.0682 .
## diameter:machine  4  103.2   25.81   1.854 0.2377  
## Residuals         6   83.5   13.92                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sort(tapply(Filament_df$strength, Filament_df$machine, mean)) 
##   M3   M1   M2 
## 36.0 41.4 43.2
#we do machine only since p-value is 0.0682
  1. Conduct a post-hoc test for the machine factor using the Tukey method. Discuss which machines lead to statistically different average strength. Explain and show your work.
TukeyHSD(filament_anova, which = "machine")
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = strength ~ diameter * machine, data = Filament_df)
## 
## $machine
##        diff        lwr       upr     p adj
## M2-M1  2.00  -5.239221 9.2392206 0.6897091
## M3-M1 -4.64 -11.879221 2.5992206 0.2012444
## M3-M2 -6.64 -13.879221 0.5992206 0.0685727

Analysis of Tukey for supplements The only p-value 0.06857 < alpha (0.10) is the one between M3 and M2. So, according to the Tukey method, the only difference that is statistically significant is the one between the mean of machine 3 and 2. In this case, not all p-values are less than alpha = 0.10; therefore, some differences are not significant.