We have a main effect of sex and age session 1, and main effect of age for session 2/3 for T-maze, but no other main effects or interactions.
Read the data into R, select the columns of interest (T-maze data), exclude the Het mice (!= 1), and label the factors for Age, genotype, and sex. Ordered is used for age (as there are ordinal levels, eg young < adult < old), while factor is used for GT and SEX as there isn’t a scale difference. We have a total of 314 mice, but we will explore the sex, age, and genotype breakdowns in the later sections.
## Classes 'tbl_df', 'tbl' and 'data.frame': 600 obs. of 5 variables:
## $ Sex : Factor w/ 2 levels "Male","Female": 1 1 2 2 2 1 1 1 1 1 ...
## $ Age : Ord.factor w/ 3 levels "Young"<"Adult"<..: 3 3 3 3 3 2 2 2 2 2 ...
## $ Genotype: Factor w/ 2 levels "Wild-type","Knockout": 2 2 2 2 1 2 2 1 1 1 ...
## $ Session : Factor w/ 3 levels "Session 1","Session 2",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ TTC : num 25 24 25 25 21 25 NA 21 20 18 ...
Now that we have all the variables coded correctly, we can move on to exploratory data vizualization and stat testing.
We have >15 animals per group (sex:age:genotype).
Sex | Age | Genotype | n |
---|---|---|---|
Male | Young | Wild-type | 15 |
Male | Young | Knockout | 15 |
Male | Adult | Wild-type | 15 |
Male | Adult | Knockout | 16 |
Male | Old | Wild-type | 18 |
Male | Old | Knockout | 18 |
Female | Young | Wild-type | 16 |
Female | Young | Knockout | 16 |
Female | Adult | Wild-type | 17 |
Female | Adult | Knockout | 15 |
Female | Old | Wild-type | 16 |
Female | Old | Knockout | 23 |
We also can see the final output from our mean and standard error calculations.Now that everything is placed into corresponding rows and columns, we can start putting things into graphs. Everything is placed into the corresponding columns for Sex, Age, Genotype, Session, trials to criterion (TTC), and standard error (SE).
## # A tibble: 10 x 6
## # Groups: Sex, Age, Genotype [4]
## Sex Age Genotype Session TTC SE
## <fctr> <ord> <fctr> <fctr> <dbl> <dbl>
## 1 Male Young Wild-type Session 1 15.733333 1.2323677
## 2 Male Young Wild-type Session 2 11.666667 0.7014724
## 3 Male Young Wild-type Session 3 9.666667 1.2636556
## 4 Male Young Knockout Session 1 15.266667 0.6932784
## 5 Male Young Knockout Session 2 11.133333 0.8775869
## 6 Male Young Knockout Session 3 8.133333 0.8829963
## 7 Male Adult Wild-type Session 1 17.933333 1.1931019
## 8 Male Adult Wild-type Session 2 13.666667 1.2215005
## 9 Male Adult Wild-type Session 3 9.133333 1.2530597
## 10 Male Adult Knockout Session 1 16.466667 1.4936373
Our graph is faceted by sex and by session, with indivdual grouped bars for the different ages/genotypes within each facet. We can clearly see that there is a limited difference according to genotype, although age appears to negatively affect their performance. Additionally we can see there is possibly a sex difference for the first session. The young females in session 1 are performing at around the same level as adult females, and look to be performing worse than their young male counterparts. We will confirm this via the ANOVAs.
We will define a function to call the ANOVA 3 times, then also calculate post-hoc tests. We can see the results of each of the sessions, and we do in fact have an age effect at each session with a sex effect in session 1. No effects of genotype though!
## Df Sum Sq Mean Sq F value Pr(>F)
## Sex 1 105 105.26 4.349 0.0386 *
## Age 2 590 294.79 12.180 1.2e-05 ***
## Genotype 1 19 18.56 0.767 0.3825
## Sex:Age 2 46 23.12 0.955 0.3869
## Sex:Genotype 1 9 8.61 0.356 0.5516
## Age:Genotype 2 16 8.03 0.332 0.7181
## Sex:Age:Genotype 2 8 3.78 0.156 0.8556
## Residuals 159 3848 24.20
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 29 observations deleted due to missingness
## Df Sum Sq Mean Sq F value Pr(>F)
## Sex 1 7 7.4 0.366 0.546
## Age 2 1103 551.5 27.214 6.85e-11 ***
## Genotype 1 5 5.2 0.255 0.614
## Sex:Age 2 28 13.8 0.680 0.508
## Sex:Genotype 1 3 2.8 0.136 0.713
## Age:Genotype 2 39 19.5 0.962 0.384
## Sex:Age:Genotype 2 51 25.6 1.264 0.285
## Residuals 159 3222 20.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 29 observations deleted due to missingness
## Df Sum Sq Mean Sq F value Pr(>F)
## Sex 1 45 44.56 2.166 0.14310
## Age 2 216 108.25 5.261 0.00613 **
## Genotype 1 13 12.65 0.615 0.43410
## Sex:Age 2 6 3.13 0.152 0.85885
## Sex:Genotype 1 7 6.58 0.320 0.57244
## Age:Genotype 2 6 3.21 0.156 0.85583
## Sex:Age:Genotype 2 42 20.83 1.012 0.36576
## Residuals 159 3272 20.58
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 29 observations deleted due to missingness