library(knitr)
library(rmarkdown)
library(lattice)
library(permute)
library(ggplot2)
library(lme4)
## Loading required package: Matrix
library(MuMIn)
library(vegan)
## This is vegan 2.6-4
library(emmeans)
library(lmerTest)
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
library(tibble)
library(plyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(readr)
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(pbkrtest)
library(tidyr)
##
## Attaching package: 'tidyr'
## The following objects are masked from 'package:Matrix':
##
## expand, pack, unpack
library(ggpubr)
##
## Attaching package: 'ggpubr'
## The following object is masked from 'package:plyr':
##
## mutate
library(ggthemes)
library(stringr)
library(ggfortify)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ purrr 1.0.1
## ✔ lubridate 1.9.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::arrange() masks plyr::arrange()
## ✖ purrr::compact() masks plyr::compact()
## ✖ dplyr::count() masks plyr::count()
## ✖ dplyr::desc() masks plyr::desc()
## ✖ tidyr::expand() masks Matrix::expand()
## ✖ dplyr::failwith() masks plyr::failwith()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::id() masks plyr::id()
## ✖ dplyr::lag() masks stats::lag()
## ✖ ggpubr::mutate() masks dplyr::mutate(), plyr::mutate()
## ✖ tidyr::pack() masks Matrix::pack()
## ✖ dplyr::rename() masks plyr::rename()
## ✖ dplyr::summarise() masks plyr::summarise()
## ✖ dplyr::summarize() masks plyr::summarize()
## ✖ tidyr::unpack() masks Matrix::unpack()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(car)
## Loading required package: carData
##
## Attaching package: 'car'
##
## The following object is masked from 'package:purrr':
##
## some
##
## The following object is masked from 'package:dplyr':
##
## recode
library(glmmTMB)
## Warning in checkMatrixPackageVersion(): Package version inconsistency detected.
## TMB was built with Matrix version 1.5.3
## Current Matrix version is 1.5.4
## Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package
library(nlme)
##
## Attaching package: 'nlme'
##
## The following object is masked from 'package:dplyr':
##
## collapse
##
## The following object is masked from 'package:lme4':
##
## lmList
library(moments)
library(rlang)
##
## Attaching package: 'rlang'
##
## The following objects are masked from 'package:purrr':
##
## %@%, flatten, flatten_chr, flatten_dbl, flatten_int, flatten_lgl,
## flatten_raw, invoke, splice
library(extrafont)
## Registering fonts with R
extrafont::loadfonts(quiet=TRUE)
library(readr)
Resp_data_summary <- read_csv("C:/Users/jc819096/OneDrive - James Cook University/DATA/Lab 3/Resp data/new resp data.csv")
## Rows: 580 Columns: 29
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (15): Parental_number, Maternal, Maternal_GF, Maternal_GM, Paternal, Pat...
## dbl (14): Tank, Density, Female, Male, Age, Wet_weight, RMR, Mo2_rest, Weigh...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
View(Resp_data_summary)
#combine column for x axis
Resp_data_summary <- Resp_data_summary %>%
unite(Temp:Control_CO2, col="Juv_treat", sep="_", remove=FALSE)
head(Resp_data_summary)
## # A tibble: 6 × 30
## Tank Density Parental_number Female Male Maternal Maternal_GF Maternal_GM
## <dbl> <dbl> <chr> <dbl> <dbl> <chr> <chr> <chr>
## 1 49 18 89 190 192 AE A E
## 2 64 11 81 42 138 DA D A
## 3 130 18 94 185 190 DA D A
## 4 111 21 45 76 77 DA D A
## 5 8 16 89 190 192 AE A E
## 6 10 18 71 42 193 DA D A
## # ℹ 22 more variables: Paternal <chr>, Paternal_GF <chr>, Paternal_GM <chr>,
## # Parental_treatment <chr>, DOM <chr>, DOT <chr>, DOD <chr>, Age <dbl>,
## # Juv_treat <chr>, Control_CO2 <chr>, Temp <chr>, am_pm <chr>,
## # Chamber_ID <chr>, Wet_weight <dbl>, RMR <dbl>, Mo2_rest <dbl>,
## # Weight <dbl>, MMR <dbl>, AS <dbl>, FS <dbl>, Mo2_max <dbl>, Mo2_AS <dbl>
#coding the factors
str(Resp_data_summary)
## tibble [580 × 30] (S3: tbl_df/tbl/data.frame)
## $ Tank : num [1:580] 49 64 130 111 8 10 8 102 145 132 ...
## $ Density : num [1:580] 18 11 18 21 16 18 16 19 20 13 ...
## $ Parental_number : chr [1:580] "89" "81" "94" "45" ...
## $ Female : num [1:580] 190 42 185 76 190 42 190 197 76 190 ...
## $ Male : num [1:580] 192 138 190 77 192 193 192 185 77 192 ...
## $ Maternal : chr [1:580] "AE" "DA" "DA" "DA" ...
## $ Maternal_GF : chr [1:580] "A" "D" "D" "D" ...
## $ Maternal_GM : chr [1:580] "E" "A" "A" "A" ...
## $ Paternal : chr [1:580] "FE" "CA" "AE" "EC" ...
## $ Paternal_GF : chr [1:580] "F" "C" "A" "E" ...
## $ Paternal_GM : chr [1:580] "E" "A" "E" "C" ...
## $ Parental_treatment: chr [1:580] "CCCC" "HHCC" "CCCH" "CCHC" ...
## $ DOM : chr [1:580] "6/01/2022" "19/02/2022" "15/02/2022" "26/01/2022" ...
## $ DOT : chr [1:580] "16/04/2022" "29/06/2022" "23/06/2022" "18/05/2022" ...
## $ DOD : chr [1:580] "17/04/2022" "30/06/2022" "24/06/2022" "19/05/2022" ...
## $ Age : num [1:580] 101 131 129 113 102 114 101 110 113 101 ...
## $ Juv_treat : chr [1:580] "zero_control" "elevated_control" "elevated_CO" "zero_control" ...
## $ Control_CO2 : chr [1:580] "control" "control" "CO" "control" ...
## $ Temp : chr [1:580] "zero" "elevated" "elevated" "zero" ...
## $ am_pm : chr [1:580] "pm" "am" "pm" "am" ...
## $ Chamber_ID : chr [1:580] "D" "A" "C" "C" ...
## $ Wet_weight : num [1:580] 0.88 0.92 0.97 0.98 0.98 0.99 1 1.02 1.03 1.03 ...
## $ RMR : num [1:580] 196 279 188 305 191 ...
## $ Mo2_rest : num [1:580] 0.17 0.26 0.18 0.3 0.19 0.19 0.19 0.23 0.32 0.17 ...
## $ Weight : num [1:580] 0.00088 0.00092 0.00097 0.00098 0.00098 0.00099 0.001 0.00102 0.00103 0.00103 ...
## $ MMR : num [1:580] 744 693 607 691 568 ...
## $ AS : num [1:580] 548 414 419 386 376 ...
## $ FS : num [1:580] 3.8 2.49 3.23 2.26 2.97 ...
## $ Mo2_max : num [1:580] 0.655 0.637 0.589 0.677 0.556 ...
## $ Mo2_AS : num [1:580] 0.48 0.38 0.41 0.38 0.37 0.73 0.81 0.5 0.54 0.53 ...
Resp_data_summary$Tank= factor (Resp_data_summary$Tank)
Resp_data_summary$Parental_number = factor (Resp_data_summary$Parental_number)
Resp_data_summary$Parental_treatment = factor (Resp_data_summary$Parental_treatment, levels=c("CCCC", "CCCH", "HHCC", "CCHC","HHHC"))
Resp_data_summary$Temp = factor (Resp_data_summary$Temp)
Resp_data_summary$Control_CO2 = factor (Resp_data_summary$Control_CO2, levels=c("control", "CO"))
Resp_data_summary$am_pm = factor (Resp_data_summary$am_pm)
Resp_data_summary$Juv_treat = factor (Resp_data_summary$Juv_treat, levels=c("zero_control", "elevated_control", "zero_CO", "elevated_CO"))
head(Resp_data_summary)
## # A tibble: 6 × 30
## Tank Density Parental_number Female Male Maternal Maternal_GF Maternal_GM
## <fct> <dbl> <fct> <dbl> <dbl> <chr> <chr> <chr>
## 1 49 18 89 190 192 AE A E
## 2 64 11 81 42 138 DA D A
## 3 130 18 94 185 190 DA D A
## 4 111 21 45 76 77 DA D A
## 5 8 16 89 190 192 AE A E
## 6 10 18 71 42 193 DA D A
## # ℹ 22 more variables: Paternal <chr>, Paternal_GF <chr>, Paternal_GM <chr>,
## # Parental_treatment <fct>, DOM <chr>, DOT <chr>, DOD <chr>, Age <dbl>,
## # Juv_treat <fct>, Control_CO2 <fct>, Temp <fct>, am_pm <fct>,
## # Chamber_ID <chr>, Wet_weight <dbl>, RMR <dbl>, Mo2_rest <dbl>,
## # Weight <dbl>, MMR <dbl>, AS <dbl>, FS <dbl>, Mo2_max <dbl>, Mo2_AS <dbl>
ggplot(Resp_data_summary, aes(y=RMR, x=Age)) + geom_point()
ggplot(Resp_data_summary, aes(y=RMR, x=Weight)) + geom_point()
ggplot(Resp_data_summary, aes(y=RMR, x=Juv_treat, colour=Parental_treatment)) + geom_boxplot()
ggplot(Resp_data_summary, aes(y=Weight, x=Age, colour=Parental_treatment)) + geom_point()
qqPlot(Resp_data_summary$RMR)
## [1] 39 330
shapiro.test(Resp_data_summary$RMR)
##
## Shapiro-Wilk normality test
##
## data: Resp_data_summary$RMR
## W = 0.98752, p-value = 7.339e-05
nortest::lillie.test(Resp_data_summary$RMR)
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: Resp_data_summary$RMR
## D = 0.042159, p-value = 0.01575
leveneTest(RMR ~ Parental_treatment * Temp * Control_CO2, data = Resp_data_summary)
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 19 1.4499 0.09793 .
## 560
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
kurtosis(Resp_data_summary$RMR)
## [1] 2.443537
lmer.RMR = lmer(RMR~ Parental_treatment * Temp * Control_CO2 + (1 | Maternal_GF) + (1 | Maternal_GM) + (1 | Paternal_GF) +(1 | Paternal_GM) + (1 | Chamber_ID ) , data = Resp_data_summary)
## boundary (singular) fit: see help('isSingular')
performance::check_model(lmer.RMR, check="homogeneity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.RMR, check="outliers")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.RMR, check="qq")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.RMR, check="normality")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.RMR, check="linearity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.RMR, check="pp_check")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
#Homogeneity
plot(lmer.RMR)
#normality
hist(residuals(lmer.RMR), col="darkgray")
shapiro.test(residuals(lmer.RMR))
##
## Shapiro-Wilk normality test
##
## data: residuals(lmer.RMR)
## W = 0.99371, p-value = 0.01625
qqnorm(resid(lmer.RMR))
qqline(resid(lmer.RMR))
#model fit
library(sjPlot)
## Learn more about sjPlot with 'browseVignettes("sjPlot")'.
plot_model(lmer.RMR, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]
## [[2]]$Paternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Chamber_ID
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Paternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
##
## [[3]]
##
## [[4]]
## `geom_smooth()` using formula = 'y ~ x'
#outlier test
outlierTest(lmer.RMR)
## No Studentized residuals with Bonferroni p < 0.05
## Largest |rstudent|:
## rstudent unadjusted p-value Bonferroni p
## 330 2.644477 0.0084141 NA
library(DHARMa)
## This is DHARMa 0.4.6. For overview type '?DHARMa'. For recent changes, type news(package = 'DHARMa')
plot(simulateResiduals(lmer.RMR))
summary(lmer.RMR)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RMR ~ Parental_treatment * Temp * Control_CO2 + (1 | Maternal_GF) +
## (1 | Maternal_GM) + (1 | Paternal_GF) + (1 | Paternal_GM) +
## (1 | Chamber_ID)
## Data: Resp_data_summary
##
## REML criterion at convergence: 5770.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.4534 -0.7002 0.0215 0.6342 2.5825
##
## Random effects:
## Groups Name Variance Std.Dev.
## Paternal_GF (Intercept) 23.41 4.839
## Chamber_ID (Intercept) 128.75 11.347
## Maternal_GF (Intercept) 0.00 0.000
## Paternal_GM (Intercept) 23.91 4.890
## Maternal_GM (Intercept) 18.74 4.329
## Residual 1512.25 38.888
## Number of obs: 580, groups:
## Paternal_GF, 5; Chamber_ID, 4; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 231.979 10.374 10.867
## Parental_treatmentCCCH -10.194 10.710 468.349
## Parental_treatmentHHCC 2.696 10.350 358.962
## Parental_treatmentCCHC -6.879 10.930 90.567
## Parental_treatmentHHHC 2.700 11.035 388.777
## Tempzero 3.264 9.885 540.629
## Control_CO2CO -8.800 10.242 548.326
## Parental_treatmentCCCH:Tempzero 9.732 14.122 542.656
## Parental_treatmentHHCC:Tempzero -4.443 13.703 541.787
## Parental_treatmentCCHC:Tempzero 3.309 13.930 541.037
## Parental_treatmentHHHC:Tempzero -18.516 14.882 541.395
## Parental_treatmentCCCH:Control_CO2CO 4.844 14.838 549.387
## Parental_treatmentHHCC:Control_CO2CO 5.211 14.185 545.816
## Parental_treatmentCCHC:Control_CO2CO -7.935 14.587 545.882
## Parental_treatmentHHHC:Control_CO2CO 5.923 15.132 546.173
## Tempzero:Control_CO2CO -3.510 14.378 548.063
## Parental_treatmentCCCH:Tempzero:Control_CO2CO -5.029 20.221 546.269
## Parental_treatmentHHCC:Tempzero:Control_CO2CO -5.960 19.911 544.605
## Parental_treatmentCCHC:Tempzero:Control_CO2CO 16.228 20.597 547.017
## Parental_treatmentHHHC:Tempzero:Control_CO2CO 17.053 21.330 547.596
## t value Pr(>|t|)
## (Intercept) 22.361 1.96e-10 ***
## Parental_treatmentCCCH -0.952 0.342
## Parental_treatmentHHCC 0.261 0.795
## Parental_treatmentCCHC -0.629 0.531
## Parental_treatmentHHHC 0.245 0.807
## Tempzero 0.330 0.741
## Control_CO2CO -0.859 0.391
## Parental_treatmentCCCH:Tempzero 0.689 0.491
## Parental_treatmentHHCC:Tempzero -0.324 0.746
## Parental_treatmentCCHC:Tempzero 0.238 0.812
## Parental_treatmentHHHC:Tempzero -1.244 0.214
## Parental_treatmentCCCH:Control_CO2CO 0.326 0.744
## Parental_treatmentHHCC:Control_CO2CO 0.367 0.714
## Parental_treatmentCCHC:Control_CO2CO -0.544 0.587
## Parental_treatmentHHHC:Control_CO2CO 0.391 0.696
## Tempzero:Control_CO2CO -0.244 0.807
## Parental_treatmentCCCH:Tempzero:Control_CO2CO -0.249 0.804
## Parental_treatmentHHCC:Tempzero:Control_CO2CO -0.299 0.765
## Parental_treatmentCCHC:Tempzero:Control_CO2CO 0.788 0.431
## Parental_treatmentHHHC:Tempzero:Control_CO2CO 0.799 0.424
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
Anova(lmer.RMR)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: RMR
## Chisq Df Pr(>Chisq)
## Parental_treatment 2.0037 4 0.73508
## Temp 0.3129 1 0.57593
## Control_CO2 4.9742 1 0.02573 *
## Parental_treatment:Temp 5.8496 4 0.21067
## Parental_treatment:Control_CO2 2.4799 4 0.64823
## Temp:Control_CO2 0.0007 1 0.97954
## Parental_treatment:Temp:Control_CO2 2.3768 4 0.66683
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#RMR
emmeans(lmer.RMR, pairwise ~ Control_CO2, adjust="tukey")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
## Control_CO2 emmean SE df lower.CL upper.CL
## control 230 7.96 5.43 210 250
## CO 224 8.03 5.49 203 244
##
## Results are averaged over the levels of: Parental_treatment, Temp
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## control - CO 6.72 3.28 552 2.047 0.0411
##
## Results are averaged over the levels of: Parental_treatment, Temp
## Degrees-of-freedom method: kenward-roger
plot(emmeans(lmer.RMR, pairwise ~ Control_CO2, adjust="tukey") )
## NOTE: Results may be misleading due to involvement in interactions
emmeans(lmer.RMR, pairwise ~ Control_CO2 * Temp, adjust="tukey")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
## Control_CO2 Temp emmean SE df lower.CL upper.CL
## control elevated 230 8.31 6.56 210 250
## CO elevated 222 8.35 6.61 202 242
## control zero 231 8.24 6.31 211 251
## CO zero 225 8.39 6.58 205 245
##
## Results are averaged over the levels of: Parental_treatment
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## control elevated - CO elevated 7.19 4.69 551 1.534 0.4177
## control elevated - control zero -1.28 4.52 550 -0.283 0.9920
## control elevated - CO zero 4.96 4.70 552 1.055 0.7168
## CO elevated - control zero -8.47 4.57 550 -1.856 0.2486
## CO elevated - CO zero -2.23 4.73 552 -0.471 0.9653
## control zero - CO zero 6.24 4.57 552 1.366 0.5213
##
## Results are averaged over the levels of: Parental_treatment
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
plot(emmeans(lmer.RMR, pairwise ~ Control_CO2 * Temp, adjust="tukey") )
## NOTE: Results may be misleading due to involvement in interactions
#for graphs
RMREMM = (emmeans(lmer.RMR, ~ Parental_treatment * Temp * Control_CO2 ) %>% as.data.frame)
RMREMM
## Parental_treatment Temp Control_CO2 emmean SE df lower.CL
## CCCC elevated control 231.9794 10.97763 17.50 208.8691
## CCCH elevated control 221.7853 11.66007 19.96 197.4594
## HHCC elevated control 234.6757 11.04371 15.89 211.2503
## CCHC elevated control 225.1003 11.46637 15.82 200.7704
## HHHC elevated control 234.6797 11.59048 22.92 210.6983
## CCCC zero control 235.2432 10.84004 16.56 212.3263
## CCCH zero control 234.7815 10.93576 15.09 211.4844
## HHCC zero control 233.4967 10.62413 13.50 210.6314
## CCHC zero control 231.6728 11.51770 16.22 207.2838
## HHHC zero control 219.4276 11.55305 22.08 195.4729
## CCCC elevated CO 223.1793 11.23083 18.85 199.6604
## CCCH elevated CO 217.8294 11.46491 19.14 193.8453
## HHCC elevated CO 231.0864 10.96434 15.37 207.7649
## CCHC elevated CO 208.3649 11.88278 20.28 183.5998
## HHHC elevated CO 231.8029 11.49858 22.13 207.9643
## CCCC zero CO 222.9332 11.16718 18.57 199.5235
## CCCH zero CO 222.2871 10.99119 15.44 198.9175
## HHCC zero CO 220.4380 11.29146 16.88 196.6019
## CCHC zero CO 227.6552 12.11643 19.56 202.3446
## HHHC zero CO 230.0937 11.53505 22.93 206.2276
## upper.CL
## 255.0897
## 246.1112
## 258.1011
## 249.4302
## 258.6611
## 258.1601
## 258.0786
## 256.3621
## 256.0618
## 243.3823
## 246.6982
## 241.8136
## 254.4079
## 233.1300
## 255.6415
## 246.3429
## 245.6568
## 244.2740
## 252.9658
## 253.9599
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
#combine column for x axis
RMREMM_graph <- RMREMM %>%
unite(Temp:Control_CO2 , col="Juv_treat", sep="_", remove=FALSE)
RMREMM_graph
## Parental_treatment Juv_treat Temp Control_CO2 emmean SE
## 1 CCCC elevated_control elevated control 231.9794 10.97763
## 2 CCCH elevated_control elevated control 221.7853 11.66007
## 3 HHCC elevated_control elevated control 234.6757 11.04371
## 4 CCHC elevated_control elevated control 225.1003 11.46637
## 5 HHHC elevated_control elevated control 234.6797 11.59048
## 6 CCCC zero_control zero control 235.2432 10.84004
## 7 CCCH zero_control zero control 234.7815 10.93576
## 8 HHCC zero_control zero control 233.4967 10.62413
## 9 CCHC zero_control zero control 231.6728 11.51770
## 10 HHHC zero_control zero control 219.4276 11.55305
## 11 CCCC elevated_CO elevated CO 223.1793 11.23083
## 12 CCCH elevated_CO elevated CO 217.8294 11.46491
## 13 HHCC elevated_CO elevated CO 231.0864 10.96434
## 14 CCHC elevated_CO elevated CO 208.3649 11.88278
## 15 HHHC elevated_CO elevated CO 231.8029 11.49858
## 16 CCCC zero_CO zero CO 222.9332 11.16718
## 17 CCCH zero_CO zero CO 222.2872 10.99119
## 18 HHCC zero_CO zero CO 220.4379 11.29146
## 19 CCHC zero_CO zero CO 227.6552 12.11643
## 20 HHHC zero_CO zero CO 230.0937 11.53505
## df lower.CL upper.CL
## 1 17.50189 208.8691 255.0897
## 2 19.95633 197.4594 246.1112
## 3 15.88507 211.2503 258.1011
## 4 15.82141 200.7704 249.4302
## 5 22.91941 210.6983 258.6611
## 6 16.55948 212.3263 258.1601
## 7 15.08838 211.4844 258.0786
## 8 13.50359 210.6314 256.3621
## 9 16.22441 207.2838 256.0618
## 10 22.07785 195.4729 243.3823
## 11 18.85200 199.6604 246.6982
## 12 19.14363 193.8453 241.8136
## 13 15.36647 207.7649 254.4079
## 14 20.28039 183.5998 233.1300
## 15 22.12769 207.9643 255.6415
## 16 18.57230 199.5235 246.3429
## 17 15.43633 198.9175 245.6568
## 18 16.87814 196.6019 244.2740
## 19 19.56342 202.3446 252.9658
## 20 22.92955 206.2276 253.9599
#Plot#
cbPalette <- c("#56B4E9", "#E69F00", "#D55E00","#009E73", "#999999")
#better labels#
graph <- ggplot(RMREMM_graph, aes (x = Juv_treat, y=emmean, colour=Parental_treatment)) + geom_pointrange(aes (ymin = emmean-SE, ymax = emmean+SE), position=position_dodge(width=1), size=1) +
facet_grid(~factor(Juv_treat, levels =c( "zero_control","elevated_control", "zero_CO", "elevated_CO"), labels=str_wrap(c("Control", "Elevated Temperature", "Elevated CO2", "Elevated Temperature & CO2"), width = 10)), scales = "free_x") + labs(x="Juvenile treatment", y=expression("Resting oxygen consumption (mg O"[2]*" kg"^{-1}*" hr"^{-1}*")")) +
scale_x_discrete(breaks = c("zero_control","elevated_control", "zero_CO", "elevated_CO"),
labels = str_wrap(
c("Control", "Warm temperature", "Elevated CO2", "Warm temperature & Elevated CO2"), width = 10)
) +
scale_colour_manual(values=cbPalette, name = "Cross-generation experience", labels = c("Control", "Parental development", "Grandparental development", "Grandparental post-maturation", "Continuous grandparent")) +
theme_calc() + theme(text = element_text(size=20)) + theme(panel.spacing = unit(1, "cm", data = NULL)) + theme_classic()+ theme(strip.text.x = element_blank())
print(graph)
#CO2 only pointrange graph
RMREMMCO = (emmeans(lmer.RMR, ~ Control_CO2 ) %>% as.data.frame)
## NOTE: Results may be misleading due to involvement in interactions
RMREMMCO
## Control_CO2 emmean SE df lower.CL upper.CL
## control 230.2842 7.961933 5.43 210.2952 250.2732
## CO 223.5670 8.030510 5.49 203.4682 243.6658
##
## Results are averaged over the levels of: Parental_treatment, Temp
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
co2graph <- ggplot(RMREMMCO, aes (x = factor(Control_CO2,level=c("control", "CO")), y=emmean, colour=Control_CO2)) + geom_pointrange(aes (ymin = emmean-SE, ymax = emmean+SE), position=position_dodge(width=1), size=1) +
labs(x=expression("CO"[2]*" developmental treatment"), y=expression("Resting oxygen consumption (mg O"[2]*" kg"^{-1}*" hr"^{-1}*")"))+
scale_x_discrete(breaks = c("control", "CO"), labels = str_wrap( c("Control", "Elevated CO2"), width = 10) ) +
theme_calc() + theme(text = element_text(size=20)) + theme(panel.spacing = unit(1, "cm", data = NULL)) +
theme_classic()+ theme(strip.text.x = element_blank()) +
scale_colour_manual(values=c("control" = "black", "CO" = "tan"), name = expression("CO"[2]*" developmental treatment"), limits = c("control", "CO"), labels = c("Control", "Elevated CO2"))
print(co2graph)
ggsave("RMR_co2graph.eps", co2graph, height = 6, width = 14, dpi = 320)
ggplot(Resp_data_summary, aes(y=MMR, x=Age)) + geom_point()
ggplot(Resp_data_summary, aes(y=MMR, x=Weight)) + geom_point()
ggplot(Resp_data_summary, aes(y=MMR, x=Juv_treat, colour=Parental_treatment)) + geom_boxplot()
qqPlot(Resp_data_summary$MMR)
## [1] 135 296
shapiro.test(Resp_data_summary$MMR)
##
## Shapiro-Wilk normality test
##
## data: Resp_data_summary$MMR
## W = 0.9772, p-value = 7.445e-08
nortest::lillie.test(Resp_data_summary$MMR)
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: Resp_data_summary$MMR
## D = 0.050961, p-value = 0.001084
leveneTest(MMR ~ Parental_treatment * Temp * Control_CO2, data = Resp_data_summary)
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 19 0.9229 0.5542
## 560
kurtosis(Resp_data_summary$MMR)
## [1] 2.639684
lmer.MMR = lmer(MMR~ Parental_treatment * Temp * Control_CO2 + (1 | Maternal_GF) + (1 | Maternal_GM) + (1 | Paternal_GF) +(1 | Paternal_GM) + (1 | Chamber_ID ) , data = Resp_data_summary)
## boundary (singular) fit: see help('isSingular')
performance::check_model(lmer.MMR, check="homogeneity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.MMR, check="outliers")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.MMR, check="qq")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.MMR, check="normality")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.MMR, check="linearity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.MMR, check="pp_check")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
#Homogeneity
plot(lmer.MMR)
#normality
hist(residuals(lmer.MMR), col="darkgray")
shapiro.test(residuals(lmer.MMR))
##
## Shapiro-Wilk normality test
##
## data: residuals(lmer.MMR)
## W = 0.98882, p-value = 0.0002085
qqnorm(resid(lmer.MMR))
qqline(resid(lmer.MMR))
#model fit
library(sjPlot)
plot_model(lmer.MMR, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]
## [[2]]$Paternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Chamber_ID
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Paternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
##
## [[3]]
##
## [[4]]
## `geom_smooth()` using formula = 'y ~ x'
#outlier test
outlierTest(lmer.MMR)
## No Studentized residuals with Bonferroni p < 0.05
## Largest |rstudent|:
## rstudent unadjusted p-value Bonferroni p
## 167 3.041723 0.0024638 NA
library(DHARMa)
plot(simulateResiduals(lmer.MMR))
summary(lmer.MMR)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MMR ~ Parental_treatment * Temp * Control_CO2 + (1 | Maternal_GF) +
## (1 | Maternal_GM) + (1 | Paternal_GF) + (1 | Paternal_GM) +
## (1 | Chamber_ID)
## Data: Resp_data_summary
##
## REML criterion at convergence: 7100.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1441 -0.6618 -0.1142 0.6503 2.9866
##
## Random effects:
## Groups Name Variance Std.Dev.
## Paternal_GF (Intercept) 0 0.00
## Chamber_ID (Intercept) 7032 83.85
## Maternal_GF (Intercept) 0 0.00
## Paternal_GM (Intercept) 0 0.00
## Maternal_GM (Intercept) 463 21.52
## Residual 16215 127.34
## Number of obs: 580, groups:
## Paternal_GF, 5; Chamber_ID, 4; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 645.560 49.766 5.638
## Parental_treatmentCCCH 2.155 34.140 555.415
## Parental_treatmentHHCC 38.336 33.298 546.108
## Parental_treatmentCCHC 25.009 34.379 397.129
## Parental_treatmentHHHC 127.398 35.143 556.795
## Tempzero -1.992 32.363 555.249
## Control_CO2CO 80.643 33.462 555.249
## Parental_treatmentCCCH:Tempzero 46.014 46.210 555.318
## Parental_treatmentHHCC:Tempzero -18.518 44.851 555.294
## Parental_treatmentCCHC:Tempzero -16.093 45.604 555.288
## Parental_treatmentHHHC:Tempzero -135.237 48.716 555.334
## Parental_treatmentCCCH:Control_CO2CO -64.258 48.455 555.342
## Parental_treatmentHHCC:Control_CO2CO -97.733 46.389 555.270
## Parental_treatmentCCHC:Control_CO2CO -80.468 47.699 555.261
## Parental_treatmentHHHC:Control_CO2CO -197.224 49.480 555.313
## Tempzero:Control_CO2CO -88.023 46.969 555.253
## Parental_treatmentCCCH:Tempzero:Control_CO2CO 41.206 66.110 555.254
## Parental_treatmentHHCC:Tempzero:Control_CO2CO 84.979 65.124 555.361
## Parental_treatmentCCHC:Tempzero:Control_CO2CO 131.545 67.334 555.308
## Parental_treatmentHHHC:Tempzero:Control_CO2CO 238.484 69.714 555.408
## t value Pr(>|t|)
## (Intercept) 12.972 2.06e-05 ***
## Parental_treatmentCCCH 0.063 0.949698
## Parental_treatmentHHCC 1.151 0.250107
## Parental_treatmentCCHC 0.727 0.467368
## Parental_treatmentHHHC 3.625 0.000315 ***
## Tempzero -0.062 0.950938
## Control_CO2CO 2.410 0.016278 *
## Parental_treatmentCCCH:Tempzero 0.996 0.319801
## Parental_treatmentHHCC:Tempzero -0.413 0.679853
## Parental_treatmentCCHC:Tempzero -0.353 0.724299
## Parental_treatmentHHHC:Tempzero -2.776 0.005689 **
## Parental_treatmentCCCH:Control_CO2CO -1.326 0.185342
## Parental_treatmentHHCC:Control_CO2CO -2.107 0.035580 *
## Parental_treatmentCCHC:Control_CO2CO -1.687 0.092163 .
## Parental_treatmentHHHC:Control_CO2CO -3.986 7.62e-05 ***
## Tempzero:Control_CO2CO -1.874 0.061448 .
## Parental_treatmentCCCH:Tempzero:Control_CO2CO 0.623 0.533343
## Parental_treatmentHHCC:Tempzero:Control_CO2CO 1.305 0.192477
## Parental_treatmentCCHC:Tempzero:Control_CO2CO 1.954 0.051248 .
## Parental_treatmentHHHC:Tempzero:Control_CO2CO 3.421 0.000670 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
Anova(lmer.MMR)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: MMR
## Chisq Df Pr(>Chisq)
## Parental_treatment 1.5963 4 0.809455
## Temp 3.5096 1 0.061014 .
## Control_CO2 0.0272 1 0.868980
## Parental_treatment:Temp 7.5152 4 0.111042
## Parental_treatment:Control_CO2 6.6014 4 0.158513
## Temp:Control_CO2 0.0691 1 0.792723
## Parental_treatment:Temp:Control_CO2 13.8028 4 0.007952 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#MMR
emmeans(lmer.MMR, pairwise ~ Temp, adjust="tukey")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
## Temp emmean SE df lower.CL upper.CL
## elevated 680 45.2 3.59 549 812
## zero 659 45.2 3.57 528 791
##
## Results are averaged over the levels of: Parental_treatment, Control_CO2
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## elevated - zero 21.1 10.7 553 1.972 0.0491
##
## Results are averaged over the levels of: Parental_treatment, Control_CO2
## Degrees-of-freedom method: kenward-roger
plot(emmeans(lmer.MMR, pairwise ~ Temp, adjust="tukey") )
## NOTE: Results may be misleading due to involvement in interactions
emmeans(lmer.MMR, pairwise ~ Temp*Parental_treatment)
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
## Temp Parental_treatment emmean SE df lower.CL upper.CL
## elevated CCCC 686 48.6 4.51 557 815
## zero CCCC 640 48.4 4.47 511 769
## elevated CCCH 656 49.4 4.61 526 786
## zero CCCH 677 48.6 4.32 545 808
## elevated HHCC 675 48.7 4.42 545 806
## zero HHCC 653 48.8 4.39 522 784
## elevated CCHC 671 49.9 4.62 539 802
## zero CCHC 674 50.2 4.62 542 807
## elevated HHHC 715 49.2 4.64 585 844
## zero HHHC 653 49.2 4.64 523 782
##
## Results are averaged over the levels of: Control_CO2
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## elevated CCCC - zero CCCC 46.00 23.5 552.8 1.954 0.6319
## elevated CCCC - elevated CCCH 29.97 27.7 169.2 1.082 0.9858
## elevated CCCC - zero CCCH 9.36 26.3 162.2 0.356 1.0000
## elevated CCCC - elevated HHCC 10.53 30.0 71.7 0.351 1.0000
## elevated CCCC - zero HHCC 32.56 30.6 55.5 1.063 0.9863
## elevated CCCC - elevated CCHC 15.22 35.4 51.5 0.430 1.0000
## elevated CCCC - zero CCHC 11.55 36.0 48.7 0.320 1.0000
## elevated CCCC - elevated HHHC -28.79 29.3 61.0 -0.983 0.9922
## elevated CCCC - zero HHHC 33.21 29.3 60.8 1.134 0.9790
## zero CCCC - elevated CCCH -16.03 27.3 161.2 -0.588 0.9999
## zero CCCC - zero CCCH -36.64 25.8 160.1 -1.422 0.9186
## zero CCCC - elevated HHCC -35.47 29.2 85.8 -1.214 0.9681
## zero CCCC - zero HHCC -13.44 29.8 65.7 -0.451 1.0000
## zero CCCC - elevated CCHC -30.78 34.8 56.5 -0.884 0.9964
## zero CCCC - zero CCHC -34.45 35.4 53.9 -0.973 0.9926
## zero CCCC - elevated HHHC -74.79 28.5 80.8 -2.629 0.2217
## zero CCCC - zero HHHC -12.79 28.4 80.4 -0.450 1.0000
## elevated CCCH - zero CCCH -20.61 23.3 552.5 -0.883 0.9969
## elevated CCCH - elevated HHCC -19.44 29.6 70.6 -0.656 0.9997
## elevated CCCH - zero HHCC 2.59 29.9 61.6 0.087 1.0000
## elevated CCCH - elevated CCHC -14.75 34.8 53.4 -0.423 1.0000
## elevated CCCH - zero CCHC -18.42 35.3 49.9 -0.522 0.9999
## elevated CCCH - elevated HHHC -58.76 30.3 22.5 -1.937 0.6468
## elevated CCCH - zero HHHC 3.24 30.3 22.5 0.107 1.0000
## zero CCCH - elevated HHCC 1.17 27.6 68.3 0.042 1.0000
## zero CCCH - zero HHCC 23.20 27.9 57.5 0.832 0.9977
## zero CCCH - elevated CCHC 5.86 33.3 49.0 0.176 1.0000
## zero CCCH - zero CCHC 2.19 33.7 46.6 0.065 1.0000
## zero CCCH - elevated HHHC -38.15 28.9 20.8 -1.321 0.9373
## zero CCCH - zero HHHC 23.85 28.9 20.7 0.826 0.9972
## elevated HHCC - zero HHCC 22.03 22.6 553.0 0.975 0.9935
## elevated HHCC - elevated CCHC 4.69 27.0 247.8 0.174 1.0000
## elevated HHCC - zero CCHC 1.02 27.3 249.1 0.037 1.0000
## elevated HHCC - elevated HHHC -39.32 29.4 120.1 -1.335 0.9433
## elevated HHCC - zero HHHC 22.68 29.4 120.1 0.771 0.9989
## zero HHCC - elevated CCHC -17.34 26.7 281.5 -0.649 0.9997
## zero HHCC - zero CCHC -21.01 26.9 282.9 -0.782 0.9988
## zero HHCC - elevated HHHC -61.35 29.7 112.0 -2.069 0.5532
## zero HHCC - zero HHHC 0.65 29.6 111.9 0.022 1.0000
## elevated CCHC - zero CCHC -3.68 24.2 552.2 -0.152 1.0000
## elevated CCHC - elevated HHHC -44.01 32.9 42.1 -1.338 0.9385
## elevated CCHC - zero HHHC 17.99 32.9 42.1 0.547 0.9999
## zero CCHC - elevated HHHC -40.34 33.4 41.0 -1.208 0.9668
## zero CCHC - zero HHHC 21.66 33.4 40.9 0.649 0.9997
## elevated HHHC - zero HHHC 62.00 25.7 550.9 2.409 0.3224
##
## Results are averaged over the levels of: Control_CO2
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
plot(emmeans(lmer.MMR, pairwise ~ Temp*Parental_treatment) )
## NOTE: Results may be misleading due to involvement in interactions
emmeans(lmer.MMR, pairwise ~ Control_CO2* Temp, adjust="tukey")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
## Control_CO2 Temp emmean SE df lower.CL upper.CL
## control elevated 684 45.8 3.79 554 814
## CO elevated 677 45.8 3.81 547 807
## control zero 657 45.7 3.75 527 788
## CO zero 661 46.0 3.81 531 791
##
## Results are averaged over the levels of: Parental_treatment
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## control elevated - CO elevated 7.29 15.4 554 0.475 0.9647
## control elevated - control zero 26.76 14.8 552 1.809 0.2700
## control elevated - CO zero 22.83 15.4 553 1.481 0.4496
## CO elevated - control zero 19.47 15.0 552 1.301 0.5624
## CO elevated - CO zero 15.54 15.5 554 1.003 0.7479
## control zero - CO zero -3.93 15.0 553 -0.262 0.9937
##
## Results are averaged over the levels of: Parental_treatment
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
plot(emmeans(lmer.MMR, pairwise ~ Control_CO2*Temp, adjust="tukey") )
## NOTE: Results may be misleading due to involvement in interactions
emmeans(lmer.MMR, pairwise ~ Parental_treatment * Temp * Control_CO2, adjust="tukey")
## $emmeans
## Parental_treatment Temp Control_CO2 emmean SE df lower.CL upper.CL
## CCCC elevated control 646 51.2 5.63 518 773
## CCCH elevated control 648 53.0 6.00 518 777
## HHCC elevated control 684 51.4 5.56 556 812
## CCHC elevated control 671 52.2 5.57 540 801
## HHHC elevated control 773 52.5 6.18 645 901
## CCCC zero control 644 50.8 5.48 516 771
## CCCH zero control 692 50.9 5.27 563 821
## HHCC zero control 663 50.5 5.17 535 792
## CCHC zero control 652 52.3 5.65 523 782
## HHHC zero control 636 52.5 6.05 508 764
## CCCC elevated CO 726 51.7 5.80 599 854
## CCCH elevated CO 664 52.0 5.91 536 792
## HHCC elevated CO 667 51.3 5.48 538 795
## CCHC elevated CO 671 53.2 6.22 542 800
## HHHC elevated CO 656 52.4 6.04 528 784
## CCCC zero CO 636 51.5 5.81 509 763
## CCCH zero CO 661 51.0 5.34 533 790
## HHCC zero CO 643 52.1 5.74 514 772
## CCHC zero CO 696 53.8 6.17 565 827
## HHHC zero CO 670 52.4 6.16 542 797
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## CCCC elevated control - CCCH elevated control -2.155 37.6 256.2 -0.057
## CCCC elevated control - HHCC elevated control -38.336 37.5 203.6 -1.021
## CCCC elevated control - CCHC elevated control -25.009 42.0 129.8 -0.595
## CCCC elevated control - HHHC elevated control -127.398 37.7 266.8 -3.382
## CCCC elevated control - CCCC zero control 1.992 32.4 551.4 0.062
## CCCC elevated control - CCCH zero control -46.177 34.4 326.6 -1.343
## CCCC elevated control - HHCC zero control -17.826 36.9 164.1 -0.483
## CCCC elevated control - CCHC zero control -6.924 42.0 136.8 -0.165
## CCCC elevated control - HHHC zero control 9.831 37.6 220.8 0.261
## CCCC elevated control - CCCC elevated CO -80.643 33.6 550.9 -2.402
## CCCC elevated control - CCCH elevated CO -18.540 35.7 434.6 -0.519
## CCCC elevated control - HHCC elevated CO -21.246 37.8 179.0 -0.562
## CCCC elevated control - CCHC elevated CO -25.184 43.1 154.0 -0.585
## CCCC elevated control - HHHC elevated CO -10.816 37.8 225.4 -0.286
## CCCC elevated control - CCCC zero CO 9.373 33.6 551.8 0.279
## CCCC elevated control - CCCH zero CO -15.745 34.5 351.8 -0.456
## CCCC elevated control - HHCC zero CO 2.309 39.2 151.2 0.059
## CCCC elevated control - CCHC zero CO -50.619 44.2 132.9 -1.145
## CCCC elevated control - HHHC zero CO -24.048 37.9 270.2 -0.635
## CCCH elevated control - HHCC elevated control -36.182 39.2 151.1 -0.923
## CCCH elevated control - CCHC elevated control -22.855 42.9 109.2 -0.533
## CCCH elevated control - HHHC elevated control -125.243 40.3 70.8 -3.110
## CCCH elevated control - CCCC zero control 4.147 37.2 253.2 0.111
## CCCH elevated control - CCCH zero control -44.022 33.2 554.1 -1.327
## CCCH elevated control - HHCC zero control -15.671 38.0 140.1 -0.413
## CCCH elevated control - CCHC zero control -4.769 43.2 114.4 -0.110
## CCCH elevated control - HHHC zero control 11.986 40.0 61.7 0.300
## CCCH elevated control - CCCC elevated CO -78.488 38.1 285.0 -2.059
## CCCH elevated control - CCCH elevated CO -16.385 35.5 554.0 -0.462
## CCCH elevated control - HHCC elevated CO -19.091 39.1 142.3 -0.488
## CCCH elevated control - CCHC elevated CO -23.029 44.3 132.5 -0.520
## CCCH elevated control - HHHC elevated CO -8.662 40.3 62.5 -0.215
## CCCH elevated control - CCCC zero CO 11.528 37.6 267.9 0.306
## CCCH elevated control - CCCH zero CO -13.590 33.6 554.5 -0.405
## CCCH elevated control - HHCC zero CO 4.463 40.4 129.0 0.111
## CCCH elevated control - CCHC zero CO -48.465 44.9 109.6 -1.080
## CCCH elevated control - HHHC zero CO -21.894 40.5 71.3 -0.540
## HHCC elevated control - CCHC elevated control 13.327 35.1 384.2 0.379
## HHCC elevated control - HHHC elevated control -89.061 38.4 299.2 -2.321
## HHCC elevated control - CCCC zero control 40.329 37.0 203.0 1.089
## HHCC elevated control - CCCH zero control -7.840 35.6 197.3 -0.220
## HHCC elevated control - HHCC zero control 20.510 31.1 552.6 0.659
## HHCC elevated control - CCHC zero control 31.413 35.3 425.0 0.889
## HHCC elevated control - HHHC zero control 48.168 38.2 289.2 1.260
## HHCC elevated control - CCCC elevated CO -42.306 38.1 231.3 -1.109
## HHCC elevated control - CCCH elevated CO 19.797 37.0 286.2 0.535
## HHCC elevated control - HHCC elevated CO 17.090 32.2 551.9 0.531
## HHCC elevated control - CCHC elevated CO 13.153 36.9 423.5 0.357
## HHCC elevated control - HHHC elevated CO 27.520 38.0 297.8 0.724
## HHCC elevated control - CCCC zero CO 47.709 37.2 291.4 1.281
## HHCC elevated control - CCCH zero CO 22.592 35.4 224.8 0.639
## HHCC elevated control - HHCC zero CO 40.645 33.1 554.0 1.227
## HHCC elevated control - CCHC zero CO -12.283 37.2 382.8 -0.330
## HHCC elevated control - HHHC zero CO 14.288 38.2 310.4 0.374
## CCHC elevated control - HHHC elevated control -102.388 40.9 124.5 -2.505
## CCHC elevated control - CCCC zero control 27.002 41.5 122.8 0.651
## CCHC elevated control - CCCH zero control -21.167 39.8 121.2 -0.532
## CCHC elevated control - HHCC zero control 7.183 33.5 415.0 0.214
## CCHC elevated control - CCHC zero control 18.086 32.1 551.6 0.563
## CCHC elevated control - HHHC zero control 34.841 40.7 110.6 0.855
## CCHC elevated control - CCCC elevated CO -55.633 42.4 132.6 -1.312
## CCHC elevated control - CCCH elevated CO 6.470 41.0 166.8 0.158
## CCHC elevated control - HHCC elevated CO 3.763 34.7 422.7 0.109
## CCHC elevated control - CCHC elevated CO -0.174 34.1 552.3 -0.005
## CCHC elevated control - HHHC elevated CO 14.193 40.3 110.7 0.352
## CCHC elevated control - CCCC zero CO 34.382 41.7 162.7 0.825
## CCHC elevated control - CCCH zero CO 9.265 39.6 133.9 0.234
## CCHC elevated control - HHCC zero CO 27.318 35.4 437.8 0.771
## CCHC elevated control - CCHC zero CO -25.610 34.1 552.2 -0.750
## CCHC elevated control - HHHC zero CO 0.961 40.4 124.9 0.024
## HHHC elevated control - CCCC zero control 129.390 37.5 215.5 3.453
## HHHC elevated control - CCCH zero control 81.221 37.5 74.0 2.168
## HHHC elevated control - HHCC zero control 109.571 37.4 269.4 2.930
## HHHC elevated control - CCHC zero control 120.474 41.1 141.6 2.934
## HHHC elevated control - HHHC zero control 137.229 36.4 551.5 3.767
## HHHC elevated control - CCCC elevated CO 46.755 38.9 150.8 1.202
## HHHC elevated control - CCCH elevated CO 108.858 38.9 100.9 2.798
## HHHC elevated control - HHCC elevated CO 106.151 38.4 283.6 2.764
## HHHC elevated control - CCHC elevated CO 102.214 42.2 154.5 2.420
## HHHC elevated control - HHHC elevated CO 116.581 36.5 551.7 3.194
## HHHC elevated control - CCCC zero CO 136.770 37.7 280.5 3.628
## HHHC elevated control - CCCH zero CO 111.653 37.5 83.9 2.978
## HHHC elevated control - HHCC zero CO 129.706 39.6 279.9 3.279
## HHHC elevated control - CCHC zero CO 76.778 43.1 130.4 1.781
## HHHC elevated control - HHHC zero CO 103.349 36.8 551.3 2.806
## CCCC zero control - CCCH zero control -48.169 34.0 320.2 -1.418
## CCCC zero control - HHCC zero control -19.818 36.4 158.5 -0.545
## CCCC zero control - CCHC zero control -8.916 41.5 130.1 -0.215
## CCCC zero control - HHHC zero control 7.839 37.5 175.7 0.209
## CCCC zero control - CCCC elevated CO -82.635 33.0 552.0 -2.503
## CCCC zero control - CCCH elevated CO -20.532 35.3 434.6 -0.582
## CCCC zero control - HHCC elevated CO -23.238 37.3 175.8 -0.623
## CCCC zero control - CCHC elevated CO -27.176 42.6 145.6 -0.638
## CCCC zero control - HHHC elevated CO -12.808 37.7 179.9 -0.340
## CCCC zero control - CCCC zero CO 7.381 33.1 552.1 0.223
## CCCC zero control - CCCH zero CO -17.737 34.1 343.2 -0.520
## CCCC zero control - HHCC zero CO 0.317 38.7 147.1 0.008
## CCCC zero control - CCHC zero CO -52.611 43.7 127.8 -1.203
## CCCC zero control - HHHC zero CO -26.040 37.7 218.9 -0.691
## CCCH zero control - HHCC zero control 28.351 34.4 174.5 0.824
## CCCH zero control - CCHC zero control 39.253 40.0 127.7 0.981
## CCCH zero control - HHHC zero control 56.008 37.2 63.2 1.505
## CCCH zero control - CCCC elevated CO -34.466 34.9 353.8 -0.986
## CCCH zero control - CCCH elevated CO 27.637 32.7 552.7 0.844
## CCCH zero control - HHCC elevated CO 24.931 35.6 180.3 0.700
## CCCH zero control - CCHC elevated CO 20.993 41.2 143.8 0.509
## CCCH zero control - HHHC elevated CO 35.360 37.4 63.9 0.945
## CCCH zero control - CCCC zero CO 55.550 34.4 344.9 1.614
## CCCH zero control - CCCH zero CO 30.432 30.7 551.8 0.991
## CCCH zero control - HHCC zero CO 48.485 36.9 158.5 1.313
## CCCH zero control - CCHC zero CO -4.443 41.9 124.6 -0.106
## CCCH zero control - HHHC zero CO 22.128 37.7 74.5 0.588
## HHCC zero control - CCHC zero control 10.902 33.8 444.7 0.323
## HHCC zero control - HHHC zero control 27.658 37.2 258.9 0.744
## HHCC zero control - CCCC elevated CO -62.816 37.5 182.6 -1.675
## HHCC zero control - CCCH elevated CO -0.714 36.0 255.3 -0.020
## HHCC zero control - HHCC elevated CO -3.420 30.8 551.2 -0.111
## HHCC zero control - CCHC elevated CO -7.357 35.4 452.6 -0.208
## HHCC zero control - HHHC elevated CO 7.010 36.9 265.6 0.190
## HHCC zero control - CCCC zero CO 27.199 36.5 242.2 0.745
## HHCC zero control - CCCH zero CO 2.082 34.2 196.5 0.061
## HHCC zero control - HHCC zero CO 20.135 31.7 553.0 0.635
## HHCC zero control - CCHC zero CO -32.793 35.6 416.3 -0.921
## HHCC zero control - HHHC zero CO -6.222 37.1 278.3 -0.168
## CCHC zero control - HHHC zero control 16.755 40.9 125.2 0.410
## CCHC zero control - CCCC elevated CO -73.719 42.4 141.5 -1.738
## CCHC zero control - CCCH elevated CO -11.616 41.2 175.4 -0.282
## CCHC zero control - HHCC elevated CO -14.322 34.9 451.3 -0.410
## CCHC zero control - CCHC elevated CO -18.260 34.3 552.4 -0.532
## CCHC zero control - HHHC elevated CO -3.892 40.4 125.2 -0.096
## CCHC zero control - CCCC zero CO 16.297 41.7 173.2 0.391
## CCHC zero control - CCCH zero CO -8.821 39.9 141.4 -0.221
## CCHC zero control - HHCC zero CO 9.233 35.7 454.5 0.258
## CCHC zero control - CCHC zero CO -43.696 34.4 553.2 -1.269
## CCHC zero control - HHHC zero CO -17.124 40.6 141.9 -0.422
## HHHC zero control - CCCC elevated CO -90.474 38.9 123.1 -2.326
## HHHC zero control - CCCH elevated CO -28.371 38.7 86.6 -0.732
## HHHC zero control - HHCC elevated CO -31.078 38.2 274.6 -0.813
## HHHC zero control - CCHC elevated CO -35.015 42.1 137.8 -0.831
## HHHC zero control - HHHC elevated CO -20.648 36.1 551.3 -0.572
## HHHC zero control - CCCC zero CO -0.458 37.6 234.6 -0.012
## HHHC zero control - CCCH zero CO -25.576 37.3 72.1 -0.686
## HHHC zero control - HHCC zero CO -7.523 39.4 276.8 -0.191
## HHHC zero control - CCHC zero CO -60.451 42.9 117.8 -1.408
## HHHC zero control - HHHC zero CO -33.880 36.5 552.1 -0.928
## CCCC elevated CO - CCCH elevated CO 62.103 36.2 459.3 1.714
## CCCC elevated CO - HHCC elevated CO 59.396 38.4 200.4 1.548
## CCCC elevated CO - CCHC elevated CO 55.459 43.5 156.1 1.275
## CCCC elevated CO - HHHC elevated CO 69.826 39.1 126.1 1.788
## CCCC elevated CO - CCCC zero CO 90.016 34.3 552.9 2.627
## CCCC elevated CO - CCCH zero CO 64.898 35.1 369.6 1.848
## CCCC elevated CO - HHCC zero CO 82.951 39.8 167.7 2.086
## CCCC elevated CO - CCHC zero CO 30.023 44.6 136.0 0.673
## CCCC elevated CO - HHHC zero CO 56.594 39.1 153.6 1.449
## CCCH elevated CO - HHCC elevated CO -2.706 37.0 261.4 -0.073
## CCCH elevated CO - CCHC elevated CO -6.644 42.4 187.6 -0.157
## CCCH elevated CO - HHHC elevated CO 7.723 39.0 88.1 0.198
## CCCH elevated CO - CCCC zero CO 27.913 35.8 438.4 0.779
## CCCH elevated CO - CCCH zero CO 2.795 32.9 552.3 0.085
## CCCH elevated CO - HHCC zero CO 20.848 38.3 226.6 0.544
## CCCH elevated CO - CCHC zero CO -32.080 43.1 170.5 -0.744
## CCCH elevated CO - HHHC zero CO -5.509 39.1 102.0 -0.141
## HHCC elevated CO - CCHC elevated CO -3.938 36.4 457.3 -0.108
## HHCC elevated CO - HHHC elevated CO 10.430 38.0 283.1 0.275
## HHCC elevated CO - CCCC zero CO 30.619 37.4 258.4 0.819
## HHCC elevated CO - CCCH zero CO 5.502 35.3 203.2 0.156
## HHCC elevated CO - HHCC zero CO 23.555 32.7 552.4 0.720
## HHCC elevated CO - CCHC zero CO -29.373 36.7 425.8 -0.801
## HHCC elevated CO - HHHC zero CO -2.802 38.1 294.4 -0.074
## CCHC elevated CO - HHHC elevated CO 14.367 41.7 138.1 0.344
## CCHC elevated CO - CCCC zero CO 34.557 42.8 187.8 0.807
## CCHC elevated CO - CCCH zero CO 9.439 41.1 154.0 0.230
## CCHC elevated CO - HHCC zero CO 27.492 37.2 468.3 0.739
## CCHC elevated CO - CCHC zero CO -25.436 36.3 553.5 -0.700
## CCHC elevated CO - HHHC zero CO 1.135 41.8 155.2 0.027
## HHHC elevated CO - CCCC zero CO 20.189 37.7 238.1 0.535
## HHHC elevated CO - CCCH zero CO -4.928 37.5 72.5 -0.132
## HHHC elevated CO - HHCC zero CO 13.125 39.1 289.6 0.336
## HHHC elevated CO - CCHC zero CO -39.803 42.4 117.7 -0.939
## HHHC elevated CO - HHHC zero CO -13.232 36.4 551.5 -0.363
## CCCC zero CO - CCCH zero CO -25.118 34.6 369.1 -0.727
## CCCC zero CO - HHCC zero CO -7.064 38.8 217.7 -0.182
## CCCC zero CO - CCHC zero CO -59.992 43.8 164.8 -1.369
## CCCC zero CO - HHHC zero CO -33.421 37.8 282.4 -0.883
## CCCH zero CO - HHCC zero CO 18.053 36.7 176.7 0.492
## CCCH zero CO - CCHC zero CO -34.875 41.7 138.2 -0.836
## CCCH zero CO - HHHC zero CO -8.304 37.7 84.0 -0.220
## HHCC zero CO - CCHC zero CO -52.928 37.3 451.4 -1.419
## HHCC zero CO - HHHC zero CO -26.357 39.3 295.2 -0.671
## CCHC zero CO - HHHC zero CO 26.571 42.6 130.8 0.624
## p.value
## 1.0000
## 1.0000
## 1.0000
## 0.0904
## 1.0000
## 0.9987
## 1.0000
## 1.0000
## 1.0000
## 0.6594
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9998
## 1.0000
## 1.0000
## 1.0000
## 0.2076
## 1.0000
## 0.9989
## 1.0000
## 1.0000
## 1.0000
## 0.8746
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9999
## 1.0000
## 1.0000
## 0.7185
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 0.9994
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9993
## 1.0000
## 0.9996
## 1.0000
## 1.0000
## 0.5823
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9989
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.0753
## 0.8093
## 0.2787
## 0.2832
## 0.0252
## 0.9997
## 0.3730
## 0.3866
## 0.6459
## 0.1461
## 0.0427
## 0.2682
## 0.1201
## 0.9624
## 0.3543
## 0.9973
## 1.0000
## 1.0000
## 1.0000
## 0.5817
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9997
## 1.0000
## 1.0000
## 1.0000
## 0.9925
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9876
## 1.0000
## 0.9989
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9804
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9707
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9994
## 1.0000
## 0.7127
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9971
## 1.0000
## 0.9766
## 0.9919
## 0.9993
## 0.9609
## 0.4858
## 0.9504
## 0.8591
## 1.0000
## 0.9961
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9981
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9974
## 1.0000
## 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 20 estimates
plot(emmeans(lmer.MMR, pairwise ~ Parental_treatment * Temp * Control_CO2, adjust="tukey") )
#for graphs
MMREMM = (emmeans(lmer.MMR, ~ Parental_treatment * Temp * Control_CO2 ) %>% as.data.frame)
MMREMM
## Parental_treatment Temp Control_CO2 emmean SE df lower.CL
## CCCC elevated control 645.5596 51.15270 5.63 518.3750
## CCCH elevated control 647.7144 52.99394 6.00 518.0222
## HHCC elevated control 683.8960 51.40446 5.56 555.6572
## CCHC elevated control 670.5691 52.23436 5.57 540.3061
## HHHC elevated control 772.9571 52.52655 6.18 645.3075
## CCCC zero control 643.5675 50.84310 5.48 516.2256
## CCCH zero control 691.7364 50.93511 5.27 562.8122
## HHCC zero control 663.3859 50.50652 5.17 534.8080
## CCHC zero control 652.4835 52.29959 5.65 522.5672
## HHHC zero control 635.7282 52.46546 6.05 507.6023
## CCCC elevated CO 726.2022 51.67712 5.80 598.7146
## CCCH elevated CO 664.0994 51.98632 5.91 536.4278
## HHCC elevated CO 666.8057 51.25924 5.48 538.4459
## CCHC elevated CO 670.7433 53.22907 6.22 541.5865
## HHHC elevated CO 656.3759 52.39038 6.04 528.3980
## CCCC zero CO 636.1867 51.51720 5.81 509.1031
## CCCH zero CO 661.3042 51.00431 5.34 532.6797
## HHCC zero CO 643.2509 52.08160 5.74 514.3734
## CCHC zero CO 696.1790 53.84988 6.17 565.2738
## HHHC zero CO 669.6079 52.44571 6.16 542.0993
## upper.CL
## 772.7442
## 777.4065
## 812.1348
## 800.8320
## 900.6067
## 770.9095
## 820.6606
## 791.9637
## 782.3998
## 763.8541
## 853.6897
## 791.7711
## 795.1655
## 799.9000
## 784.3539
## 763.2703
## 789.9287
## 772.1285
## 827.0842
## 797.1166
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
#combine column for x axis
MMREMM_graph <- MMREMM %>%
unite(Temp:Control_CO2 , col="Juv_treat", sep="_", remove=FALSE)
MMREMM_graph
## Parental_treatment Juv_treat Temp Control_CO2 emmean SE
## 1 CCCC elevated_control elevated control 645.5596 51.15270
## 2 CCCH elevated_control elevated control 647.7144 52.99394
## 3 HHCC elevated_control elevated control 683.8960 51.40446
## 4 CCHC elevated_control elevated control 670.5691 52.23436
## 5 HHHC elevated_control elevated control 772.9571 52.52655
## 6 CCCC zero_control zero control 643.5675 50.84310
## 7 CCCH zero_control zero control 691.7364 50.93511
## 8 HHCC zero_control zero control 663.3859 50.50652
## 9 CCHC zero_control zero control 652.4835 52.29959
## 10 HHHC zero_control zero control 635.7282 52.46546
## 11 CCCC elevated_CO elevated CO 726.2022 51.67712
## 12 CCCH elevated_CO elevated CO 664.0994 51.98632
## 13 HHCC elevated_CO elevated CO 666.8057 51.25924
## 14 CCHC elevated_CO elevated CO 670.7433 53.22907
## 15 HHHC elevated_CO elevated CO 656.3759 52.39038
## 16 CCCC zero_CO zero CO 636.1867 51.51720
## 17 CCCH zero_CO zero CO 661.3042 51.00431
## 18 HHCC zero_CO zero CO 643.2509 52.08160
## 19 CCHC zero_CO zero CO 696.1790 53.84988
## 20 HHHC zero_CO zero CO 669.6079 52.44571
## df lower.CL upper.CL
## 1 5.630482 518.3750 772.7442
## 2 5.996059 518.0222 777.4065
## 3 5.559366 555.6572 812.1348
## 4 5.566810 540.3061 800.8320
## 5 6.175088 645.3075 900.6067
## 6 5.477618 516.2256 770.9095
## 7 5.272385 562.8122 820.6606
## 8 5.167179 534.8080 791.9637
## 9 5.650441 522.5672 782.3998
## 10 6.049152 507.6023 763.8541
## 11 5.804748 598.7146 853.6897
## 12 5.911003 536.4278 791.7711
## 13 5.481483 538.4459 795.1655
## 14 6.216162 541.5865 799.9000
## 15 6.042200 528.3980 784.3539
## 16 5.806463 509.1031 763.2703
## 17 5.342199 532.6797 789.9287
## 18 5.735466 514.3734 772.1285
## 19 6.167119 565.2738 827.0842
## 20 6.163636 542.0993 797.1166
#Plot#
cbPalette <- c("#56B4E9", "#E69F00", "#D55E00","#009E73", "#999999")
#better labels#
graph <- ggplot(MMREMM_graph, aes (x = Juv_treat, y=emmean, colour=Parental_treatment)) + geom_pointrange(aes (ymin = emmean-SE, ymax = emmean+SE), position=position_dodge(width=1), size=1) +
facet_grid(~factor(Juv_treat, levels =c( "zero_control","elevated_control", "zero_CO", "elevated_CO"), labels=str_wrap(c("Control", "Elevated Temperature", "Elevated CO2", "Elevated Temperature & CO2"), width = 10)), scales = "free_x") + labs(x="Juvenile treatment", y=expression("Maximum oxygen consumption (mg O"[2]*" kg"^{-1}*" hr"^{-1}*")")) +
scale_x_discrete(breaks = c("zero_control","elevated_control", "zero_CO", "elevated_CO"),
labels = str_wrap(
c("Control", "Warm temperature", "Elevated CO2", "Warm temperature & Elevated CO2" ), width = 10)
) +
scale_colour_manual(values=cbPalette, name = "Cross-generation experience", labels = c("Control", "Parental development", "Grandparental development", "Grandparental post-maturation", "Continuous grandparent")) +
theme_calc() + theme(text = element_text(size=20)) + theme(panel.spacing = unit(1, "cm", data = NULL)) + theme_classic()+ theme(strip.text.x = element_blank())
print(graph)
ggsave("MMR_graph.eps", graph, height = 6, width = 14, dpi = 320)
ggplot(Resp_data_summary, aes(y=AS, x=Age)) + geom_point()
ggplot(Resp_data_summary, aes(y=AS, x=Weight)) + geom_point()
ggplot(Resp_data_summary, aes(y=AS, x=Juv_treat, colour=Parental_treatment)) + geom_boxplot()
qqPlot(Resp_data_summary$AS)
## [1] 271 135
shapiro.test(Resp_data_summary$AS)
##
## Shapiro-Wilk normality test
##
## data: Resp_data_summary$AS
## W = 0.97801, p-value = 1.191e-07
nortest::lillie.test(Resp_data_summary$AS)
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: Resp_data_summary$AS
## D = 0.061425, p-value = 1.998e-05
leveneTest(AS ~ Parental_treatment * Temp * Control_CO2, data = Resp_data_summary)
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 19 1.5096 0.07616 .
## 560
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
kurtosis(Resp_data_summary$AS)
## [1] 2.828478
lmer.AS = lmer(AS~ Parental_treatment * Temp * Control_CO2 + (1 | Maternal_GF) + (1 | Maternal_GM) + (1 | Paternal_GF) +(1 | Paternal_GM) + (1 | Chamber_ID ) , data = Resp_data_summary)
## boundary (singular) fit: see help('isSingular')
#model assumptions below were not met so this model was not used
performance::check_model(lmer.AS, check="homogeneity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS, check="outliers")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS, check="qq")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS, check="normality")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS, check="linearity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS, check="pp_check")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
#Homogeneity
plot(lmer.AS)
#normality
hist(residuals(lmer.AS), col="darkgray")
shapiro.test(residuals(lmer.AS))
##
## Shapiro-Wilk normality test
##
## data: residuals(lmer.AS)
## W = 0.98716, p-value = 5.561e-05
qqnorm(resid(lmer.AS))
qqline(resid(lmer.AS))
#model fit
library(sjPlot)
plot_model(lmer.AS, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]
## [[2]]$Paternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Chamber_ID
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Paternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
##
## [[3]]
##
## [[4]]
## `geom_smooth()` using formula = 'y ~ x'
#outlier test
outlierTest(lmer.AS)
## No Studentized residuals with Bonferroni p < 0.05
## Largest |rstudent|:
## rstudent unadjusted p-value Bonferroni p
## 271 3.20009 0.0014526 0.84253
##sqrt model
Resp_data_summary$sqrt_AS = sqrt(Resp_data_summary$AS)
head(Resp_data_summary)
## # A tibble: 6 × 31
## Tank Density Parental_number Female Male Maternal Maternal_GF Maternal_GM
## <fct> <dbl> <fct> <dbl> <dbl> <chr> <chr> <chr>
## 1 49 18 89 190 192 AE A E
## 2 64 11 81 42 138 DA D A
## 3 130 18 94 185 190 DA D A
## 4 111 21 45 76 77 DA D A
## 5 8 16 89 190 192 AE A E
## 6 10 18 71 42 193 DA D A
## # ℹ 23 more variables: Paternal <chr>, Paternal_GF <chr>, Paternal_GM <chr>,
## # Parental_treatment <fct>, DOM <chr>, DOT <chr>, DOD <chr>, Age <dbl>,
## # Juv_treat <fct>, Control_CO2 <fct>, Temp <fct>, am_pm <fct>,
## # Chamber_ID <chr>, Wet_weight <dbl>, RMR <dbl>, Mo2_rest <dbl>,
## # Weight <dbl>, MMR <dbl>, AS <dbl>, FS <dbl>, Mo2_max <dbl>, Mo2_AS <dbl>,
## # sqrt_AS <dbl>
qqPlot(Resp_data_summary$sqrt_AS)
## [1] 271 135
shapiro.test(Resp_data_summary$sqrt_AS)
##
## Shapiro-Wilk normality test
##
## data: Resp_data_summary$sqrt_AS
## W = 0.99391, p-value = 0.01969
nortest::lillie.test(Resp_data_summary$sqrt_AS)
##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: Resp_data_summary$sqrt_AS
## D = 0.030311, p-value = 0.2195
leveneTest(sqrt_AS ~ Parental_treatment * Temp * Control_CO2, data = Resp_data_summary)
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 19 1.3445 0.1491
## 560
kurtosis(Resp_data_summary$sqrt_AS)
## [1] 2.548309
lmer.AS.sqrt = lmer(sqrt_AS~ Parental_treatment * Temp * Control_CO2 + (1 | Maternal_GF) + (1 | Maternal_GM) + (1 | Paternal_GF) +(1 | Paternal_GM) + (1 | Chamber_ID ) , data = Resp_data_summary)
## boundary (singular) fit: see help('isSingular')
performance::check_model(lmer.AS.sqrt, check="homogeneity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS.sqrt, check="outliers")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS.sqrt, check="qq")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS.sqrt, check="normality")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS.sqrt, check="linearity")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
performance::check_model(lmer.AS.sqrt, check="pp_check")
## Model has interaction terms. VIFs might be inflated.
## You may check multicollinearity among predictors of a model without
## interaction terms.
#Homogeneity
plot(lmer.AS.sqrt)
#normality
hist(residuals(lmer.AS.sqrt), col="darkgray")
shapiro.test(residuals(lmer.AS.sqrt))
##
## Shapiro-Wilk normality test
##
## data: residuals(lmer.AS.sqrt)
## W = 0.99663, p-value = 0.2646
qqnorm(resid(lmer.AS.sqrt))
qqline(resid(lmer.AS.sqrt))
#model fit
library(sjPlot)
plot_model(lmer.AS.sqrt, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]
## [[2]]$Paternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Chamber_ID
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GF
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Paternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
## [[2]]$Maternal_GM
## `geom_smooth()` using formula = 'y ~ x'
##
##
## [[3]]
##
## [[4]]
## `geom_smooth()` using formula = 'y ~ x'
#outlier test
outlierTest(lmer.AS.sqrt)
## No Studentized residuals with Bonferroni p < 0.05
## Largest |rstudent|:
## rstudent unadjusted p-value Bonferroni p
## 271 2.713601 0.0068632 NA
plot(simulateResiduals(lmer.AS.sqrt))
summary(lmer.AS.sqrt)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## sqrt_AS ~ Parental_treatment * Temp * Control_CO2 + (1 | Maternal_GF) +
## (1 | Maternal_GM) + (1 | Paternal_GF) + (1 | Paternal_GM) +
## (1 | Chamber_ID)
## Data: Resp_data_summary
##
## REML criterion at convergence: 2878.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.59689 -0.66554 -0.05352 0.68908 2.66220
##
## Random effects:
## Groups Name Variance Std.Dev.
## Paternal_GF (Intercept) 0.000e+00 0.0000000
## Chamber_ID (Intercept) 3.049e+00 1.7462632
## Maternal_GF (Intercept) 1.767e-08 0.0001329
## Paternal_GM (Intercept) 0.000e+00 0.0000000
## Maternal_GM (Intercept) 1.918e-01 0.4379900
## Residual 8.637e+00 2.9389294
## Number of obs: 580, groups:
## Paternal_GF, 5; Chamber_ID, 4; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 19.97474 1.06113 6.13922
## Parental_treatmentCCCH 0.52933 0.78793 555.50369
## Parental_treatmentHHCC 0.95247 0.76751 540.40694
## Parental_treatmentCCHC 0.83637 0.78989 360.78698
## Parental_treatmentHHHC 2.76390 0.81069 556.43759
## Tempzero -0.02483 0.74692 555.30915
## Control_CO2CO 2.09831 0.77230 555.30880
## Parental_treatmentCCCH:Tempzero 0.63548 1.06651 555.38998
## Parental_treatmentHHCC:Tempzero -0.50349 1.03514 555.36309
## Parental_treatmentCCHC:Tempzero -0.43790 1.05252 555.35599
## Parental_treatmentHHHC:Tempzero -2.68475 1.12435 555.40822
## Parental_treatmentCCCH:Control_CO2CO -1.68979 1.11832 555.41980
## Parental_treatmentHHCC:Control_CO2CO -2.45011 1.07063 555.33423
## Parental_treatmentCCHC:Control_CO2CO -1.76268 1.10087 555.32229
## Parental_treatmentHHHC:Control_CO2CO -4.57577 1.14199 555.38615
## Tempzero:Control_CO2CO -1.93745 1.08404 555.31420
## Parental_treatmentCCCH:Tempzero:Control_CO2CO 1.17531 1.52579 555.31483
## Parental_treatmentHHCC:Tempzero:Control_CO2CO 2.17335 1.50303 555.43978
## Parental_treatmentCCHC:Tempzero:Control_CO2CO 2.67658 1.55404 555.37592
## Parental_treatmentHHHC:Tempzero:Control_CO2CO 4.98573 1.60894 555.49280
## t value Pr(>|t|)
## (Intercept) 18.824 1.16e-06 ***
## Parental_treatmentCCCH 0.672 0.501993
## Parental_treatmentHHCC 1.241 0.215151
## Parental_treatmentCCHC 1.059 0.290382
## Parental_treatmentHHHC 3.409 0.000698 ***
## Tempzero -0.033 0.973491
## Control_CO2CO 2.717 0.006794 **
## Parental_treatmentCCCH:Tempzero 0.596 0.551517
## Parental_treatmentHHCC:Tempzero -0.486 0.626879
## Parental_treatmentCCHC:Tempzero -0.416 0.677533
## Parental_treatmentHHHC:Tempzero -2.388 0.017282 *
## Parental_treatmentCCCH:Control_CO2CO -1.511 0.131353
## Parental_treatmentHHCC:Control_CO2CO -2.288 0.022485 *
## Parental_treatmentCCHC:Control_CO2CO -1.601 0.109910
## Parental_treatmentHHHC:Control_CO2CO -4.007 6.99e-05 ***
## Tempzero:Control_CO2CO -1.787 0.074442 .
## Parental_treatmentCCCH:Tempzero:Control_CO2CO 0.770 0.441451
## Parental_treatmentHHCC:Tempzero:Control_CO2CO 1.446 0.148747
## Parental_treatmentCCHC:Tempzero:Control_CO2CO 1.722 0.085564 .
## Parental_treatmentHHHC:Tempzero:Control_CO2CO 3.099 0.002042 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
Anova(lmer.AS.sqrt)
## Analysis of Deviance Table (Type II Wald chisquare tests)
##
## Response: sqrt_AS
## Chisq Df Pr(>Chisq)
## Parental_treatment 1.9409 4 0.74663
## Temp 3.6215 1 0.05704 .
## Control_CO2 0.3505 1 0.55385
## Parental_treatment:Temp 4.2911 4 0.36804
## Parental_treatment:Control_CO2 8.2531 4 0.08273 .
## Temp:Control_CO2 0.1053 1 0.74557
## Parental_treatment:Temp:Control_CO2 10.6567 4 0.03071 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#AS
emmeans(lmer.AS.sqrt, pairwise ~ Temp, adjust="tukey")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
## Temp emmean SE df lower.CL upper.CL
## elevated 21.0 0.945 3.58 18.2 23.7
## zero 20.5 0.946 3.56 17.7 23.3
##
## Results are averaged over the levels of: Parental_treatment, Control_CO2
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## elevated - zero 0.491 0.247 553 1.982 0.0479
##
## Results are averaged over the levels of: Parental_treatment, Control_CO2
## Degrees-of-freedom method: kenward-roger
plot(emmeans(lmer.AS.sqrt, pairwise ~ Temp, adjust="tukey"))
## NOTE: Results may be misleading due to involvement in interactions
emmeans(lmer.AS.sqrt, pairwise ~Control_CO2* Temp, adjust="tukey")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
## Control_CO2 Temp emmean SE df lower.CL upper.CL
## control elevated 21.0 0.961 3.84 18.3 23.7
## CO elevated 21.0 0.962 3.85 18.3 23.7
## control zero 20.4 0.958 3.78 17.6 23.1
## CO zero 20.6 0.965 3.85 17.9 23.4
##
## Results are averaged over the levels of: Parental_treatment
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## control elevated - CO elevated -0.00264 0.355 554 -0.007 1.0000
## control elevated - control zero 0.62296 0.341 552 1.825 0.2626
## control elevated - CO zero 0.35558 0.356 553 0.999 0.7498
## CO elevated - control zero 0.62560 0.345 552 1.812 0.2686
## CO elevated - CO zero 0.35822 0.358 554 1.002 0.7485
## control zero - CO zero -0.26738 0.345 553 -0.774 0.8662
##
## Results are averaged over the levels of: Parental_treatment
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
plot(emmeans(lmer.AS.sqrt, pairwise ~ Control_CO2* Temp, adjust="tukey"))
## NOTE: Results may be misleading due to involvement in interactions
emmeans(lmer.AS.sqrt, pairwise ~ Parental_treatment * Temp * Control_CO2, adjust="tukey")
## $emmeans
## Parental_treatment Temp Control_CO2 emmean SE df lower.CL upper.CL
## CCCC elevated control 20.0 1.10 6.13 17.3 22.6
## CCCH elevated control 20.5 1.14 6.59 17.8 23.2
## HHCC elevated control 20.9 1.10 6.04 18.2 23.6
## CCHC elevated control 20.8 1.12 6.03 18.1 23.6
## HHHC elevated control 22.7 1.13 6.83 20.1 25.4
## CCCC zero control 19.9 1.09 5.93 17.3 22.6
## CCCH zero control 21.1 1.09 5.67 18.4 23.8
## HHCC zero control 20.4 1.08 5.54 17.7 23.1
## CCHC zero control 20.3 1.12 6.13 17.6 23.1
## HHHC zero control 20.0 1.13 6.67 17.3 22.7
## CCCC elevated CO 22.1 1.11 6.35 19.4 24.8
## CCCH elevated CO 20.9 1.12 6.49 18.2 23.6
## HHCC elevated CO 20.6 1.10 5.94 17.9 23.3
## CCHC elevated CO 21.1 1.15 6.86 18.4 23.9
## HHHC elevated CO 20.3 1.13 6.66 17.6 23.0
## CCCC zero CO 20.1 1.10 6.35 17.4 22.8
## CCCH zero CO 20.8 1.09 5.76 18.1 23.5
## HHCC zero CO 20.3 1.12 6.26 17.6 23.0
## CCHC zero CO 21.4 1.16 6.80 18.7 24.2
## HHHC zero CO 20.6 1.13 6.82 17.9 23.3
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## CCCC elevated control - CCCH elevated control -0.5293 0.866 259.9 -0.611
## CCCC elevated control - HHCC elevated control -0.9525 0.865 210.6 -1.101
## CCCC elevated control - CCHC elevated control -0.8364 0.968 129.6 -0.864
## CCCC elevated control - HHHC elevated control -2.7639 0.869 270.4 -3.179
## CCCC elevated control - CCCC zero control 0.0248 0.747 551.5 0.033
## CCCC elevated control - CCCH zero control -1.1400 0.793 331.3 -1.438
## CCCC elevated control - HHCC zero control -0.4242 0.850 170.3 -0.499
## CCCC elevated control - CCHC zero control -0.3736 0.968 136.2 -0.386
## CCCC elevated control - HHHC zero control -0.0543 0.869 223.9 -0.063
## CCCC elevated control - CCCC elevated CO -2.0983 0.775 551.1 -2.709
## CCCC elevated control - CCCH elevated CO -0.9378 0.824 438.1 -1.139
## CCCC elevated control - HHCC elevated CO -0.6007 0.871 185.3 -0.690
## CCCC elevated control - CCHC elevated CO -1.1720 0.993 155.6 -1.181
## CCCC elevated control - HHHC elevated CO -0.2864 0.873 228.6 -0.328
## CCCC elevated control - CCCC zero CO -0.1360 0.776 551.9 -0.175
## CCCC elevated control - CCCH zero CO -0.7864 0.796 357.3 -0.988
## CCCC elevated control - HHCC zero CO -0.3082 0.903 156.1 -0.341
## CCCC elevated control - CCHC zero CO -1.4484 1.019 134.1 -1.422
## CCCC elevated control - HHHC zero CO -0.6251 0.874 274.1 -0.715
## CCCH elevated control - HHCC elevated control -0.4231 0.904 154.6 -0.468
## CCCH elevated control - CCHC elevated control -0.3070 0.987 111.8 -0.311
## CCCH elevated control - HHHC elevated control -2.2346 0.928 73.0 -2.409
## CCCH elevated control - CCCC zero control 0.5542 0.858 256.9 0.646
## CCCH elevated control - CCCH zero control -0.6106 0.766 554.2 -0.797
## CCCH elevated control - HHCC zero control 0.1052 0.875 144.0 0.120
## CCCH elevated control - CCHC zero control 0.1557 0.993 117.0 0.157
## CCCH elevated control - HHHC zero control 0.4750 0.921 63.6 0.516
## CCCH elevated control - CCCC elevated CO -1.5690 0.879 288.7 -1.786
## CCCH elevated control - CCCH elevated CO -0.4085 0.819 554.0 -0.499
## CCCH elevated control - HHCC elevated CO -0.0713 0.902 145.8 -0.079
## CCCH elevated control - CCHC elevated CO -0.6427 1.018 137.3 -0.631
## CCCH elevated control - HHHC elevated CO 0.2429 0.927 64.5 0.262
## CCCH elevated control - CCCC zero CO 0.3933 0.867 271.4 0.453
## CCCH elevated control - CCCH zero CO -0.2570 0.775 554.7 -0.332
## CCCH elevated control - HHCC zero CO 0.2211 0.931 131.8 0.238
## CCCH elevated control - CCHC zero CO -0.9191 1.033 112.3 -0.890
## CCCH elevated control - HHHC zero CO -0.0958 0.934 73.5 -0.103
## HHCC elevated control - CCHC elevated control 0.1161 0.811 381.8 0.143
## HHCC elevated control - HHHC elevated control -1.8114 0.886 309.2 -2.045
## HHCC elevated control - CCCC zero control 0.9773 0.854 210.2 1.144
## HHCC elevated control - CCCH zero control -0.1875 0.821 202.4 -0.228
## HHCC elevated control - HHCC zero control 0.5283 0.718 552.7 0.735
## HHCC elevated control - CCHC zero control 0.5788 0.816 417.5 0.709
## HHCC elevated control - HHHC zero control 0.8982 0.883 297.9 1.018
## HHCC elevated control - CCCC elevated CO -1.1458 0.879 239.1 -1.303
## HHCC elevated control - CCCH elevated CO 0.0146 0.853 292.8 0.017
## HHCC elevated control - HHCC elevated CO 0.3518 0.743 552.0 0.474
## HHCC elevated control - CCHC elevated CO -0.2195 0.851 422.6 -0.258
## HHCC elevated control - HHHC elevated CO 0.6660 0.878 306.4 0.758
## HHCC elevated control - CCCC zero CO 0.8164 0.859 299.1 0.951
## HHCC elevated control - CCCH zero CO 0.1661 0.815 230.8 0.204
## HHCC elevated control - HHCC zero CO 0.6442 0.764 554.1 0.843
## HHCC elevated control - CCHC zero CO -0.4959 0.859 385.9 -0.577
## HHCC elevated control - HHHC zero CO 0.3273 0.881 320.4 0.371
## CCHC elevated control - HHHC elevated control -1.9275 0.941 126.6 -2.048
## CCHC elevated control - CCCC zero control 0.8612 0.957 122.6 0.900
## CCHC elevated control - CCCH zero control -0.3036 0.915 124.4 -0.332
## CCHC elevated control - HHCC zero control 0.4122 0.775 411.4 0.532
## CCHC elevated control - CCHC zero control 0.4627 0.742 551.7 0.624
## CCHC elevated control - HHHC zero control 0.7821 0.938 112.4 0.834
## CCHC elevated control - CCCC elevated CO -1.2619 0.978 132.4 -1.291
## CCHC elevated control - CCCH elevated CO -0.1015 0.944 170.5 -0.108
## CCHC elevated control - HHCC elevated CO 0.2357 0.801 416.4 0.294
## CCHC elevated control - CCHC elevated CO -0.3356 0.786 552.4 -0.427
## CCHC elevated control - HHHC elevated CO 0.5499 0.928 112.5 0.593
## CCHC elevated control - CCCC zero CO 0.7003 0.960 162.0 0.729
## CCHC elevated control - CCCH zero CO 0.0500 0.911 138.7 0.055
## CCHC elevated control - HHCC zero CO 0.5281 0.819 424.1 0.645
## CCHC elevated control - CCHC zero CO -0.6120 0.788 552.3 -0.777
## CCHC elevated control - HHHC zero CO 0.2112 0.930 127.0 0.227
## HHHC elevated control - CCCC zero control 2.7887 0.865 218.8 3.225
## HHHC elevated control - CCCH zero control 1.6239 0.863 76.4 1.882
## HHHC elevated control - HHCC zero control 2.3397 0.863 279.5 2.712
## HHHC elevated control - CCHC zero control 2.3903 0.945 143.8 2.528
## HHHC elevated control - HHHC zero control 2.7096 0.841 551.6 3.222
## HHHC elevated control - CCCC elevated CO 0.6656 0.897 153.5 0.742
## HHHC elevated control - CCCH elevated CO 1.8261 0.897 103.9 2.036
## HHHC elevated control - HHCC elevated CO 2.1632 0.886 293.4 2.440
## HHHC elevated control - CCHC elevated CO 1.5919 0.973 158.0 1.637
## HHHC elevated control - HHHC elevated CO 2.4775 0.842 551.8 2.941
## HHHC elevated control - CCCC zero CO 2.6279 0.870 284.4 3.021
## HHHC elevated control - CCCH zero CO 1.9775 0.864 86.6 2.289
## HHHC elevated control - HHCC zero CO 2.4557 0.913 289.0 2.690
## HHHC elevated control - CCHC zero CO 1.3155 0.992 132.9 1.326
## HHHC elevated control - HHHC zero CO 2.1388 0.850 551.4 2.516
## CCCC zero control - CCCH zero control -1.1648 0.783 325.0 -1.488
## CCCC zero control - HHCC zero control -0.4490 0.838 164.7 -0.536
## CCCC zero control - CCHC zero control -0.3985 0.957 129.4 -0.416
## CCCC zero control - HHHC zero control -0.0791 0.865 178.5 -0.092
## CCCC zero control - CCCC elevated CO -2.1231 0.762 552.1 -2.787
## CCCC zero control - CCCH elevated CO -0.9627 0.813 438.2 -1.184
## CCCC zero control - HHCC elevated CO -0.6255 0.859 182.1 -0.728
## CCCC zero control - CCHC elevated CO -1.1968 0.982 147.0 -1.219
## CCCC zero control - HHHC elevated CO -0.3113 0.869 182.8 -0.358
## CCCC zero control - CCCC zero CO -0.1609 0.765 552.1 -0.210
## CCCC zero control - CCCH zero CO -0.8112 0.786 348.8 -1.032
## CCCC zero control - HHCC zero CO -0.3331 0.892 152.2 -0.374
## CCCC zero control - CCHC zero CO -1.4732 1.007 128.9 -1.462
## CCCC zero control - HHHC zero CO -0.6500 0.869 222.4 -0.748
## CCCH zero control - HHCC zero control 0.7158 0.793 180.0 0.902
## CCCH zero control - CCHC zero control 0.7663 0.921 130.8 0.832
## CCCH zero control - HHHC zero control 1.0857 0.857 65.2 1.266
## CCCH zero control - CCCC elevated CO -0.9583 0.805 358.2 -1.190
## CCCH zero control - CCCH elevated CO 0.2021 0.756 552.7 0.267
## CCCH zero control - HHCC elevated CO 0.5393 0.820 185.3 0.657
## CCCH zero control - CCHC elevated CO -0.0320 0.949 149.7 -0.034
## CCCH zero control - HHHC elevated CO 0.8535 0.862 66.0 0.990
## CCCH zero control - CCCC zero CO 1.0039 0.794 349.1 1.265
## CCCH zero control - CCCH zero CO 0.3536 0.709 552.0 0.499
## CCCH zero control - HHCC zero CO 0.8317 0.851 162.4 0.977
## CCCH zero control - CCHC zero CO -0.3084 0.963 128.4 -0.320
## CCCH zero control - HHHC zero CO 0.5148 0.868 76.9 0.593
## HHCC zero control - CCHC zero control 0.0505 0.780 436.0 0.065
## HHCC zero control - HHHC zero control 0.3698 0.859 267.8 0.431
## HHCC zero control - CCCC elevated CO -1.6742 0.864 189.5 -1.938
## HHCC zero control - CCCH elevated CO -0.5137 0.829 262.7 -0.619
## HHCC zero control - HHCC elevated CO -0.1765 0.710 551.4 -0.249
## HHCC zero control - CCHC elevated CO -0.7479 0.816 450.3 -0.916
## HHCC zero control - HHHC elevated CO 0.1377 0.852 274.3 0.162
## HHCC zero control - CCCC zero CO 0.2881 0.841 250.1 0.342
## HHCC zero control - CCCH zero CO -0.3622 0.788 202.9 -0.460
## HHCC zero control - HHCC zero CO 0.1159 0.732 553.2 0.158
## HHCC zero control - CCHC zero CO -1.0243 0.822 419.4 -1.245
## HHCC zero control - HHHC zero CO -0.2010 0.856 288.2 -0.235
## CCHC zero control - HHHC zero control 0.3193 0.942 127.0 0.339
## CCHC zero control - CCCC elevated CO -1.7247 0.978 140.8 -1.763
## CCHC zero control - CCCH elevated CO -0.5642 0.950 178.6 -0.594
## CCHC zero control - HHCC elevated CO -0.2270 0.807 439.5 -0.281
## CCHC zero control - CCHC elevated CO -0.7984 0.793 552.5 -1.007
## CCHC zero control - HHHC elevated CO 0.0872 0.931 127.0 0.094
## CCHC zero control - CCCC zero CO 0.2376 0.961 171.7 0.247
## CCHC zero control - CCCH zero CO -0.4127 0.917 146.0 -0.450
## CCHC zero control - HHCC zero CO 0.0654 0.826 435.5 0.079
## CCHC zero control - CCHC zero CO -1.0748 0.795 553.4 -1.353
## CCHC zero control - HHHC zero CO -0.2515 0.934 144.0 -0.269
## HHHC zero control - CCCC elevated CO -2.0440 0.897 125.4 -2.278
## HHHC zero control - CCCH elevated CO -0.8835 0.893 89.2 -0.989
## HHHC zero control - HHCC elevated CO -0.5464 0.883 283.4 -0.619
## HHHC zero control - CCHC elevated CO -1.1177 0.970 140.8 -1.152
## HHHC zero control - HHHC elevated CO -0.2321 0.833 551.4 -0.279
## HHHC zero control - CCCC zero CO -0.0817 0.868 238.1 -0.094
## HHHC zero control - CCCH zero CO -0.7320 0.860 74.4 -0.852
## HHHC zero control - HHCC zero CO -0.2539 0.909 285.3 -0.279
## HHHC zero control - CCHC zero CO -1.3941 0.989 120.0 -1.410
## HHHC zero control - HHHC zero CO -0.5708 0.843 552.2 -0.677
## CCCC elevated CO - CCCH elevated CO 1.1605 0.836 462.3 1.389
## CCCC elevated CO - HHCC elevated CO 1.4976 0.884 207.4 1.694
## CCCC elevated CO - CCHC elevated CO 0.9263 1.002 157.6 0.924
## CCCC elevated CO - HHHC elevated CO 1.8119 0.901 128.4 2.011
## CCCC elevated CO - CCCC zero CO 1.9623 0.791 553.0 2.481
## CCCC elevated CO - CCCH zero CO 1.3120 0.810 374.6 1.621
## CCCC elevated CO - HHCC zero CO 1.7901 0.916 173.3 1.954
## CCCC elevated CO - CCHC zero CO 0.6499 1.027 137.2 0.633
## CCCC elevated CO - HHHC zero CO 1.4732 0.901 156.3 1.635
## CCCH elevated CO - HHCC elevated CO 0.3372 0.854 267.9 0.395
## CCCH elevated CO - CCHC elevated CO -0.2342 0.976 194.2 -0.240
## CCCH elevated CO - HHHC elevated CO 0.6514 0.898 90.8 0.725
## CCCH elevated CO - CCCC zero CO 0.8018 0.826 441.6 0.970
## CCCH elevated CO - CCCH zero CO 0.1515 0.760 552.4 0.199
## CCCH elevated CO - HHCC zero CO 0.6296 0.883 231.8 0.713
## CCCH elevated CO - CCHC zero CO -0.5106 0.992 175.3 -0.515
## CCCH elevated CO - HHHC zero CO 0.3127 0.902 105.2 0.347
## HHCC elevated CO - CCHC elevated CO -0.5713 0.841 452.8 -0.679
## HHCC elevated CO - HHHC elevated CO 0.3142 0.877 291.8 0.358
## HHCC elevated CO - CCCC zero CO 0.4646 0.862 265.9 0.539
## HHCC elevated CO - CCCH zero CO -0.1857 0.814 209.0 -0.228
## HHCC elevated CO - HHCC zero CO 0.2924 0.755 552.5 0.387
## HHCC elevated CO - CCHC zero CO -0.8477 0.847 426.9 -1.001
## HHCC elevated CO - HHHC zero CO -0.0245 0.880 304.2 -0.028
## CCHC elevated CO - HHHC elevated CO 0.8856 0.961 140.9 0.922
## CCHC elevated CO - CCCC zero CO 1.0360 0.986 189.5 1.050
## CCHC elevated CO - CCCH zero CO 0.3857 0.945 161.4 0.408
## CCHC elevated CO - HHCC zero CO 0.8638 0.859 457.6 1.005
## CCHC elevated CO - CCHC zero CO -0.2764 0.838 553.5 -0.330
## CCHC elevated CO - HHHC zero CO 0.5469 0.963 158.5 0.568
## HHHC elevated CO - CCCC zero CO 0.1504 0.871 241.8 0.173
## HHHC elevated CO - CCCH zero CO -0.4999 0.863 74.9 -0.579
## HHHC elevated CO - HHCC zero CO -0.0218 0.903 298.1 -0.024
## HHHC elevated CO - CCHC zero CO -1.1620 0.976 119.9 -1.190
## HHHC elevated CO - HHHC zero CO -0.3387 0.841 551.6 -0.403
## CCCC zero CO - CCCH zero CO -0.6503 0.797 373.7 -0.816
## CCCC zero CO - HHCC zero CO -0.1722 0.894 223.8 -0.193
## CCCC zero CO - CCHC zero CO -1.3124 1.009 166.2 -1.300
## CCCC zero CO - HHHC zero CO -0.4891 0.873 286.6 -0.560
## CCCH zero CO - HHCC zero CO 0.4781 0.845 181.3 0.566
## CCCH zero CO - CCHC zero CO -0.6621 0.959 143.6 -0.690
## CCCH zero CO - HHHC zero CO 0.1612 0.868 86.8 0.186
## HHCC zero CO - CCHC zero CO -1.1402 0.862 446.9 -1.323
## HHCC zero CO - HHHC zero CO -0.3169 0.906 304.5 -0.350
## CCHC zero CO - HHHC zero CO 0.8233 0.980 133.2 0.840
## p.value
## 1.0000
## 0.9999
## 1.0000
## 0.1560
## 1.0000
## 0.9968
## 1.0000
## 1.0000
## 1.0000
## 0.4240
## 0.9999
## 1.0000
## 0.9997
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9969
## 1.0000
## 1.0000
## 1.0000
## 0.6534
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9639
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.8812
## 0.9998
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9991
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.8755
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9991
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.1408
## 0.9342
## 0.4242
## 0.5645
## 0.1355
## 1.0000
## 0.8796
## 0.6307
## 0.9845
## 0.2687
## 0.2281
## 0.7364
## 0.4402
## 0.9987
## 0.5716
## 0.9952
## 1.0000
## 1.0000
## 1.0000
## 0.3676
## 0.9998
## 1.0000
## 0.9996
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9956
## 1.0000
## 1.0000
## 1.0000
## 0.9991
## 0.9998
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9994
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9220
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9995
## 1.0000
## 1.0000
## 0.9662
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9986
## 1.0000
## 0.7454
## 1.0000
## 1.0000
## 0.9998
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9971
## 1.0000
## 0.9980
## 0.9782
## 1.0000
## 0.8920
## 0.5990
## 0.9871
## 0.9157
## 1.0000
## 0.9846
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9997
## 1.0000
## 1.0000
## 1.0000
## 0.9991
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9990
## 1.0000
## 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 20 estimates
plot(emmeans(lmer.AS.sqrt, pairwise ~ Parental_treatment * Temp * Control_CO2, adjust="tukey"))
#for graphs
ASEMM = (emmeans(lmer.AS.sqrt, ~ Parental_treatment * Temp * Control_CO2 ) %>% as.data.frame)
ASEMM
## Parental_treatment Temp Control_CO2 emmean SE df lower.CL
## CCCC elevated control 19.97474 1.095745 6.13 17.30699
## CCCH elevated control 20.50407 1.140422 6.59 17.77325
## HHCC elevated control 20.92721 1.102259 6.04 18.23405
## CCHC elevated control 20.81111 1.122510 6.03 18.06772
## HHHC elevated control 22.73864 1.129798 6.83 20.05392
## CCCC zero control 19.94991 1.088038 5.93 17.28022
## CCCH zero control 21.11471 1.089450 5.67 18.41123
## HHCC zero control 20.39889 1.079788 5.54 17.70263
## CCHC zero control 20.34838 1.124255 6.13 17.61199
## HHHC zero control 20.02906 1.128322 6.67 17.33403
## CCCC elevated CO 22.07305 1.108700 6.35 19.39593
## CCCH elevated CO 20.91258 1.115784 6.49 18.23128
## HHCC elevated CO 20.57541 1.098530 5.94 17.88050
## CCHC elevated CO 21.14675 1.147100 6.86 18.42317
## HHHC elevated CO 20.26118 1.126484 6.66 17.56987
## CCCC zero CO 20.11077 1.104709 6.35 17.44356
## CCCH zero CO 20.76109 1.091146 5.76 18.06417
## HHCC zero CO 20.28299 1.118715 6.26 17.57266
## CCHC zero CO 21.42314 1.162056 6.80 18.65879
## HHHC zero CO 20.59988 1.127834 6.82 17.91869
## upper.CL
## 22.64249
## 23.23488
## 23.62037
## 23.55449
## 25.42336
## 22.61959
## 23.81820
## 23.09515
## 23.08476
## 22.72408
## 24.75017
## 23.59389
## 23.27032
## 23.87033
## 22.95249
## 22.77797
## 23.45801
## 22.99332
## 24.18749
## 23.28106
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
#back transform data
ASEMM$emmean2 = (ASEMM$emmean)^2
ASEMM$emmean.low = (ASEMM$emmean-ASEMM$SE)^2
ASEMM$emmean.high = (ASEMM$emmean+ASEMM$SE)^2
ASEMM
## Parental_treatment Temp Control_CO2 emmean SE df lower.CL
## CCCC elevated control 19.97474 1.095745 6.13 17.30699
## CCCH elevated control 20.50407 1.140422 6.59 17.77325
## HHCC elevated control 20.92721 1.102259 6.04 18.23405
## CCHC elevated control 20.81111 1.122510 6.03 18.06772
## HHHC elevated control 22.73864 1.129798 6.83 20.05392
## CCCC zero control 19.94991 1.088038 5.93 17.28022
## CCCH zero control 21.11471 1.089450 5.67 18.41123
## HHCC zero control 20.39889 1.079788 5.54 17.70263
## CCHC zero control 20.34838 1.124255 6.13 17.61199
## HHHC zero control 20.02906 1.128322 6.67 17.33403
## CCCC elevated CO 22.07305 1.108700 6.35 19.39593
## CCCH elevated CO 20.91258 1.115784 6.49 18.23128
## HHCC elevated CO 20.57541 1.098530 5.94 17.88050
## CCHC elevated CO 21.14675 1.147100 6.86 18.42317
## HHHC elevated CO 20.26118 1.126484 6.66 17.56987
## CCCC zero CO 20.11077 1.104709 6.35 17.44356
## CCCH zero CO 20.76109 1.091146 5.76 18.06417
## HHCC zero CO 20.28299 1.118715 6.26 17.57266
## CCHC zero CO 21.42314 1.162056 6.80 18.65879
## HHHC zero CO 20.59988 1.127834 6.82 17.91869
## upper.CL emmean2 emmean.low emmean.high
## 22.64249 398.9902 356.4164 443.9653
## 23.23488 420.4167 374.9507 468.4839
## 23.62037 437.9481 393.0287 485.2975
## 23.55449 433.1023 387.6409 481.0837
## 25.42336 517.0458 466.9420 569.7024
## 22.61959 397.9988 355.7701 442.5952
## 23.81820 445.8312 401.0112 493.0249
## 23.09515 416.1148 373.2278 461.3337
## 23.08476 414.0564 369.5669 461.0739
## 22.72408 401.1631 357.2377 447.6346
## 24.75017 487.2196 439.5040 537.3935
## 23.59389 437.3361 391.9132 485.2489
## 23.27032 423.3474 379.3487 469.7595
## 23.87033 447.1849 399.9858 497.0156
## 22.95249 410.5156 366.1367 457.4323
## 22.77797 404.4430 361.2302 450.0964
## 23.45801 431.0229 386.9067 477.5202
## 22.99332 411.3996 367.2694 458.0329
## 24.18749 458.9511 410.5117 510.0913
## 23.28106 424.3549 379.1604 472.0934
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
#combine column for x axis
ASEMM_graph <- ASEMM %>%
unite(Temp:Control_CO2 , col="Juv_treat", sep="_", remove=FALSE)
ASEMM_graph
## Parental_treatment Juv_treat Temp Control_CO2 emmean SE
## 1 CCCC elevated_control elevated control 19.97474 1.095745
## 2 CCCH elevated_control elevated control 20.50407 1.140422
## 3 HHCC elevated_control elevated control 20.92721 1.102259
## 4 CCHC elevated_control elevated control 20.81111 1.122510
## 5 HHHC elevated_control elevated control 22.73864 1.129798
## 6 CCCC zero_control zero control 19.94991 1.088038
## 7 CCCH zero_control zero control 21.11471 1.089450
## 8 HHCC zero_control zero control 20.39889 1.079788
## 9 CCHC zero_control zero control 20.34838 1.124255
## 10 HHHC zero_control zero control 20.02906 1.128322
## 11 CCCC elevated_CO elevated CO 22.07305 1.108700
## 12 CCCH elevated_CO elevated CO 20.91258 1.115784
## 13 HHCC elevated_CO elevated CO 20.57541 1.098530
## 14 CCHC elevated_CO elevated CO 21.14675 1.147100
## 15 HHHC elevated_CO elevated CO 20.26118 1.126484
## 16 CCCC zero_CO zero CO 20.11077 1.104709
## 17 CCCH zero_CO zero CO 20.76109 1.091146
## 18 HHCC zero_CO zero CO 20.28299 1.118715
## 19 CCHC zero_CO zero CO 21.42314 1.162056
## 20 HHHC zero_CO zero CO 20.59988 1.127834
## df lower.CL upper.CL emmean2 emmean.low emmean.high
## 1 6.127234 17.30699 22.64249 398.9902 356.4164 443.9653
## 2 6.592638 17.77325 23.23488 420.4167 374.9507 468.4839
## 3 6.036732 18.23405 23.62037 437.9481 393.0287 485.2975
## 4 6.029910 18.06773 23.55449 433.1023 387.6409 481.0837
## 5 6.834453 20.05392 25.42336 517.0458 466.9420 569.7024
## 6 5.932573 17.28022 22.61959 397.9988 355.7701 442.5952
## 7 5.672984 18.41123 23.81820 445.8312 401.0112 493.0249
## 8 5.539907 17.70263 23.09515 416.1148 373.2278 461.3337
## 9 6.134620 17.61199 23.08476 414.0564 369.5669 461.0739
## 10 6.670259 17.33403 22.72408 401.1631 357.2377 447.6346
## 11 6.349345 19.39593 24.75017 487.2196 439.5040 537.3935
## 12 6.486960 18.23128 23.59389 437.3361 391.9132 485.2489
## 13 5.937228 17.88050 23.27032 423.3474 379.3487 469.7595
## 14 6.861743 18.42317 23.87032 447.1849 399.9858 497.0156
## 15 6.662532 17.56988 22.95249 410.5156 366.1367 457.4323
## 16 6.352221 17.44356 22.77797 404.4430 361.2302 450.0964
## 17 5.761872 18.06418 23.45801 431.0229 386.9067 477.5202
## 18 6.257412 17.57266 22.99332 411.3996 367.2694 458.0329
## 19 6.799348 18.65879 24.18749 458.9511 410.5117 510.0913
## 20 6.820626 17.91869 23.28106 424.3549 379.1604 472.0934
cbPalette <- c("#56B4E9", "#E69F00", "#D55E00","#009E73", "#999999")
#better labels#
graph <- ggplot(ASEMM_graph, aes (x = Juv_treat, y=emmean2, colour=Parental_treatment)) + geom_pointrange(aes (ymin = emmean.low, ymax = emmean.high), position=position_dodge(width=1), size=1) +
facet_grid(~factor(Juv_treat, levels =c( "zero_control","elevated_control", "zero_CO", "elevated_CO"), labels=str_wrap(c("Control", "Elevated Temperature", "Elevated CO2", "Elevated Temperature & CO2"), width = 10)), scales = "free_x") + labs(x="Juvenile treatment", y=expression("Aerobic scope (mg O"[2]*" kg"^{-1}*" hr"^{-1}*")")) +
scale_x_discrete(breaks = c("zero_control","elevated_control", "zero_CO", "elevated_CO"),
labels = str_wrap(
c("Control", "Warm temperature", "Elevated CO2", "Warm temperature & Elevated CO2"), width = 10)
) +
scale_colour_manual(values=cbPalette, name = "Cross-generation experience", labels = c("Control", "Parental development", "Grandparental development", "Grandparental post-maturation", "Continuous grandparent")) +
theme_calc() + theme(text = element_text(size=20)) + theme(panel.spacing = unit(1, "cm", data = NULL)) + theme_classic()+ theme(strip.text.x = element_blank())
print(graph)
ggsave("AS_graph.eps", graph, height = 6, width = 14, dpi = 320)