Two-Way Basic Factorial Design (cont.)

Prof Randi Garcia
March 19, 2018

Reading Free-Write (5 minutes)

  1. Write a short description of your 290 project study
  2. Once the free-write is over, you will
    i. find two people who are both NOT in your group, and
    ii. take turns describing your studies to each other.

Announcements

  • Projects
    • Some of you need CITI training
    • Next component due on Apr 2 on Moodle
  • HW #5 due on Friday at 5pm on Moodle
  • SDS Presentation of the major
    • Tuesday, March 20th, noon in Ford 240
    • Food will be served!

Agenda

  • Exam 1 discussion
  • Mid-Semester Assessment
  • ANOVA for the BF[1] Design in R
  • The BF[2] design

Exam 1

  • Great job!
  • Median = 93, Mean = 91.06, sd = 7.33
  • Lots of trouble on the first question about the donuts. It was a BF[1] design, but many thought it was CB[1].

plot of chunk unnamed-chunk-1

 min Q1 median Q3 max    mean       sd  n missing
  67 89     93 95 100 91.0625 7.330614 32       0

Mid-Semester Assessment

Piglets

It seems natural to think that adding the right vitamins to a pig's diet might produce fatter pigs faster. You've decided to study the effects of B12 in two doses (0mg and 5mg). But pigs have bacteria living in their intestines that might prevent the uptake of vitamins, so you decided to give antibiotics to the pigs in one of two doses (0mg or 40 mg). You design your experiment in such a way that 3 piglets are randomly assigned to each of the 4 treatment conditions. You measure their weight every day, and take each pig's average daily weight gain as your final number recorded.

Research Questions in a BF[2] Design

  1. Does treatment A have an effect on the response variable?
    • Is there a main effect of factor 1?
  2. Does treatment B have an effect on the response variable?
    • Is there a main effect of factor 2?
  3. Does being in a specific combination of treatments have an effect over and above the additive effects of treatment A and B alone?
    • Is there an interaction between factor 1 and factor 2?

Interaction Graphs

Mantra: An interaction is present if the effect of one factor is different across levels of the other factor.

For each of the following interaction graphs, answer the following questions with YES or NO.

  1. Is there a main effect of B12?
  2. Is there a main effect of antibiotics?
  3. Is there an interaction between B12 and antibiotics?

Practice 1

plot of chunk unnamed-chunk-2

Practice 1

plot of chunk unnamed-chunk-3

  1. YES
  2. YES
  3. YES

Practice 2

plot of chunk unnamed-chunk-4

Practice 2

plot of chunk unnamed-chunk-5

  1. NO
  2. NO
  3. YES

Practice 3 (NEW)

plot of chunk unnamed-chunk-6

Practice 3

plot of chunk unnamed-chunk-7

  1. YES
  2. YES
  3. NO

Practice 4

plot of chunk unnamed-chunk-8

Practice 4

plot of chunk unnamed-chunk-9

  1. NO
  2. YES
  3. NO

Inside-outside Factors

  • Draw the factor diagram vertically and label all inside and outside factors with arrows. Include the universal factors (benchmark and residuals).

Mathematical notation

\[ {y}_{ijk}={\mu}+{\alpha}_{i}+{\beta}_{j}+{\alpha\beta}_{ij}+{e}_{ijk} \]

  • Where \( i \), from 1 to \( a \), is the level of the first factor,
  • \( j \), from 1 to \( b \), is the level of the second factor,
  • and \( k \), from 1 to \( n \), is the observation in each cell.

Sum of Squares (SS)

\[ {SS}_{A} = \sum_{i=1}^{a}bn(\bar{y}_{i..}-\bar{y}_{…})^{2} \]

\[ {SS}_{B} = \sum_{j=1}^{b}an(\bar{y}_{.j.}-\bar{y}_{…})^{2} \]

\[ {SS}_{AB} = n\sum_{i=1}^{a}\sum_{j=1}^{b}(\bar{y}_{ij.}-\bar{y}_{i..}-\bar{y}_{.j.}+\bar{y}_{…})^{2} \]

\[ {SS}_{E} = \sum_{i=1}^{a}\sum_{j=1}^{b}\sum_{k=1}^{n}({y}_{ijk}-\bar{y}_{ij.})^{2} \]

Degrees of Freedom (df)

\[ {df}_{A}=a-1 \]

\[ {df}_{B}=b-1 \]

\[ {df}_{AB}=(a-1)(b-1) \]

\[ {df}_{E}=ab(n-1) \]

Mean Squares (MS)

\[ {MS}_{A}=\frac{{SS}_{A}}{{df}_{A}} \]

\[ {MS}_{B}=\frac{{SS}_{B}}{{df}_{B}} \]

\[ {MS}_{AB}=\frac{{SS}_{AB}}{{df}_{AB}} \]

\[ {MS}_{E}=\frac{{SS}_{E}}{{df}_{E}} \]

F-ratios and the F-distribution

The ultimate statistics we want to calculate is Variability in treatment effects/Variability in residuals. The F-ratio.

\[ F = \frac{{MS}_{A}}{{MS}_{E}} \]

\[ F = \frac{{MS}_{B}}{{MS}_{E}} \]

\[ F = \frac{{MS}_{AB}}{{MS}_{E}} \]

ANOVA Source Table for BF[2]

\[ {y}_{ijk}={\mu}+{\alpha}_{i}+{\beta}_{j}+{\alpha\beta}_{ij}+{e}_{ijk} \]

Source SS df MS F
Treatment A \( \sum_{i=1}^{a}bn(\bar{y}_{i..}-\bar{y}_{…})^{2} \) \( a-1 \) \( \frac{{SS}_{A}}{{df}_{A}} \) \( \frac{{MS}_{A}}{{MS}_{E}} \)
Treatment B \( \sum_{j=1}^{b}an(\bar{y}_{.j.}-\bar{y}_{…})^{2} \) \( b-1 \) \( \frac{{SS}_{B}}{{df}_{B}} \) \( \frac{{MS}_{B}}{{MS}_{E}} \)
Interaction AB \( n\sum_{i=1}^{a}\sum_{j=1}^{b}(\bar{y}_{ij.}-\bar{y}_{i..}-\bar{y}_{.j.}+\bar{y}_{…})^{2} \) \( (a-1)(b-1) \) \( \frac{{SS}_{AB}}{{df}_{AB}} \) \( \frac{{MS}_{AB}}{{MS}_{E}} \)
Error \( \sum_{i=1}^{a}\sum_{j=1}^{b}\sum_{k=1}^{n}({y}_{ijk}-\bar{y}_{ij.})^{2} \) \( ab(n-1) \) \( \frac{{SS}_{E}}{{df}_{E}} \)

BF[2] in R