PROBLEM 1

A. Describe completely the design structure and treatment structure used in the experiment.
    In this experiment factor B (operators) is nested within factor A (machines). The levels of operators (factor B)is not identical to each other at different levels of machine (factor A). Moreover, the machines are at different locations thus different operators were also used in each machine. Both the machines and operators are randomly selected.

B. Write the appropriate model for this experiment and define each term in the model accordingly.

\[ Y_{ijk}= \mu + \alpha_i + \beta_{j(i)} + \epsilon_{k(ij)}\]  where:
\(Y_{ijk}\) = observed response from the \(k^{th}\) unit in the \(j^{th}\) level of B (operators) within the \(i^{th}\) level of A (machine), \(i\)= 1,2,3,4; \(j\)= 1,2,3; \(k\)= 1,2
\(\mu\) = overall mean
\(\alpha_i\) = effect of the \(i^{th}\) level of A (machine)
\(\beta_{j(i)}\) = effect of the \(j^{th}\) level of B (operators) within the \(i^{th}\) level of A (machine)
\(\epsilon_{k(ij)}\) = random error associated with the \(k^{th}\) unit in the \(j^{th}\) level of B within the \(i^{th}\) level of A

C. Derive the expected mean squares for each term in the model.

\[E[MSA]=br\sigma_\alpha^2 + r\sigma_{\beta(\alpha)} + \sigma_\epsilon^2\] \[E[MSB(A)]= r\sigma_{\beta(\alpha)} + \sigma_\epsilon^2\] \[E[MSE]= \sigma_\epsilon^2\] D. Construct the ANOVA table and perform the necessary tests of hypothesis at \(\alpha=0.05\). Use the results in (C) for the correct F ratios. Draw appropriate conclusions.

prob1 <- read.csv("L5P1.csv")

model1 <- aov(observation ~machine/operator, data = prob1)
anova(model1)

TEST OF HYPOTHESIS

Effect of A (machine)
\(H_o: \sigma_\alpha^2 =0\)
\(H_a: \sigma_\alpha^2 >0\)
\(\alpha=0.05\)
Test Statistic:
\[ F= \frac {MSA}{MSB(A)} = \frac{1205.89}{352.21}\approx 3.424\] p-value = 0.0525
Decision on \(H_o:\)
We fail to reject the null hypothesis.
Conclusion:
There is no significant difference on the surface finish of metal parts among the four machines.


Effect of B (operator)
\(H_o: \sigma_{\beta(\alpha)}^2 =0\)
\(H_a: \sigma_{\beta(\alpha)}^2 >0\)
\(\alpha=0.05\)
Test Statistic:
\[ F= \frac {MSA}{MSE} = \frac{352.21}{84.50}\approx 4.168\] p-value = 0.0134
Decision on \(H_o:\)
We reject the null hypothesis.
Conclusion:
There is significant difference on the surface finish of metal parts among operators within each machines.

E. If possible, identify which operators differ in which machines. Summarize your answer in a table.

Post hoc analysis: operators within machine(s)

emmeans::emmeans(model1, pairwise~operator|machine, adjust="bonferroni")
## NOTE: A nesting structure was detected in the fitted model:
##     operator %in% machine
## $emmeans
## machine = M1:
##  operator emmean  SE df lower.CL upper.CL
##  O1         70.5 6.5 12     56.3     84.7
##  O2         84.0 6.5 12     69.8     98.2
##  O3         51.5 6.5 12     37.3     65.7
## 
## machine = M2:
##  operator emmean  SE df lower.CL upper.CL
##  O4         95.5 6.5 12     81.3    109.7
##  O5         82.0 6.5 12     67.8     96.2
##  O6         72.0 6.5 12     57.8     86.2
## 
## machine = M3:
##  operator emmean  SE df lower.CL upper.CL
##  O7         81.5 6.5 12     67.3     95.7
##  O8         54.5 6.5 12     40.3     68.7
##  O9         51.5 6.5 12     37.3     65.7
## 
## machine = M4:
##  operator emmean  SE df lower.CL upper.CL
##  O10        44.5 6.5 12     30.3     58.7
##  O11        48.0 6.5 12     33.8     62.2
##  O12        54.5 6.5 12     40.3     68.7
## 
## Confidence level used: 0.95 
## 
## $contrasts
## machine = M1:
##  contrast  estimate   SE df t.ratio p.value
##  O1 - O2      -13.5 9.19 12  -1.469  0.5030
##  O1 - O3       19.0 9.19 12   2.067  0.1831
##  O2 - O3       32.5 9.19 12   3.536  0.0123
## 
## machine = M2:
##  contrast  estimate   SE df t.ratio p.value
##  O4 - O5       13.5 9.19 12   1.469  0.5030
##  O4 - O6       23.5 9.19 12   2.556  0.0755
##  O5 - O6       10.0 9.19 12   1.088  0.8941
## 
## machine = M3:
##  contrast  estimate   SE df t.ratio p.value
##  O7 - O8       27.0 9.19 12   2.937  0.0373
##  O7 - O9       30.0 9.19 12   3.264  0.0204
##  O8 - O9        3.0 9.19 12   0.326  1.0000
## 
## machine = M4:
##  contrast  estimate   SE df t.ratio p.value
##  O10 - O11     -3.5 9.19 12  -0.381  1.0000
##  O10 - O12    -10.0 9.19 12  -1.088  0.8941
##  O11 - O12     -6.5 9.19 12  -0.707  1.0000
## 
## P value adjustment: bonferroni method for 3 tests

