One-way ANOVA Flashcards

1
Q

Differences in mean weight between 2 cattle breeds?

A
cattle
## # A tibble: 30 x 2
##    breed  weight
##       
##  1 Breed1   188.
##  2 Breed2   148.
##  3 Breed1   180.
##  4 Breed2   146.
##  5 Breed1   199.
##  6 Breed2   153.
##  7 Breed1   191.
##  8 Breed2   135.
##  9 Breed1   196.
## 10 Breed2   151.
## # ... with 20 more rows
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Two sample t-test

A

fit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Code for manual calculation of mean and varience?

A
cattlesummary %  # using the cattle data,
  group_by(breed) %>%  # group by the breed variable, then
  # calculate the mean and sd per group:
  summarise(mean_wt = mean(x = weight, na.rm = TRUE),
            sd_wt = sd(weight, na.rm = TRUE))
cattlesummary
## # A tibble: 2 x 3
##   breed  mean_wt sd_wt
##        
## 1 Breed1    196.  10.6
## 2 Breed2    154.  12.3
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Model assumptions (2-sample t-test)

A
  • equal variances
  • normality
  • independance of observations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Model assumptions (Normality) code

A
  1. ggplot(cattle, aes(breed, weight)) +
    geom_boxplot()
  2. hist(cattle$weight)
  3. shapiro.test(cattle$weight)
##     Shapiro-Wilk normality test
## 
## data:  cattle$weight
## W = 0.93704, p-value = 0.103

If p > 0.05, the distribution of the cattle data is not significantly different from a normal distribution, i.e. we can assume normality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens if assumptions are not met?

A
  • equal variences –> perform test with unequal variences (Welch t-test)
  • Normality –> if N>30 assume normality anyway (Central Limit Theorem)
  • Independence of observations –> if not independant, use paired t-test
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do we need to consider before running a t-test

A
  1. differences between the treatment effects (e.g. the difference between 4 diets of chickens)
  2. differences within the treatment effects (e.g. differences within each chicken diet)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When do you use a 1-way anova?

A

When there is only 1 factor

e.g. chicken diet (4 diet options) but only “factor” is the diet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Code for normality (model assumption)

A
chicks %
  pivot_longer(cols = starts_with("Diet"), 
    names_to = "diet", 
    values_to = "weight") %>%
  mutate(diet = as.factor(diet))

ggplot(chicks, aes(diet, weight)) +
geom_boxplot()

hist(chicks$weight)

shapiro.test(chicks$weight)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Code for equal variences (model assumptions)

A

bartlett.test(weight ~ diet, data = chicks)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How are the concepts of ANOVA divided into components?

A

Total Sums-of-Square (SS) = Treatment SS + Residual SS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ANOVA code in R

A

model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If null hypothesis is true what does that mean for the F statistic?

A

It should have a value around 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does a large F value suggest?

A

Null hypothesis is false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

emmeans plots (ANOVA)

A

library(emmeans)

emm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Summary of ANOVA

A

2-sample t-tests are limited to situation when we have experiments with only 2 levels

The ANOVA allows us to analyse experiments with 2 or more treatment levels

It can be generalised to analyse any experiment, e.g. more than 1 treatment factors

The ANOVA table helps us determine whether there is a significant different between at least one pair of treatment means