PROBLEM: An experiment was conducted to determine if either firing temperature or furnace position affects the baked density of a carbon anode. The data are shown below.
| Position | 800°C | 825°C | 850°C |
|---|---|---|---|
| 1 | 570 | 1063 | 565 |
| 1 | 565 | 1080 | 510 |
| 1 | 583 | 1043 | 590 |
| 2 | 528 | 988 | 526 |
| 2 | 547 | 1026 | 538 |
| 2 | 521 | 1004 | 532 |
1. Write your experimental question. Use \(\alpha = 0.05\).
Is there a significant effect between firing temperature, furnace position and their interaction in the baked density of a carbon anode, using \(\alpha = 0.05\)?
2. Construct your null and alternative hypotheses.
The hypothesis being tested are the following:
For firing temperature:
\(H_o:\) There is no significant
main effect of firing temperature in the baked density of a carbon
anode.
\(H_a:\) There is a significant main
effect of firing temperature in the baked density of a carbon
anode.
For furnace position:
\(H_o:\) There is no significant
main effect of furnace position in the baked density of a carbon
anode.
\(H_a:\) There is a significant main
effect of furnace position in the baked density of a carbon anode.
For firing temperature and furnace position interaction:
\(H_o:\) There is no significant
interaction effect between firing temperature and furnace position in
the baked density of a carbon anode.
\(H_a:\) There is a significant
interaction effect between firing temperature and furnace position in
the baked density of a carbon anode.
3. Suppose we assume that no interaction exists.
(a) Write down the statistical model.
The model for the two-factor, no interaction model is \(Y_{ijk} =\mu + \tau_i +\beta_i +
\epsilon_{ijk}\)
where
(b) Conduct the analysis of variance assuming both treatments to be fixed effects.
Analysis of Variance Table
Response: obs
Df Sum Sq Mean Sq F value Pr(>F)
pos 1 7160 7160 15.998 0.001762 **
temp 2 945342 472671 1056.117 3.25e-14 ***
pos:temp 2 818 409 0.914 0.427110
Residual 12 5371 448
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(c) What conclusions/interpretations can be drawn?
Firing Temperature:
Furnace Position:
Position:Temperature Interaction:
Conclusion:
(d) Derive the expected mean squares.
The expected mean squares \((EMS)\) provide insights into the expected variability for each factor influencing the observed outcome. In a case without interaction effects, there are two main effects, one associated with each factor, and an error term. Consequently, the expected mean square for furnace position is 7160, while the expected mean square for firing temperature is 472671, and the expected mean square for the error term is 448.
(e) Comment on model adequacy.
The data is generally normally distributed with a few outliers. We
should consider discounting observations 6 and 9.
The data sets for each treatment generally have uniform variance. The
model is adequate without transformation or non-parametric tests.
The same plot is shown below:
4. Perform a post-hoc test using Tukey multiple comparisons of means. Use \(\alpha = 0.05\) . Provide interpretations of your findings.
Since there is no significant interaction between furnace position
and firing temperature, then we only compare the means between each
factor.
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = obs ~ pos + temp + pos * temp)
$pos
diff lwr upr p adj
2-1 -39.88889 -61.61776 -18.16002 0.0017624
The table above shows and suggests that the two furnace position
differs by \(-39.88889\) with the
corresponding p-value \((0.0017624)\)
which is less than to our significance level \(\alpha=0.05\), hence this difference is
statistically significant.
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = obs ~ pos + temp + pos * temp)
$temp
diff lwr upr p adj
825-800 481.666667 449.08101 514.25232 0.0000000
850-800 -8.833333 -41.41899 23.75232 0.7547952
850-825 -490.500000 -523.08566 -457.91434 0.0000000
Here, we observe that all pairs of means differ. Meanwhile, the pair
of temperatures \(850\) and \(800\) is the only one with a
non-significant difference. The pairs \(825−800\) and \(850−825\) exhibit statistically significant
differences.
5. Give details on the syntax used to produce your answer.
First, export the data from excel using library(readxl).
setwd("E:/Experimental Design")
dats<-read_xlsx("E:/Experimental Design//Problem Set 4.xlsx")
To customize the table of the data, we use library(knitr) and
library(kableExtra) and manipulate the design of the table.
kable(dats, format = "html") %>%
kable_styling(full_width = FALSE) %>%
row_spec(0, bold = TRUE, color = "black", background = "skyblue") %>%
row_spec(1:4, background = "white")
We use the package GAD which contains functions for the analysis of any complex ANOVA models with any combination of orthogonal/nested and fixed/random factors. We input our data into a variable and specify it as fixed using as.fixed. Then we use the function aov() and store it in the variable model to compute the estimation of model parameters. To create the ANOVA table, we use the function gad(model).
obs<- c(570,1063,565,565,1080,510,583,1043,590,528,988,526,547,1026,538,521,1004,532)
temp<- c(800,825,850)
pos<-c(rep(1,9),rep(2,9))
temp<-c(rep(temp,6))
pos <- as.fixed(pos)
temp <- as.fixed(temp)
model <- aov(obs~pos+temp+pos*temp)
GAD::gad(model)
To plot the model, we use the function plot(), in order to check on model adequacy.
plot(model,1)
plot(model,2)
check_model_adequacy <- function(model) {
# Diagnostic plots
par(mfrow = c(2, 2))
plot(model)
plot(model$fitted.values, model$residuals, main = "Residuals vs Fitted",
xlab = "Fitted Values", ylab = "Residuals")
qqnorm(model$residuals, main = "Normal Q-Q Plot")
qqline(model$residuals)
plot(sqrt(abs(model$residuals)), model$residuals, main = "Scale-Location Plot",
xlab = "Fitted Values", ylab = "sqrt(|Residuals|)")
}
model <- aov(obs ~ pos + temp + pos*temp)
check_model_adequacy(model)
To compute for Post-hoc test using Tukey multiple comparisons of
means with \(\alpha= 0.05\), we use the
function TukeyHSD() and store in the variable tukey_result.
tukey_res= TukeyHSD(model, "pos")
tukey_res
tukey_res= TukeyHSD(model, "temp")
tukey_res