Summary table of means with letter designations

Machine Operator Mean
M1 O1 \(70.5^a\)
O2 \(84.0^a\)
O3 \(51.5^{ab}\)
M2 O4 \(95.5\)
O5 \(82.0\)
O6 \(72.0\)
M3 07 \(81.5^a\)
08 \(54.5^b\)
09 \(51.5^b\)
M4 O10 \(44.5\)
O11 \(48.0\)
012 \(54.5\)

F. Estimate the variance components

\(MSE = 84.50\)

\(MSA = br\sigma_\alpha^2 + r\sigma_{\beta(\alpha)}^2 + \sigma_\epsilon^2\)

\(MSB(A) = r\sigma_{\beta(\alpha)}^2 + \sigma_\epsilon^2\)

\(a = 4 , b = 9 , r = 2\)

\[ MSB(A) = r\sigma_{\beta(\alpha)}^2 + \sigma_\epsilon^2 \] \[352.21 = (2)\sigma_{\beta(\alpha)}^2 + 84.50\] \[ \sigma_{\beta(\alpha)}^2 = \frac {352.21-84.50}{2} \] \[\sigma_{\beta(\alpha)}^2 =133.855 \]

\[ MSA = br\sigma_\alpha^2 + r\sigma_{\beta(\alpha)}^2 + \sigma_\epsilon^2 \] \[MSA = br\sigma_\alpha^2 + MSB(A) \] \[ 1205.89 = 9(2)\sigma_\alpha^2 + 352.21 \] \[\sigma_\alpha^2 = \frac {1205.89-352.21}{18}\] \[\sigma_\alpha^2= 47.42667\]

thus, \[ V(Y_{ijk})= \sigma_{\beta(\alpha)}^2 + \sigma_\alpha^2 + \sigma_\epsilon^2 \] \[ V(Y_{ijk}) = 133.855 + 47.42667 + 84.50 \] \[ V(Y_{ijk}) = 265.7817 \] The estimated variance component is 265.7817.





PROBLEM 2
  A. Describe completely the design structure and treatment structure used in the experiment.

This experiment is a two-factor experiment wherein factor F (percent of fat in the meat) is the main plot factor and factor C (cooking method) is the subplot factor. Levels of factor F were randomized over the main plots and after which, the levels of factor C were also randomized over the subplots within each main plot.


B. Construct the ANOVA table and perform the necessary tests of hypothesis at \(\alpha=0.01\). Draw appropriate conclusions.

prob2 <- read.csv("L5P2.csv")
library(ExpDes)
with(prob2,split2.rbd(fat,Cooking,Taster,Score,
                             quali= c(TRUE,TRUE),
                             mcomp = "tukey",
                             fac.names = c("Fat Percentage","Cooking Method"),
                             sigT = 0.01,
                             sigF = 0.01,
                             unfold = NULL))
## ------------------------------------------------------------------------
## Legend:
## FACTOR 1 (plot):  Fat Percentage 
## FACTOR 2 (split-plot):  Cooking Method 
## ------------------------------------------------------------------------
## 
## ------------------------------------------------------------------------
## Analysis of Variance Table
## ------------------------------------------------------------------------
##                               DF      SS     MS     Fc  Pr(>Fc)    
## Fat Percentage                 2  804.39 402.19 31.822 0.000639 ***
## Block                          3  539.00 179.67 14.215 0.003910 ** 
## Error a                        6   75.83  12.64                    
## Cooking Method                 2  369.06 184.53 27.077    4e-06 ***
## Fat Percentage*Cooking Method  4    4.94   1.24  0.181 0.945068    
## Error b                       18  122.67   6.81                    
## Total                         35 1915.89                           
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ------------------------------------------------------------------------
## CV 1 = 4.44699 %
## CV 2 = 3.265418 %
## 
## No significant interaction: analyzing the simple effects
## ------------------------------------------------------------------------
## Fat Percentage
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     20      86.08333 
##  b    15      79.16667 
##  b    10      74.58333 
## ------------------------------------------------------------------------
## 
## Cooking Method
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     3   83.75 
##  b    2   80.16667 
##   c   1   75.91667 
## ------------------------------------------------------------------------
## 
## 
## 
## 
## Significant interaction: analyzing the interaction
## ------------------------------------------------------------------------
## 
## Analyzing  Fat Percentage  inside of each level of  Cooking Method 
## ------------------------------------------------------------------------
##                                          DF       SS         MS       Fc
## Fat Percentage : Cooking Method 1   2.00000 265.1667 132.583333 15.14170
## Fat Percentage : Cooking Method 2   2.00000 290.6667 145.333333 16.59781
## Fat Percentage : Cooking Method 3   2.00000 253.5000 126.750000 14.47550
## Pooled Error                       18.67788 163.5468   8.756173       NA
##                                     p.value
## Fat Percentage : Cooking Method 1  0.000123
## Fat Percentage : Cooking Method 2  0.000072
## Fat Percentage : Cooking Method 3  0.000160
## Pooled Error                             NA
## ------------------------------------------------------------------------
## 
## 
##  Fat Percentage inside of Cooking Method 1
## ------------------------------------------------------------------------
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     20      82.25 
##  b    15      74.5 
##  b    10      71 
## ------------------------------------------------------------------------
## 
##  Fat Percentage inside of Cooking Method 2
## ------------------------------------------------------------------------
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     20      86.5 
##  b    15      79.5 
##  b    10      74.5 
## ------------------------------------------------------------------------
## 
##  Fat Percentage inside of Cooking Method 3
## ------------------------------------------------------------------------
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     20      89.5 
## ab    15      83.5 
##  b    10      78.25 
## ------------------------------------------------------------------------
## 
## 
## Analyzing  Cooking Method  inside of each level of  Fat Percentage 
## ------------------------------------------------------------------------
##                                     DF       SS        MS        Fc  p.value
## Cooking Method : Fat Percentage 10   2 105.1667 52.583333  7.716032 0.003802
## Cooking Method : Fat Percentage 15   2 162.6667 81.333333 11.934782 0.000502
## Cooking Method : Fat Percentage 20   2 106.1667 53.083333  7.789402 0.003655
## Error b                             18 122.6667  6.814815        NA       NA
## ------------------------------------------------------------------------
## 
## 
##  Cooking Method inside of Fat Percentage 10
## ------------------------------------------------------------------------
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     3   78.25 
## ab    2   74.5 
##  b    1   71 
## ------------------------------------------------------------------------
## ------------------------------------------------------------------------
## 
## 
##  Cooking Method inside of Fat Percentage 15
## ------------------------------------------------------------------------
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     3   83.5 
## ab    2   79.5 
##  b    1   74.5 
## ------------------------------------------------------------------------
## ------------------------------------------------------------------------
## 
## 
##  Cooking Method inside of Fat Percentage 20
## ------------------------------------------------------------------------
## Tukey's test
## ------------------------------------------------------------------------
## Groups Treatments Means
## a     3   89.5 
## ab    2   86.5 
##  b    1   82.25 
## ------------------------------------------------------------------------
## ------------------------------------------------------------------------


HYPOTHEIS TESTING

BLOCK EFFECT

\(H_o:\rho_j=0\)
\(H_a: \rho_j>0\)
\(\alpha=0.01\)
Test Statistics:
\(F-value=31.822\) \(p-value=0.000639\)
Decision on \(H_o:\) We reject the null
Conclusion: There is significant block effect \((p-value < 0.01)\). Thus, Blocking strategy is effective.


INTERACTION EFFECT

\(H_o:(\alpha\beta)_{ik}=0\)
\(H_a:(\alpha\beta)_{ik}>0\)
\(\alpha=0.01\)
Test Statistics:
\(F-value=0.181\) \(p-value=0945068\)
Decision on \(H_o:\) We fail to reject the null
Conclusion: There is no significant interaction effect of Fat Percentage and Cooking Method \((p-value > 0.01)\).


FAT PERCENTAGE EFFECT

\(H_o:\alpha_i=0\)
\(H_a: \alpha_i>0\)
\(\alpha=0.01\)
Test Statistics:
\(F-value=31.822\) \(p-value=0.000639\)
Decision on \(H_o:\) We reject the null
Conclusion: Fat percentage has a significant effect on the score \((p-value < 0.01)\).

Post hoc on Fat Percentage means

Fat Percentage Mean
20 \(86.083^a\)
15 \(79.167^b\)
10 \(74.583^b\)



COOKING METHOD EFFECT

\(H_o:\beta_k=0\)
\(H_a: \beta_k>0\)
\(\alpha=0.01\)
Test Statistics:
\(F-value=27.077\) \(p-value < 0.001\)
Decision on \(H_o:\) We reject the null
Conclusion: Cooking method has a significant effect on the score \((p-value < 0.01)\).

post hoc on Cooking Method Effect

Cooking Method Mean
Fry \(83.75^a\)
Bake \(80.167^b\)
Broil \(75.917^c\)



C. Test at 1% level of significance if there are significant taster-to-taster differences.