R Markdown

library(ggplot2)
library(lme4)
## Loading required package: Matrix
library(MuMIn)
library(vegan)
## Loading required package: permute
## Loading required package: lattice
## 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(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## 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(extrafont)
## Registering fonts with R

Input and sort data

library(readr)

Growth_Data <- read_csv("C:/Users/jc819096/OneDrive - James Cook University/DATA/Lab 3/Growth data/Growth_Data_FINAL.check.csv")
## Rows: 2955 Columns: 19
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (12): Parental_number, Maternal, Maternal_GF, Maternal_GM, Paternal, Pat...
## dbl  (7): Tank, Female, Male, Age, Length, Weight, Density
## 
## ℹ 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(Growth_Data)
head(Growth_Data)
## # A tibble: 6 × 19
##    Tank Parental_number Female  Male Maternal Maternal_GF Maternal_GM Paternal
##   <dbl> <chr>            <dbl> <dbl> <chr>    <chr>       <chr>       <chr>   
## 1     1 72                  42   220 DA       D           A           EC      
## 2     1 72                  42   220 DA       D           A           EC      
## 3     1 72                  42   220 DA       D           A           EC      
## 4     1 72                  42   220 DA       D           A           EC      
## 5     1 72                  42   220 DA       D           A           EC      
## 6     1 72                  42   220 DA       D           A           EC      
## # ℹ 11 more variables: Paternal_GF <chr>, Paternal_GM <chr>, DOM <chr>,
## #   DOD <chr>, Age <dbl>, Parental_treat <chr>, Temp <chr>, Control_CO <chr>,
## #   Length <dbl>, Weight <dbl>, Density <dbl>
#coding the factors 
str(Growth_Data)
## spc_tbl_ [2,955 × 19] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ Tank           : num [1:2955] 1 1 1 1 1 1 1 1 1 1 ...
##  $ Parental_number: chr [1:2955] "72" "72" "72" "72" ...
##  $ Female         : num [1:2955] 42 42 42 42 42 42 42 42 42 42 ...
##  $ Male           : num [1:2955] 220 220 220 220 220 220 220 220 220 220 ...
##  $ Maternal       : chr [1:2955] "DA" "DA" "DA" "DA" ...
##  $ Maternal_GF    : chr [1:2955] "D" "D" "D" "D" ...
##  $ Maternal_GM    : chr [1:2955] "A" "A" "A" "A" ...
##  $ Paternal       : chr [1:2955] "EC" "EC" "EC" "EC" ...
##  $ Paternal_GF    : chr [1:2955] "E" "E" "E" "E" ...
##  $ Paternal_GM    : chr [1:2955] "C" "C" "C" "C" ...
##  $ DOM            : chr [1:2955] "11/01/2022" "11/01/2022" "11/01/2022" "11/01/2022" ...
##  $ DOD            : chr [1:2955] "9/05/2022" "9/05/2022" "10/05/2022" "10/05/2022" ...
##  $ Age            : num [1:2955] 118 118 119 119 125 125 125 125 125 125 ...
##  $ Parental_treat : chr [1:2955] "HHCC" "HHCC" "HHCC" "HHCC" ...
##  $ Temp           : chr [1:2955] "zero" "zero" "zero" "zero" ...
##  $ Control_CO     : chr [1:2955] "CO" "CO" "CO" "CO" ...
##  $ Length         : num [1:2955] 31.4 29.6 30.7 33.4 32.3 ...
##  $ Weight         : num [1:2955] 0.936 0.76 0.923 1.045 1.148 ...
##  $ Density        : num [1:2955] 20 20 20 20 20 20 20 20 20 20 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   Tank = col_double(),
##   ..   Parental_number = col_character(),
##   ..   Female = col_double(),
##   ..   Male = col_double(),
##   ..   Maternal = col_character(),
##   ..   Maternal_GF = col_character(),
##   ..   Maternal_GM = col_character(),
##   ..   Paternal = col_character(),
##   ..   Paternal_GF = col_character(),
##   ..   Paternal_GM = col_character(),
##   ..   DOM = col_character(),
##   ..   DOD = col_character(),
##   ..   Age = col_double(),
##   ..   Parental_treat = col_character(),
##   ..   Temp = col_character(),
##   ..   Control_CO = col_character(),
##   ..   Length = col_double(),
##   ..   Weight = col_double(),
##   ..   Density = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>
Growth_Data$Tank = factor (Growth_Data$Tank)
Growth_Data$Parental_number = factor (Growth_Data$Parental_number)
Growth_Data$Parental_treat = factor (Growth_Data$Parental_treat, levels=c("CCCC", "CCCH", "HHCC", "CCHC", "HHHC"))
Growth_Data$Maternal_GF = factor (Growth_Data$Maternal_GF)
Growth_Data$Maternal_GM = factor (Growth_Data$Maternal_GM)
Growth_Data$Paternal_GF = factor (Growth_Data$Paternal_GF)
Growth_Data$Paternal_GM = factor (Growth_Data$Paternal_GM)
Growth_Data$Temp = factor (Growth_Data$Temp)
Growth_Data$Control_CO = factor (Growth_Data$Control_CO)

STANDARD LENGTH DATA

Exploring raw data

ggplot(Growth_Data, aes(y=Length, x=Density)) + geom_point()

ggplot(Growth_Data, aes(y=Weight, x=Age))+ geom_point()

ggplot(Growth_Data, aes(y=Length, x=Parental_treat)) + geom_boxplot()

ggplot(Growth_Data, aes(x=Length)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(Growth_Data, aes(y=Length, x=Temp, colour=Parental_treat)) + geom_boxplot() +facet_grid(~factor(Control_CO))

### Raw data checks

qqPlot(Growth_Data$Length)

## [1]  549 2255
shapiro.test(Growth_Data$Length)
## 
##  Shapiro-Wilk normality test
## 
## data:  Growth_Data$Length
## W = 0.96946, p-value < 2.2e-16
nortest::lillie.test(Growth_Data$Length)
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  Growth_Data$Length
## D = 0.059446, p-value < 2.2e-16
leveneTest(Length ~ Parental_treat * Temp * Control_CO, data = Growth_Data)
## Levene's Test for Homogeneity of Variance (center = median)
##         Df F value    Pr(>F)    
## group   19  3.1852 3.764e-06 ***
##       2935                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
kurtosis(Growth_Data$Length)
## [1] 5.316165

removing outliers (IQR to improve kurtosis)

Q <- quantile(Growth_Data$Length, probs=c(.25, .75), na.rm = FALSE)
iqr <- IQR(Growth_Data$Length)
up <-  Q[2]+1.5*iqr # Upper Range  
low<- Q[1]-1.5*iqr # Lower Range
eliminated <- subset(Growth_Data, Growth_Data$Length > (low) & Growth_Data$Length < (up))
nrow(Growth_Data)
## [1] 2955
nrow(eliminated)
## [1] 2811

check data now that outliers have been removed

qqPlot(eliminated$Length)

## [1] 1760  976
shapiro.test(eliminated$Length)
## 
##  Shapiro-Wilk normality test
## 
## data:  eliminated$Length
## W = 0.99687, p-value = 1.525e-05
nortest::lillie.test(eliminated$Length)
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  eliminated$Length
## D = 0.018016, p-value = 0.03496
leveneTest(Length ~ Parental_treat * Temp * Control_CO, data = eliminated)
## Levene's Test for Homogeneity of Variance (center = median)
##         Df F value    Pr(>F)    
## group   19  3.0697 8.276e-06 ***
##       2791                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
kurtosis(eliminated$Length)
## [1] 2.970551

model

SL_model.1 = lmer(Length ~ Parental_treat * Temp * Control_CO  +   (1 | Maternal_GF) +  (1 | Maternal_GM)   + (1 | Paternal_GF) + (1 | Paternal_GM)  + (1|Tank), data = eliminated)   

post model checks

performance::check_model(SL_model.1, 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(SL_model.1, 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(SL_model.1, 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(SL_model.1, 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(SL_model.1, 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(SL_model.1, 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(SL_model.1)

#normality
hist(residuals(SL_model.1), col="darkgray")

shapiro.test(residuals(SL_model.1))
## 
##  Shapiro-Wilk normality test
## 
## data:  residuals(SL_model.1)
## W = 0.99185, p-value = 1.593e-11
qqnorm(resid(SL_model.1))
qqline(resid(SL_model.1))

#model fit
library(sjPlot)
plot_model(SL_model.1, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]
## [[2]]$Tank
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]$Paternal_GF
## `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(SL_model.1)
## No Studentized residuals with Bonferroni p < 0.05
## Largest |rstudent|:
##       rstudent unadjusted p-value Bonferroni p
## 1399 -3.698924          0.0002207      0.62039

model analysis

summary(SL_model.1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Length ~ Parental_treat * Temp * Control_CO + (1 | Maternal_GF) +  
##     (1 | Maternal_GM) + (1 | Paternal_GF) + (1 | Paternal_GM) +      (1 | Tank)
##    Data: eliminated
## 
## REML criterion at convergence: 13665.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5941 -0.5731  0.0497  0.6606  3.1372 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  Tank        (Intercept) 1.3840   1.1765  
##  Paternal_GF (Intercept) 1.9930   1.4117  
##  Maternal_GF (Intercept) 0.1256   0.3544  
##  Paternal_GM (Intercept) 3.5679   1.8889  
##  Maternal_GM (Intercept) 0.4383   0.6621  
##  Residual                6.9195   2.6305  
## Number of obs: 2811, groups:  
## Tank, 183; Paternal_GF, 5; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
## 
## Fixed effects:
##                                                Estimate Std. Error        df
## (Intercept)                                    30.20178    1.42228   4.71142
## Parental_treatCCCH                              0.67972    0.64398 125.74864
## Parental_treatHHCC                              1.65420    0.68572 119.43781
## Parental_treatCCHC                              1.64537    0.75970 125.93531
## Parental_treatHHHC                              1.94077    0.76712 136.28960
## Tempzero                                        0.37515    0.61737 118.69274
## Control_COcontrol                               0.20844    0.62357 122.91701
## Parental_treatCCCH:Tempzero                     0.37785    0.86392 117.43732
## Parental_treatHHCC:Tempzero                    -0.03525    0.86602 117.62717
## Parental_treatCCHC:Tempzero                    -0.15907    0.85867 114.88098
## Parental_treatHHHC:Tempzero                     0.08002    0.99585 124.89379
## Parental_treatCCCH:Control_COcontrol            0.45477    0.86683 129.60100
## Parental_treatHHCC:Control_COcontrol            0.63246    0.88594 125.76207
## Parental_treatCCHC:Control_COcontrol            0.05823    0.86421 117.52948
## Parental_treatHHHC:Control_COcontrol           -0.27750    1.04209 128.81455
## Tempzero:Control_COcontrol                      0.18827    0.86933 120.01582
## Parental_treatCCCH:Tempzero:Control_COcontrol  -0.39131    1.19397 135.26260
## Parental_treatHHCC:Tempzero:Control_COcontrol   0.77257    1.25076 123.63753
## Parental_treatCCHC:Tempzero:Control_COcontrol   0.05882    1.21311 116.03118
## Parental_treatHHHC:Tempzero:Control_COcontrol   0.27165    1.45601 126.54347
##                                               t value Pr(>|t|)    
## (Intercept)                                    21.235 7.36e-06 ***
## Parental_treatCCCH                              1.055   0.2932    
## Parental_treatHHCC                              2.412   0.0174 *  
## Parental_treatCCHC                              2.166   0.0322 *  
## Parental_treatHHHC                              2.530   0.0125 *  
## Tempzero                                        0.608   0.5446    
## Control_COcontrol                               0.334   0.7387    
## Parental_treatCCCH:Tempzero                     0.437   0.6627    
## Parental_treatHHCC:Tempzero                    -0.041   0.9676    
## Parental_treatCCHC:Tempzero                    -0.185   0.8534    
## Parental_treatHHHC:Tempzero                     0.080   0.9361    
## Parental_treatCCCH:Control_COcontrol            0.525   0.6007    
## Parental_treatHHCC:Control_COcontrol            0.714   0.4766    
## Parental_treatCCHC:Control_COcontrol            0.067   0.9464    
## Parental_treatHHHC:Control_COcontrol           -0.266   0.7904    
## Tempzero:Control_COcontrol                      0.217   0.8289    
## Parental_treatCCCH:Tempzero:Control_COcontrol  -0.328   0.7436    
## Parental_treatHHCC:Tempzero:Control_COcontrol   0.618   0.5379    
## Parental_treatCCHC:Tempzero:Control_COcontrol   0.048   0.9614    
## Parental_treatHHHC:Tempzero:Control_COcontrol   0.187   0.8523    
## ---
## 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
Anova(SL_model.1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: Length
##                                  Chisq Df Pr(>Chisq)    
## Parental_treat                 33.5481  4  9.224e-07 ***
## Temp                            7.9887  1   0.004707 ** 
## Control_CO                      7.8300  1   0.005139 ** 
## Parental_treat:Temp             0.6489  4   0.957479    
## Parental_treat:Control_CO       3.7788  4   0.436772    
## Temp:Control_CO                 0.5346  1   0.464688    
## Parental_treat:Temp:Control_CO  0.9565  4   0.916318    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(emmeans(SL_model.1, pairwise ~ Control_CO *Temp ))
## NOTE: Results may be misleading due to involvement in interactions

emmeans(SL_model.1, pairwise ~ Control_CO *Temp )
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Control_CO Temp     emmean   SE   df lower.CL upper.CL
##  CO         elevated   31.4 1.36 4.14     27.7     35.1
##  control    elevated   31.8 1.36 4.14     28.0     35.5
##  CO         zero       31.8 1.36 4.13     28.1     35.6
##  control    zero       32.5 1.36 4.15     28.8     36.3
## 
## Results are averaged over the levels of: Parental_treat 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast                        estimate    SE  df t.ratio p.value
##  CO elevated - control elevated   -0.3820 0.297 157  -1.286  0.5731
##  CO elevated - CO zero            -0.4279 0.289 148  -1.482  0.4510
##  CO elevated - control zero       -1.1405 0.299 155  -3.816  0.0011
##  control elevated - CO zero       -0.0458 0.292 156  -0.157  0.9986
##  control elevated - control zero  -0.7585 0.299 169  -2.536  0.0580
##  CO zero - control zero           -0.7127 0.294 153  -2.425  0.0766
## 
## Results are averaged over the levels of: Parental_treat 
## Degrees-of-freedom method: kenward-roger 
## P value adjustment: tukey method for comparing a family of 4 estimates
plot(emmeans(SL_model.1, pairwise ~ Parental_treat ) )
## NOTE: Results may be misleading due to involvement in interactions

emmeans(SL_model.1, pairwise ~ Parental_treat)
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Parental_treat emmean   SE   df lower.CL upper.CL
##  CCCC             30.5 1.38 4.31     26.8     34.3
##  CCCH             31.5 1.39 4.37     27.8     35.3
##  HHCC             32.7 1.40 4.32     28.9     36.5
##  CCHC             32.2 1.40 4.44     28.4     35.9
##  HHHC             32.5 1.39 4.52     28.8     36.1
## 
## Results are averaged over the levels of: Temp, Control_CO 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast    estimate    SE    df t.ratio p.value
##  CCCC - CCCH   -0.998 0.376 158.2  -2.651  0.0661
##  CCCC - HHCC   -2.146 0.475  84.6  -4.522  0.0002
##  CCCC - CCHC   -1.610 0.610 112.1  -2.640  0.0700
##  CCCC - HHHC   -1.910 0.470 170.8  -4.064  0.0007
##  CCCH - HHCC   -1.148 0.468  80.7  -2.454  0.1117
##  CCCH - CCHC   -0.611 0.609  94.5  -1.005  0.8526
##  CCCH - HHHC   -0.912 0.572 162.2  -1.594  0.5034
##  HHCC - CCHC    0.536 0.459 109.3   1.168  0.7696
##  HHCC - HHHC    0.236 0.561  66.4   0.420  0.9933
##  CCHC - HHHC   -0.300 0.627 102.9  -0.479  0.9891
## 
## Results are averaged over the levels of: Temp, Control_CO 
## Degrees-of-freedom method: kenward-roger 
## P value adjustment: tukey method for comparing a family of 5 estimates
plot(emmeans(SL_model.1, pairwise ~ Temp ))
## NOTE: Results may be misleading due to involvement in interactions

emmeans(SL_model.1, pairwise ~ Temp )
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Temp     emmean   SE   df lower.CL upper.CL
##  elevated   31.6 1.35 4.04     27.8     35.3
##  zero       32.2 1.35 4.04     28.4     35.9
## 
## Results are averaged over the levels of: Parental_treat, Control_CO 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast        estimate    SE  df t.ratio p.value
##  elevated - zero   -0.593 0.208 158  -2.854  0.0049
## 
## Results are averaged over the levels of: Parental_treat, Control_CO 
## Degrees-of-freedom method: kenward-roger
plot(emmeans(SL_model.1, pairwise ~ Control_CO  ))
## NOTE: Results may be misleading due to involvement in interactions

emmeans(SL_model.1, pairwise ~ Control_CO  )
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Control_CO emmean   SE   df lower.CL upper.CL
##  CO           31.6 1.35 4.04     27.9     35.3
##  control      32.1 1.36 4.04     28.4     35.9
## 
## Results are averaged over the levels of: Parental_treat, Temp 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate   SE  df t.ratio p.value
##  CO - control   -0.547 0.21 152  -2.607  0.0101
## 
## Results are averaged over the levels of: Parental_treat, Temp 
## Degrees-of-freedom method: kenward-roger
#for graphs
JSLEMM = (emmeans(SL_model.1, ~ Parental_treat * Temp * Control_CO) %>% as.data.frame)
JSLEMM
##  Parental_treat Temp     Control_CO   emmean       SE   df lower.CL upper.CL
##  CCCC           elevated CO         30.20178 1.431385 5.03 26.52838 33.87517
##  CCCH           elevated CO         30.88150 1.436140 5.00 27.19061 34.57239
##  HHCC           elevated CO         31.85598 1.448126 5.00 28.13299 35.57897
##  CCHC           elevated CO         31.84715 1.449657 5.09 28.14116 35.55314
##  HHHC           elevated CO         32.14255 1.474119 5.73 28.49347 35.79163
##  CCCC           zero     CO         30.57693 1.426214 4.95 26.89891 34.25494
##  CCCH           zero     CO         31.63450 1.438403 5.04 27.94492 35.32408
##  HHCC           zero     CO         32.19588 1.443003 4.93 28.46998 35.92179
##  CCHC           zero     CO         32.06323 1.448753 5.08 28.35719 35.76927
##  HHHC           zero     CO         32.59771 1.459056 5.50 28.94657 36.24886
##  CCCC           elevated control    30.41022 1.428798 4.98 26.73403 34.08641
##  CCCH           elevated control    31.54471 1.438197 5.04 27.85650 35.23293
##  HHCC           elevated control    32.69688 1.452528 5.06 28.97730 36.41646
##  CCHC           elevated control    32.11382 1.449718 5.09 28.40767 35.81998
##  HHHC           elevated control    32.07349 1.487801 5.95 28.42505 35.72194
##  CCCC           zero     control    30.97365 1.427493 4.97 27.29660 34.65069
##  CCCH           zero     control    32.09467 1.430950 4.93 28.40094 35.78839
##  HHCC           zero     control    33.99763 1.463035 5.22 30.28331 37.71194
##  CCHC           zero     control    32.57699 1.450091 5.10 28.87136 36.28263
##  HHHC           zero     control    32.98859 1.494838 6.06 29.34032 36.63685
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95

plot modeled data

#combine column for x axis
JSLEMM_graph <- JSLEMM %>%  
 unite(Temp:Control_CO, col="Juv_treat", sep="_", remove=FALSE)
JSLEMM_graph
##    Parental_treat        Juv_treat     Temp Control_CO   emmean       SE
## 1            CCCC      elevated_CO elevated         CO 30.20178 1.431385
## 2            CCCH      elevated_CO elevated         CO 30.88150 1.436140
## 3            HHCC      elevated_CO elevated         CO 31.85598 1.448126
## 4            CCHC      elevated_CO elevated         CO 31.84715 1.449657
## 5            HHHC      elevated_CO elevated         CO 32.14255 1.474119
## 6            CCCC          zero_CO     zero         CO 30.57693 1.426214
## 7            CCCH          zero_CO     zero         CO 31.63450 1.438403
## 8            HHCC          zero_CO     zero         CO 32.19588 1.443003
## 9            CCHC          zero_CO     zero         CO 32.06323 1.448753
## 10           HHHC          zero_CO     zero         CO 32.59771 1.459056
## 11           CCCC elevated_control elevated    control 30.41022 1.428798
## 12           CCCH elevated_control elevated    control 31.54471 1.438197
## 13           HHCC elevated_control elevated    control 32.69688 1.452528
## 14           CCHC elevated_control elevated    control 32.11382 1.449718
## 15           HHHC elevated_control elevated    control 32.07349 1.487801
## 16           CCCC     zero_control     zero    control 30.97365 1.427493
## 17           CCCH     zero_control     zero    control 32.09467 1.430949
## 18           HHCC     zero_control     zero    control 33.99763 1.463035
## 19           CCHC     zero_control     zero    control 32.57699 1.450091
## 20           HHHC     zero_control     zero    control 32.98859 1.494838
##          df lower.CL upper.CL
## 1  5.027728 26.52838 33.87517
## 2  5.003729 27.19061 34.57239
## 3  4.997935 28.13299 35.57897
## 4  5.093447 28.14116 35.55314
## 5  5.727317 28.49346 35.79163
## 6  4.947132 26.89891 34.25494
## 7  5.036082 27.94492 35.32408
## 8  4.927177 28.46998 35.92179
## 9  5.082443 28.35719 35.76927
## 10 5.495543 28.94657 36.24886
## 11 4.984918 26.73403 34.08641
## 12 5.039909 27.85650 35.23293
## 13 5.064503 28.97730 36.41646
## 14 5.093420 28.40767 35.81998
## 15 5.946692 28.42505 35.72194
## 16 4.966046 27.29660 34.65069
## 17 4.931794 28.40094 35.78839
## 18 5.216838 30.28331 37.71194
## 19 5.100304 28.87135 36.28263
## 20 6.064930 29.34032 36.63685
cbPalette <- c("#56B4E9", "#E69F00", "#D55E00","#009E73", "#999999")                     

#better labels#
graph <- ggplot(JSLEMM_graph, aes (x = Juv_treat,  y=emmean, colour=Parental_treat)) + 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="Standard length (mm)") +
  
  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 = 13)) + 
  
  scale_colour_manual(values=cbPalette, name = "Cross-generation treatment", 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("SL_graph.eps", graph, height = 6, width = 14, dpi = 320)

model with kurtosis and no data removed to highlight the bad model fit but same overall results

SL_model.1FULL = lmer(Length ~ Parental_treat * Temp * Control_CO  +   (1 | Maternal_GF) +  (1 | Maternal_GM)   + (1 | Paternal_GF) + (1 | Paternal_GM)  + (1|Tank), data = Growth_Data)   

performance::check_model(SL_model.1FULL, 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(SL_model.1FULL, 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(SL_model.1FULL, 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(SL_model.1FULL, 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(SL_model.1FULL, 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(SL_model.1FULL, 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(SL_model.1FULL)

#normality
hist(residuals(SL_model.1FULL), col="darkgray")

shapiro.test(residuals(SL_model.1FULL))
## 
##  Shapiro-Wilk normality test
## 
## data:  residuals(SL_model.1FULL)
## W = 0.94996, p-value < 2.2e-16
qqnorm(resid(SL_model.1FULL))
qqline(resid(SL_model.1FULL))

#model fit
library(sjPlot)
plot_model(SL_model.1FULL, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]
## [[2]]$Tank
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]$Paternal_GF
## `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(SL_model.1FULL)
##       rstudent unadjusted p-value Bonferroni p
## 2095 -5.250383         1.6264e-07   0.00048061
## 2817 -5.243242         1.6901e-07   0.00049941
## 298  -4.973457         6.9564e-07   0.00205560
## 2779 -4.937559         8.3542e-07   0.00246870
## 2255 -4.915337         9.3511e-07   0.00276330
## 1227 -4.659100         3.3177e-06   0.00980380
## 1679 -4.603537         4.3307e-06   0.01279700
## 845  -4.477836         7.8287e-06   0.02313400
## 621  -4.452292         8.8136e-06   0.02604400
## 1444 -4.404996         1.0958e-05   0.03238100
#results
summary(SL_model.1FULL)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Length ~ Parental_treat * Temp * Control_CO + (1 | Maternal_GF) +  
##     (1 | Maternal_GM) + (1 | Paternal_GF) + (1 | Paternal_GM) +      (1 | Tank)
##    Data: Growth_Data
## 
## REML criterion at convergence: 15747.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.1161 -0.4431  0.0765  0.5929  3.4050 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  Tank        (Intercept)  3.1838  1.7843  
##  Paternal_GF (Intercept)  3.7106  1.9263  
##  Maternal_GF (Intercept)  0.3366  0.5802  
##  Paternal_GM (Intercept)  5.8093  2.4103  
##  Maternal_GM (Intercept)  0.5167  0.7188  
##  Residual                10.9163  3.3040  
## Number of obs: 2955, groups:  
## Tank, 183; Paternal_GF, 5; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
## 
## Fixed effects:
##                                                 Estimate Std. Error         df
## (Intercept)                                    29.888281   1.858556   4.923076
## Parental_treatCCCH                              0.451202   0.922468 122.709784
## Parental_treatHHCC                              1.987886   0.981278 123.344384
## Parental_treatCCHC                              1.552921   1.083389 116.755852
## Parental_treatHHHC                              1.826940   1.088891 129.419356
## Tempzero                                        0.124457   0.886083 118.474923
## Control_COcontrol                               0.065786   0.892308 121.581809
## Parental_treatCCCH:Tempzero                     0.090954   1.245493 116.242515
## Parental_treatHHCC:Tempzero                    -0.001289   1.249262 117.338213
## Parental_treatCCHC:Tempzero                     0.118886   1.241676 114.906112
## Parental_treatHHHC:Tempzero                     0.701619   1.423228 121.266061
## Parental_treatCCCH:Control_COcontrol            1.336669   1.237250 129.012687
## Parental_treatHHCC:Control_COcontrol            1.193180   1.266004 122.863242
## Parental_treatCCHC:Control_COcontrol            0.356183   1.247852 117.058063
## Parental_treatHHHC:Control_COcontrol            1.046066   1.473551 125.261394
## Tempzero:Control_COcontrol                      0.349127   1.252115 118.608940
## Parental_treatCCCH:Tempzero:Control_COcontrol  -0.485518   1.704654 135.027498
## Parental_treatHHCC:Tempzero:Control_COcontrol   1.230518   1.790639 120.227666
## Parental_treatCCHC:Tempzero:Control_COcontrol  -0.373408   1.756948 115.389313
## Parental_treatHHHC:Tempzero:Control_COcontrol  -0.744567   2.075553 122.476345
##                                               t value Pr(>|t|)    
## (Intercept)                                    16.081 1.91e-05 ***
## Parental_treatCCCH                              0.489   0.6256    
## Parental_treatHHCC                              2.026   0.0449 *  
## Parental_treatCCHC                              1.433   0.1544    
## Parental_treatHHHC                              1.678   0.0958 .  
## Tempzero                                        0.140   0.8885    
## Control_COcontrol                               0.074   0.9414    
## Parental_treatCCCH:Tempzero                     0.073   0.9419    
## Parental_treatHHCC:Tempzero                    -0.001   0.9992    
## Parental_treatCCHC:Tempzero                     0.096   0.9239    
## Parental_treatHHHC:Tempzero                     0.493   0.6229    
## Parental_treatCCCH:Control_COcontrol            1.080   0.2820    
## Parental_treatHHCC:Control_COcontrol            0.942   0.3478    
## Parental_treatCCHC:Control_COcontrol            0.285   0.7758    
## Parental_treatHHHC:Control_COcontrol            0.710   0.4791    
## Tempzero:Control_COcontrol                      0.279   0.7809    
## Parental_treatCCCH:Tempzero:Control_COcontrol  -0.285   0.7762    
## Parental_treatHHCC:Tempzero:Control_COcontrol   0.687   0.4933    
## Parental_treatCCHC:Tempzero:Control_COcontrol  -0.213   0.8321    
## Parental_treatHHHC:Tempzero:Control_COcontrol  -0.359   0.7204    
## ---
## 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
Anova(SL_model.1FULL)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: Length
##                                  Chisq Df Pr(>Chisq)    
## Parental_treat                 31.3538  4  2.593e-06 ***
## Temp                            1.9563  1  0.1619105    
## Control_CO                     11.1874  1  0.0008235 ***
## Parental_treat:Temp             1.0069  4  0.9087535    
## Parental_treat:Control_CO       5.3065  4  0.2572650    
## Temp:Control_CO                 0.2833  1  0.5945181    
## Parental_treat:Temp:Control_CO  1.3886  4  0.8461763    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

CONDITION DATA (based on log weight for a given log length)

Transorming raw data

#?log

Growth_Data$log_weight = log10(Growth_Data$Weight)

Growth_Data$log_length = log10(Growth_Data$Length)

head(Growth_Data)
## # A tibble: 6 × 21
##   Tank  Parental_number Female  Male Maternal Maternal_GF Maternal_GM Paternal
##   <fct> <fct>            <dbl> <dbl> <chr>    <fct>       <fct>       <chr>   
## 1 1     72                  42   220 DA       D           A           EC      
## 2 1     72                  42   220 DA       D           A           EC      
## 3 1     72                  42   220 DA       D           A           EC      
## 4 1     72                  42   220 DA       D           A           EC      
## 5 1     72                  42   220 DA       D           A           EC      
## 6 1     72                  42   220 DA       D           A           EC      
## # ℹ 13 more variables: Paternal_GF <fct>, Paternal_GM <fct>, DOM <chr>,
## #   DOD <chr>, Age <dbl>, Parental_treat <fct>, Temp <fct>, Control_CO <fct>,
## #   Length <dbl>, Weight <dbl>, Density <dbl>, log_weight <dbl>,
## #   log_length <dbl>

Exploring raw data

#exploring raw data and outliers

ggplot(Growth_Data, aes(y=Weight, x=Length)) + geom_point()

ggplot(Growth_Data, aes(y=log_weight, x=Parental_treat)) + geom_boxplot()

ggplot(Growth_Data, aes(y=log_weight, x=log_length)) + geom_point()

ggplot(Growth_Data, aes(x=log_weight)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Raw data checks

qqPlot(Growth_Data$log_weight)

## [1] 1679 2255
shapiro.test(Growth_Data$log_weight)
## 
##  Shapiro-Wilk normality test
## 
## data:  Growth_Data$log_weight
## W = 0.94686, p-value < 2.2e-16
nortest::lillie.test(Growth_Data$log_weight)
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  Growth_Data$log_weight
## D = 0.070895, p-value < 2.2e-16
leveneTest(log_weight ~ Parental_treat * Temp * Control_CO, data = Growth_Data)
## Levene's Test for Homogeneity of Variance (center = median)
##         Df F value   Pr(>F)   
## group   19  2.2377 0.001598 **
##       2935                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
kurtosis(Growth_Data$log_weight)
## [1] 6.939252

model

Cond_model.1 = lmer(log_weight ~ Parental_treat * Temp * Control_CO  +  log_length + (1 | Maternal_GF) +    (1 | Maternal_GM)   + (1 | Paternal_GF) + (1 | Paternal_GM) + (1| Tank) + Density, data = Growth_Data)  
## boundary (singular) fit: see help('isSingular')
summary(Cond_model.1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: log_weight ~ Parental_treat * Temp * Control_CO + log_length +  
##     (1 | Maternal_GF) + (1 | Maternal_GM) + (1 | Paternal_GF) +  
##     (1 | Paternal_GM) + (1 | Tank) + Density
##    Data: Growth_Data
## 
## REML criterion at convergence: -12144.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5701 -0.5829  0.0698  0.6330 10.5009 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. 
##  Tank        (Intercept) 1.480e-04 1.216e-02
##  Paternal_GF (Intercept) 1.798e-04 1.341e-02
##  Maternal_GF (Intercept) 7.533e-13 8.679e-07
##  Paternal_GM (Intercept) 1.371e-04 1.171e-02
##  Maternal_GM (Intercept) 1.181e-04 1.087e-02
##  Residual                8.266e-04 2.875e-02
## Number of obs: 2955, groups:  
## Tank, 183; Paternal_GF, 5; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
## 
## Fixed effects:
##                                                 Estimate Std. Error         df
## (Intercept)                                   -4.276e+00  2.239e-02  8.172e+01
## Parental_treatCCCH                             7.219e-03  6.624e-03  1.485e+02
## Parental_treatHHCC                             5.243e-03  6.945e-03  1.521e+02
## Parental_treatCCHC                            -8.833e-03  7.763e-03  1.522e+02
## Parental_treatHHHC                             3.475e-04  7.889e-03  1.610e+02
## Tempzero                                      -5.547e-03  6.402e-03  1.465e+02
## Control_COcontrol                              2.938e-03  6.441e-03  1.520e+02
## log_length                                     2.905e+00  1.125e-02  2.870e+03
## Density                                       -2.487e-03  3.478e-04  2.215e+02
## Parental_treatCCCH:Tempzero                   -1.289e-03  8.980e-03  1.434e+02
## Parental_treatHHCC:Tempzero                   -5.895e-03  8.983e-03  1.451e+02
## Parental_treatCCHC:Tempzero                   -3.171e-03  8.912e-03  1.411e+02
## Parental_treatHHHC:Tempzero                   -5.152e-03  1.028e-02  1.512e+02
## Parental_treatCCCH:Control_COcontrol          -6.617e-03  8.997e-03  1.582e+02
## Parental_treatHHCC:Control_COcontrol          -3.843e-03  9.166e-03  1.534e+02
## Parental_treatCCHC:Control_COcontrol          -5.523e-03  8.970e-03  1.448e+02
## Parental_treatHHHC:Control_COcontrol          -1.594e-02  1.067e-02  1.568e+02
## Tempzero:Control_COcontrol                    -4.399e-03  9.017e-03  1.474e+02
## Parental_treatCCCH:Tempzero:Control_COcontrol -1.427e-03  1.244e-02  1.634e+02
## Parental_treatHHCC:Tempzero:Control_COcontrol -3.818e-03  1.292e-02  1.501e+02
## Parental_treatCCHC:Tempzero:Control_COcontrol  2.342e-03  1.261e-02  1.423e+02
## Parental_treatHHHC:Tempzero:Control_COcontrol  1.195e-02  1.500e-02  1.532e+02
##                                                t value Pr(>|t|)    
## (Intercept)                                   -190.981  < 2e-16 ***
## Parental_treatCCCH                               1.090    0.278    
## Parental_treatHHCC                               0.755    0.451    
## Parental_treatCCHC                              -1.138    0.257    
## Parental_treatHHHC                               0.044    0.965    
## Tempzero                                        -0.866    0.388    
## Control_COcontrol                                0.456    0.649    
## log_length                                     258.316  < 2e-16 ***
## Density                                         -7.152 1.24e-11 ***
## Parental_treatCCCH:Tempzero                     -0.144    0.886    
## Parental_treatHHCC:Tempzero                     -0.656    0.513    
## Parental_treatCCHC:Tempzero                     -0.356    0.722    
## Parental_treatHHHC:Tempzero                     -0.501    0.617    
## Parental_treatCCCH:Control_COcontrol            -0.735    0.463    
## Parental_treatHHCC:Control_COcontrol            -0.419    0.676    
## Parental_treatCCHC:Control_COcontrol            -0.616    0.539    
## Parental_treatHHHC:Control_COcontrol            -1.494    0.137    
## Tempzero:Control_COcontrol                      -0.488    0.626    
## Parental_treatCCCH:Tempzero:Control_COcontrol   -0.115    0.909    
## Parental_treatHHCC:Tempzero:Control_COcontrol   -0.296    0.768    
## Parental_treatCCHC:Tempzero:Control_COcontrol    0.186    0.853    
## Parental_treatHHHC:Tempzero:Control_COcontrol    0.797    0.427    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 22 > 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(Cond_model.1)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: log_weight
##                                     Chisq Df Pr(>Chisq)    
## Parental_treat                    10.8488  4    0.02832 *  
## Temp                              23.9182  1  1.005e-06 ***
## Control_CO                         3.9461  1    0.04698 *  
## log_length                     66727.2586  1  < 2.2e-16 ***
## Density                           51.1446  1  8.581e-13 ***
## Parental_treat:Temp                1.7949  4    0.77342    
## Parental_treat:Control_CO          2.2153  4    0.69624    
## Temp:Control_CO                    0.7242  1    0.39477    
## Parental_treat:Temp:Control_CO     1.2211  4    0.87462    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

post model checks

performance::check_model(Cond_model.1, 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(Cond_model.1, check="outliers") 
performance::check_model(Cond_model.1, 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(Cond_model.1, 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(Cond_model.1, 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(Cond_model.1, check="pp_check")

#Homogeneity
plot(Cond_model.1)

#normality
hist(residuals(Cond_model.1, col="darkgray"))

shapiro.test(residuals(Cond_model.1))
## 
##  Shapiro-Wilk normality test
## 
## data:  residuals(Cond_model.1)
## W = 0.96812, p-value < 2.2e-16
qqnorm(resid(Cond_model.1))
qqline(resid(Cond_model.1))

#model fit
library(sjPlot)
plot_model(Cond_model.1, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]
## [[2]]$Tank
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]$Paternal_GF
## `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(Cond_model.1)
##       rstudent unadjusted p-value Bonferroni p
## 2328 10.722098         2.4562e-26   7.2579e-23
## 2593  6.071848         1.4276e-09   4.2186e-06
## 2146  5.360536         8.9430e-08   2.6426e-04
## 2514  4.686995         2.8992e-06   8.5672e-03
## 127   4.609247         4.2144e-06   1.2453e-02

removing outliers

Growth_Data_no_outliers = Growth_Data[-c(2328, 2593, 2156, 127, 2514),]

Growth_Data_no_outliers = Growth_Data[-c(2256,2515,2091,127,2436),] #high density model

rerun model

Cond_model.1.noout = lmer(log_weight ~ Parental_treat * Temp * Control_CO  +  log_length + (1 | Maternal_GF) +  (1 | Maternal_GM)   + (1 | Paternal_GF) + (1 | Paternal_GM) + (1| Tank) + Density, data = Growth_Data_no_outliers)  
## boundary (singular) fit: see help('isSingular')

post model checks

#Homogeneity
plot(Cond_model.1.noout)

#normality
hist(residuals(Cond_model.1.noout), col="darkgray")

shapiro.test(residuals(Cond_model.1.noout))
## 
##  Shapiro-Wilk normality test
## 
## data:  residuals(Cond_model.1.noout)
## W = 0.99062, p-value = 5.261e-13
qqnorm(resid(Cond_model.1.noout))
qqline(resid(Cond_model.1.noout))

#model fit
library(sjPlot)
plot_model(Cond_model.1.noout, type = "diag")
## [[1]]
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]
## [[2]]$Tank
## `geom_smooth()` using formula = 'y ~ x'

## 
## [[2]]$Paternal_GF
## `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(Cond_model.1.noout)
##      rstudent unadjusted p-value Bonferroni p
## 2145 5.588078         2.5075e-08    7.397e-05

model analysis

summary(Cond_model.1.noout)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: log_weight ~ Parental_treat * Temp * Control_CO + log_length +  
##     (1 | Maternal_GF) + (1 | Maternal_GM) + (1 | Paternal_GF) +  
##     (1 | Paternal_GM) + (1 | Tank) + Density
##    Data: Growth_Data_no_outliers
## 
## REML criterion at convergence: -12321.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6913 -0.5952  0.0784  0.6592  5.3999 
## 
## Random effects:
##  Groups      Name        Variance  Std.Dev. 
##  Tank        (Intercept) 1.492e-04 1.221e-02
##  Paternal_GF (Intercept) 1.610e-04 1.269e-02
##  Maternal_GF (Intercept) 2.377e-13 4.876e-07
##  Paternal_GM (Intercept) 1.258e-04 1.122e-02
##  Maternal_GM (Intercept) 1.186e-04 1.089e-02
##  Residual                7.702e-04 2.775e-02
## Number of obs: 2950, groups:  
## Tank, 183; Paternal_GF, 5; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
## 
## Fixed effects:
##                                                 Estimate Std. Error         df
## (Intercept)                                   -4.279e+00  2.173e-02  8.030e+01
## Parental_treatCCCH                             7.303e-03  6.583e-03  1.481e+02
## Parental_treatHHCC                             5.096e-03  6.901e-03  1.517e+02
## Parental_treatCCHC                            -9.506e-03  7.713e-03  1.521e+02
## Parental_treatHHHC                            -2.425e-04  7.831e-03  1.601e+02
## Tempzero                                      -6.497e-03  6.366e-03  1.463e+02
## Control_COcontrol                              2.932e-03  6.398e-03  1.513e+02
## log_length                                     2.906e+00  1.087e-02  2.860e+03
## Density                                       -2.451e-03  3.440e-04  2.184e+02
## Parental_treatCCCH:Tempzero                   -1.072e-03  8.932e-03  1.432e+02
## Parental_treatHHCC:Tempzero                   -5.050e-03  8.931e-03  1.448e+02
## Parental_treatCCHC:Tempzero                   -3.856e-03  8.866e-03  1.410e+02
## Parental_treatHHHC:Tempzero                   -3.953e-03  1.022e-02  1.508e+02
## Parental_treatCCCH:Control_COcontrol          -6.599e-03  8.933e-03  1.578e+02
## Parental_treatHHCC:Control_COcontrol          -3.769e-03  9.104e-03  1.527e+02
## Parental_treatCCHC:Control_COcontrol          -5.519e-03  8.917e-03  1.444e+02
## Parental_treatHHHC:Control_COcontrol          -1.585e-02  1.060e-02  1.560e+02
## Tempzero:Control_COcontrol                    -4.754e-03  8.966e-03  1.471e+02
## Parental_treatCCCH:Tempzero:Control_COcontrol -3.171e-04  1.235e-02  1.637e+02
## Parental_treatHHCC:Tempzero:Control_COcontrol -3.399e-03  1.284e-02  1.496e+02
## Parental_treatCCHC:Tempzero:Control_COcontrol  4.339e-03  1.254e-02  1.421e+02
## Parental_treatHHHC:Tempzero:Control_COcontrol  1.197e-02  1.490e-02  1.526e+02
##                                                t value Pr(>|t|)    
## (Intercept)                                   -196.935  < 2e-16 ***
## Parental_treatCCCH                               1.109    0.269    
## Parental_treatHHCC                               0.738    0.461    
## Parental_treatCCHC                              -1.233    0.220    
## Parental_treatHHHC                              -0.031    0.975    
## Tempzero                                        -1.021    0.309    
## Control_COcontrol                                0.458    0.647    
## log_length                                     267.326  < 2e-16 ***
## Density                                         -7.126 1.49e-11 ***
## Parental_treatCCCH:Tempzero                     -0.120    0.905    
## Parental_treatHHCC:Tempzero                     -0.565    0.573    
## Parental_treatCCHC:Tempzero                     -0.435    0.664    
## Parental_treatHHHC:Tempzero                     -0.387    0.699    
## Parental_treatCCCH:Control_COcontrol            -0.739    0.461    
## Parental_treatHHCC:Control_COcontrol            -0.414    0.679    
## Parental_treatCCHC:Control_COcontrol            -0.619    0.537    
## Parental_treatHHHC:Control_COcontrol            -1.496    0.137    
## Tempzero:Control_COcontrol                      -0.530    0.597    
## Parental_treatCCCH:Tempzero:Control_COcontrol   -0.026    0.980    
## Parental_treatHHCC:Tempzero:Control_COcontrol   -0.265    0.792    
## Parental_treatCCHC:Tempzero:Control_COcontrol    0.346    0.730    
## Parental_treatHHHC:Tempzero:Control_COcontrol    0.803    0.423    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 22 > 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(Cond_model.1.noout)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: log_weight
##                                     Chisq Df Pr(>Chisq)    
## Parental_treat                    12.4832  4    0.01410 *  
## Temp                              26.7168  1  2.356e-07 ***
## Control_CO                         3.5471  1    0.05965 .  
## log_length                     71463.2053  1  < 2.2e-16 ***
## Density                           50.7747  1  1.036e-12 ***
## Parental_treat:Temp                1.5847  4    0.81155    
## Parental_treat:Control_CO          2.1637  4    0.70569    
## Temp:Control_CO                    0.5628  1    0.45314    
## Parental_treat:Temp:Control_CO     1.2356  4    0.87220    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(emmeans(Cond_model.1.noout, pairwise ~Temp ) )
## NOTE: Results may be misleading due to involvement in interactions

emmeans(Cond_model.1.noout, pairwise ~ Temp )
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Temp     emmean     SE   df lower.CL upper.CL
##  elevated 0.0548 0.0109 5.95   0.0280   0.0816
##  zero     0.0444 0.0109 5.94   0.0176   0.0712
## 
## Results are averaged over the levels of: Parental_treat, Control_CO 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast        estimate      SE  df t.ratio p.value
##  elevated - zero   0.0104 0.00214 159   4.855  <.0001
## 
## Results are averaged over the levels of: Parental_treat, Control_CO 
## Degrees-of-freedom method: kenward-roger
plot(emmeans(Cond_model.1.noout, pairwise ~ Control_CO * Temp ) )
## NOTE: Results may be misleading due to involvement in interactions

emmeans(Cond_model.1.noout, pairwise ~ Control_CO * Temp )
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Control_CO Temp     emmean    SE   df lower.CL upper.CL
##  CO         elevated 0.0565 0.011 6.19   0.0297   0.0833
##  control    elevated 0.0531 0.011 6.20   0.0263   0.0799
##  CO         zero     0.0472 0.011 6.16   0.0204   0.0740
##  control    zero     0.0415 0.011 6.20   0.0147   0.0684
## 
## Results are averaged over the levels of: Parental_treat 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast                        estimate      SE  df t.ratio p.value
##  CO elevated - control elevated   0.00342 0.00306 159   1.115  0.6808
##  CO elevated - CO zero            0.00928 0.00298 149   3.111  0.0119
##  CO elevated - control zero       0.01493 0.00308 157   4.842  <.0001
##  control elevated - CO zero       0.00587 0.00305 156   1.922  0.2232
##  control elevated - control zero  0.01152 0.00306 169   3.762  0.0013
##  CO zero - control zero           0.00565 0.00306 154   1.845  0.2563
## 
## Results are averaged over the levels of: Parental_treat 
## Degrees-of-freedom method: kenward-roger 
## P value adjustment: tukey method for comparing a family of 4 estimates
plot(emmeans(Cond_model.1.noout, pairwise ~ Control_CO ) )
## NOTE: Results may be misleading due to involvement in interactions

emmeans(Cond_model.1.noout, pairwise ~ Control_CO)
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Control_CO emmean     SE   df lower.CL upper.CL
##  CO         0.0518 0.0109 5.95   0.0250   0.0786
##  control    0.0473 0.0109 5.96   0.0205   0.0741
## 
## Results are averaged over the levels of: Parental_treat, Temp 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate     SE  df t.ratio p.value
##  CO - control  0.00453 0.0022 154   2.063  0.0408
## 
## Results are averaged over the levels of: Parental_treat, Temp 
## Degrees-of-freedom method: kenward-roger
plot(emmeans(Cond_model.1.noout, pairwise ~ Parental_treat ) )
## NOTE: Results may be misleading due to involvement in interactions

emmeans(Cond_model.1.noout, pairwise ~ Parental_treat )
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Parental_treat emmean     SE   df lower.CL upper.CL
##  CCCC           0.0530 0.0112 6.66   0.0261   0.0799
##  CCCH           0.0564 0.0114 6.82   0.0292   0.0835
##  HHCC           0.0528 0.0114 6.31   0.0253   0.0803
##  CCHC           0.0399 0.0116 6.65   0.0122   0.0675
##  HHHC           0.0458 0.0114 7.13   0.0189   0.0728
## 
## Results are averaged over the levels of: Temp, Control_CO 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate      SE    df t.ratio p.value
##  CCCC - CCCH -0.003388 0.00398 124.3  -0.852  0.9136
##  CCCC - HHCC  0.000164 0.00499  42.5   0.033  1.0000
##  CCCC - CCHC  0.013109 0.00638  81.6   2.056  0.2495
##  CCCC - HHHC  0.007153 0.00482 170.7   1.484  0.5741
##  CCCH - HHCC  0.003552 0.00454  71.3   0.783  0.9347
##  CCCH - CCHC  0.016497 0.00597 133.1   2.761  0.0505
##  CCCH - HHHC  0.010541 0.00603  98.1   1.749  0.4093
##  HHCC - CCHC  0.012945 0.00453 144.7   2.858  0.0387
##  HHCC - HHHC  0.006989 0.00593  17.7   1.178  0.7635
##  CCHC - HHHC -0.005956 0.00684  32.9  -0.870  0.9057
## 
## Results are averaged over the levels of: Temp, Control_CO 
## Degrees-of-freedom method: kenward-roger 
## P value adjustment: tukey method for comparing a family of 5 estimates
#for graphs
CONDEMM = (emmeans(Cond_model.1.noout, ~ Parental_treat * Temp * Control_CO) %>% as.data.frame)
CONDEMM
##  Parental_treat Temp     Control_CO     emmean         SE    df   lower.CL
##  CCCC           elevated CO         0.05594815 0.01191667  8.42 0.02870764
##  CCCH           elevated CO         0.06325117 0.01203797  8.47 0.03575662
##  HHCC           elevated CO         0.06104376 0.01201392  7.97 0.03332123
##  CCHC           elevated CO         0.04644189 0.01218396  8.28 0.01850777
##  HHHC           elevated CO         0.05570563 0.01252046 10.20 0.02788125
##  CCCC           zero     CO         0.04945109 0.01189770  8.33 0.02220270
##  CCCH           zero     CO         0.05568216 0.01204125  8.47 0.02818094
##  HHCC           zero     CO         0.04949645 0.01195439  7.86 0.02184095
##  CCHC           zero     CO         0.03608843 0.01216710  8.27 0.00818854
##  HHHC           zero     CO         0.04525529 0.01233214  9.58 0.01761424
##  CCCC           elevated control    0.05888022 0.01190436  8.39 0.03164888
##  CCCH           elevated control    0.05958417 0.01201782  8.44 0.03212056
##  HHCC           elevated control    0.06020647 0.01209120  8.15 0.03241206
##  CCHC           elevated control    0.04385517 0.01219094  8.29 0.01591072
##  HHHC           elevated control    0.04278680 0.01260775 10.54 0.01488918
##  CCCC           zero     control    0.04762941 0.01189335  8.34 0.02039543
##  CCCH           zero     control    0.04694432 0.01195508  8.24 0.01951248
##  HHCC           zero     control    0.04050644 0.01218917  8.39 0.01262489
##  CCHC           zero     control    0.03308725 0.01219433  8.29 0.00513648
##  HHHC           zero     control    0.03954993 0.01276666 11.15 0.01149815
##    upper.CL
##  0.08318866
##  0.09074571
##  0.08876628
##  0.07437600
##  0.08353001
##  0.07669947
##  0.08318338
##  0.07715195
##  0.06398833
##  0.07289634
##  0.08611156
##  0.08704777
##  0.08800087
##  0.07179962
##  0.07068443
##  0.07486338
##  0.07437617
##  0.06838799
##  0.06103803
##  0.06760170
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#back-transform data
CONDEMM$emmean10 = 10^(CONDEMM$emmean)

CONDEMM$emmean.low = 10^(CONDEMM$emmean-CONDEMM$SE)

CONDEMM$emmean.high = 10^(CONDEMM$emmean+CONDEMM$SE)

CONDEMM
##  Parental_treat Temp     Control_CO     emmean         SE    df   lower.CL
##  CCCC           elevated CO         0.05594815 0.01191667  8.42 0.02870764
##  CCCH           elevated CO         0.06325117 0.01203797  8.47 0.03575662
##  HHCC           elevated CO         0.06104376 0.01201392  7.97 0.03332123
##  CCHC           elevated CO         0.04644189 0.01218396  8.28 0.01850777
##  HHHC           elevated CO         0.05570563 0.01252046 10.20 0.02788125
##  CCCC           zero     CO         0.04945109 0.01189770  8.33 0.02220270
##  CCCH           zero     CO         0.05568216 0.01204125  8.47 0.02818094
##  HHCC           zero     CO         0.04949645 0.01195439  7.86 0.02184095
##  CCHC           zero     CO         0.03608843 0.01216710  8.27 0.00818854
##  HHHC           zero     CO         0.04525529 0.01233214  9.58 0.01761424
##  CCCC           elevated control    0.05888022 0.01190436  8.39 0.03164888
##  CCCH           elevated control    0.05958417 0.01201782  8.44 0.03212056
##  HHCC           elevated control    0.06020647 0.01209120  8.15 0.03241206
##  CCHC           elevated control    0.04385517 0.01219094  8.29 0.01591072
##  HHHC           elevated control    0.04278680 0.01260775 10.54 0.01488918
##  CCCC           zero     control    0.04762941 0.01189335  8.34 0.02039543
##  CCCH           zero     control    0.04694432 0.01195508  8.24 0.01951248
##  HHCC           zero     control    0.04050644 0.01218917  8.39 0.01262489
##  CCHC           zero     control    0.03308725 0.01219433  8.29 0.00513648
##  HHHC           zero     control    0.03954993 0.01276666 11.15 0.01149815
##    upper.CL emmean10 emmean.low emmean.high
##  0.08318866 1.137492   1.106704    1.169135
##  0.09074571 1.156781   1.125157    1.189294
##  0.08876628 1.150916   1.119515    1.183199
##  0.07437600 1.112864   1.082076    1.144527
##  0.08353001 1.136856   1.104550    1.170108
##  0.07669947 1.120601   1.090318    1.151725
##  0.08318338 1.136795   1.105709    1.168755
##  0.07715195 1.120718   1.090290    1.151996
##  0.06398833 1.086647   1.056626    1.117521
##  0.07289634 1.109827   1.078756    1.141793
##  0.08611156 1.145197   1.114233    1.177022
##  0.08704777 1.147055   1.115749    1.179239
##  0.08800087 1.148700   1.117160    1.181130
##  0.07179962 1.106255   1.075633    1.137748
##  0.07068443 1.103537   1.071961    1.136042
##  0.07486338 1.115911   1.085765    1.146893
##  0.07437617 1.114152   1.083900    1.145248
##  0.06838799 1.097758   1.067376    1.129004
##  0.06103803 1.079163   1.049284    1.109894
##  0.06760170 1.095343   1.063612    1.128019
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95

plot modeled data

#combine column for x axis
CONDEMM_graph <- CONDEMM %>%  
 unite(Temp:Control_CO, col="Juv_treat", sep="_", remove=FALSE)
CONDEMM_graph
##    Parental_treat        Juv_treat     Temp Control_CO     emmean         SE
## 1            CCCC      elevated_CO elevated         CO 0.05594815 0.01191667
## 2            CCCH      elevated_CO elevated         CO 0.06325117 0.01203797
## 3            HHCC      elevated_CO elevated         CO 0.06104376 0.01201392
## 4            CCHC      elevated_CO elevated         CO 0.04644189 0.01218396
## 5            HHHC      elevated_CO elevated         CO 0.05570563 0.01252046
## 6            CCCC          zero_CO     zero         CO 0.04945109 0.01189770
## 7            CCCH          zero_CO     zero         CO 0.05568216 0.01204125
## 8            HHCC          zero_CO     zero         CO 0.04949645 0.01195439
## 9            CCHC          zero_CO     zero         CO 0.03608843 0.01216710
## 10           HHHC          zero_CO     zero         CO 0.04525529 0.01233214
## 11           CCCC elevated_control elevated    control 0.05888022 0.01190436
## 12           CCCH elevated_control elevated    control 0.05958417 0.01201782
## 13           HHCC elevated_control elevated    control 0.06020647 0.01209120
## 14           CCHC elevated_control elevated    control 0.04385517 0.01219094
## 15           HHHC elevated_control elevated    control 0.04278680 0.01260775
## 16           CCCC     zero_control     zero    control 0.04762941 0.01189335
## 17           CCCH     zero_control     zero    control 0.04694432 0.01195507
## 18           HHCC     zero_control     zero    control 0.04050644 0.01218917
## 19           CCHC     zero_control     zero    control 0.03308725 0.01219433
## 20           HHHC     zero_control     zero    control 0.03954993 0.01276666
##           df    lower.CL   upper.CL emmean10 emmean.low emmean.high
## 1   8.424899 0.028707637 0.08318866 1.137491   1.106704    1.169135
## 2   8.468521 0.035756622 0.09074571 1.156781   1.125157    1.189294
## 3   7.969658 0.033321235 0.08876628 1.150916   1.119515    1.183199
## 4   8.275809 0.018507773 0.07437600 1.112863   1.082076    1.144526
## 5  10.197201 0.027881252 0.08353001 1.136856   1.104549    1.170108
## 6   8.329500 0.022202705 0.07669947 1.120601   1.090319    1.151725
## 7   8.470062 0.028180942 0.08318338 1.136795   1.105709    1.168755
## 8   7.855324 0.021840946 0.07715195 1.120718   1.090290    1.151996
## 9   8.267940 0.008188541 0.06398833 1.086647   1.056626    1.117521
## 10  9.582067 0.017614241 0.07289634 1.109827   1.078756    1.141793
## 11  8.389303 0.031648882 0.08611156 1.145197   1.114233    1.177022
## 12  8.440100 0.032120561 0.08704777 1.147055   1.115749    1.179239
## 13  8.148052 0.032412057 0.08800087 1.148700   1.117160    1.181130
## 14  8.285829 0.015910719 0.07179962 1.106255   1.075633    1.137748
## 15 10.540959 0.014889179 0.07068443 1.103537   1.071961    1.136042
## 16  8.337673 0.020395427 0.07486338 1.115911   1.085766    1.146893
## 17  8.235473 0.019512478 0.07437617 1.114152   1.083900    1.145248
## 18  8.391647 0.012624888 0.06838799 1.097758   1.067376    1.129004
## 19  8.288398 0.005136475 0.06103803 1.079164   1.049284    1.109894
## 20 11.154606 0.011498149 0.06760170 1.095342   1.063612    1.128019
cbPalette <- c("#56B4E9", "#E69F00", "#D55E00","#009E73", "#999999")   
#better labels#
graph <- ggplot(CONDEMM_graph, aes (x = Juv_treat,  y=emmean10, colour=Parental_treat)) + 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="Weight (g)") +
  
  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 treatment", 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("COND_graph.eps", graph, height = 6, width = 14, dpi = 320)

Survival check

head(Growth_Data)
## # A tibble: 6 × 21
##   Tank  Parental_number Female  Male Maternal Maternal_GF Maternal_GM Paternal
##   <fct> <fct>            <dbl> <dbl> <chr>    <fct>       <fct>       <chr>   
## 1 1     72                  42   220 DA       D           A           EC      
## 2 1     72                  42   220 DA       D           A           EC      
## 3 1     72                  42   220 DA       D           A           EC      
## 4 1     72                  42   220 DA       D           A           EC      
## 5 1     72                  42   220 DA       D           A           EC      
## 6 1     72                  42   220 DA       D           A           EC      
## # ℹ 13 more variables: Paternal_GF <fct>, Paternal_GM <fct>, DOM <chr>,
## #   DOD <chr>, Age <dbl>, Parental_treat <fct>, Temp <fct>, Control_CO <fct>,
## #   Length <dbl>, Weight <dbl>, Density <dbl>, log_weight <dbl>,
## #   log_length <dbl>
S_data = Growth_Data %>%  group_by(Tank, Parental_treat, Temp, Control_CO,  Maternal_GF,  Maternal_GM,  Paternal_GF,  Paternal_GM) %>% summarise(density = mean(Density)) %>% as.data.frame
## `summarise()` has grouped output by 'Tank', 'Parental_treat', 'Temp',
## 'Control_CO', 'Maternal_GF', 'Maternal_GM', 'Paternal_GF'. You can override
## using the `.groups` argument.
S_data
##     Tank Parental_treat     Temp Control_CO Maternal_GF Maternal_GM Paternal_GF
## 1      1           HHCC     zero         CO           D           A           E
## 2      2           HHCC elevated         CO           D           A           E
## 3      3           CCCH     zero         CO           A           E           F
## 4      4           CCCH elevated         CO           A           E           F
## 5      5           CCHC     zero         CO           D           C           A
## 6      6           CCHC elevated         CO           D           C           A
## 7      7           CCCC     zero         CO           A           E           F
## 8      8           CCCC elevated         CO           A           E           F
## 9      9           HHCC     zero         CO           D           A           A
## 10    10           HHCC elevated         CO           D           A           A
## 11    11           CCCC     zero         CO           D           A           A
## 12    12           CCCC elevated         CO           D           A           A
## 13    13           HHCC     zero         CO           D           A           C
## 14    14           HHCC elevated         CO           D           A           C
## 15    15           CCHC     zero         CO           A           C           D
## 16    16           CCHC elevated         CO           A           C           D
## 17    17           HHHC     zero         CO           A           E           C
## 18    19           CCCH     zero         CO           F           A           D
## 19    20           CCCH elevated         CO           F           A           D
## 20    21           CCHC     zero         CO           D           C           E
## 21    22           CCHC elevated         CO           D           C           E
## 22    23           CCCH     zero         CO           D           A           A
## 23    24           CCCH elevated         CO           D           A           A
## 24    25           CCCC     zero    control           A           E           F
## 25    26           CCCC elevated    control           A           E           F
## 26    27           CCCC     zero    control           C           A           A
## 27    28           CCCC elevated    control           C           A           A
## 28    29           HHHC     zero    control           D           C           C
## 29    30           HHHC elevated    control           D           C           C
## 30    31           CCCH     zero    control           A           E           F
## 31    32           CCCH elevated    control           A           E           F
## 32    33           CCHC     zero    control           D           C           A
## 33    34           CCHC elevated    control           D           C           A
## 34    35           HHHC     zero    control           C           A           A
## 35    36           HHHC elevated    control           C           A           A
## 36    37           CCCH     zero    control           C           A           D
## 37    38           CCCH elevated    control           C           A           D
## 38    39           CCCC     zero    control           A           E           C
## 39    40           CCCC elevated    control           A           E           C
## 40    41           CCHC     zero    control           D           C           D
## 41    42           CCHC elevated    control           D           C           D
## 42    43           HHCC     zero    control           A           C           D
## 43    44           HHCC elevated    control           A           C           D
## 44    45           HHCC     zero    control           D           A           E
## 45    46           HHCC elevated    control           D           A           E
## 46    47           CCHC     zero    control           D           A           E
## 47    48           CCHC elevated    control           D           A           E
## 48    49           CCCC     zero    control           A           E           F
## 49    50           CCCC elevated    control           A           E           F
## 50    51           CCCH     zero    control           D           A           A
## 51    52           CCCH elevated    control           D           A           A
## 52    53           HHCC     zero    control           D           A           E
## 53    54           HHCC elevated    control           D           A           E
## 54    55           CCHC     zero    control           D           C           A
## 55    56           CCHC elevated    control           D           C           A
## 56    57           HHHC     zero    control           A           E           C
## 57    58           HHHC elevated    control           A           E           C
## 58    59           CCHC     zero    control           D           C           E
## 59    60           CCHC elevated    control           D           C           E
## 60    61           CCCC     zero    control           D           A           A
## 61    62           CCCC elevated    control           D           A           A
## 62    64           HHCC elevated    control           D           A           C
## 63    65           CCCH     zero    control           A           E           F
## 64    66           CCCH elevated    control           A           E           F
## 65    67           CCCH     zero    control           F           A           D
## 66    68           CCCH elevated    control           F           A           D
## 67    69           CCHC     zero    control           A           C           D
## 68    70           CCHC elevated    control           A           C           D
## 69    71           HHCC     zero    control           D           A           A
## 70    72           HHCC elevated    control           D           A           A
## 71    73           CCHC     zero         CO           D           C           A
## 72    74           CCHC elevated         CO           D           C           A
## 73    75           CCCC     zero         CO           A           E           F
## 74    76           CCCC elevated         CO           A           E           F
## 75    77           CCCC     zero         CO           C           A           A
## 76    78           CCCC elevated         CO           C           A           A
## 77    79           CCCH     zero         CO           C           A           D
## 78    80           CCCH elevated         CO           C           A           D
## 79    81           CCCC     zero         CO           A           E           C
## 80    82           CCCC elevated         CO           A           E           C
## 81    83           HHCC     zero         CO           A           C           D
## 82    84           HHCC elevated         CO           A           C           D
## 83    85           HHHC     zero         CO           D           C           C
## 84    86           HHHC elevated         CO           D           C           C
## 85    87           CCHC     zero         CO           D           A           E
## 86    88           CCHC elevated         CO           D           A           E
## 87    89           HHCC     zero         CO           D           A           E
## 88    90           HHCC elevated         CO           D           A           E
## 89    91           CCHC     zero         CO           D           C           D
## 90    92           CCHC elevated         CO           D           C           D
## 91    93           HHHC     zero         CO           A           E           C
## 92    94           HHHC elevated         CO           A           E           C
## 93    95           CCCH     zero         CO           A           E           F
## 94    96           CCCH elevated         CO           A           E           F
## 95    97           CCCH elevated    control           A           E           F
## 96    98           CCCH     zero    control           A           E           F
## 97    99           HHHC elevated    control           D           C           C
## 98   100           HHHC     zero    control           D           C           C
## 99   101           CCCH elevated    control           C           A           D
## 100  101           CCCH     zero    control           C           A           D
## 101  102           CCCH elevated    control           C           A           D
## 102  102           CCCH     zero    control           C           A           D
## 103  103           HHCC elevated    control           A           C           D
## 104  104           HHCC     zero    control           A           C           D
## 105  105           CCHC elevated    control           D           C           D
## 106  106           CCHC     zero    control           D           C           D
## 107  107           CCCC     zero    control           A           E           F
## 108  108           CCCC elevated    control           A           E           F
## 109  109           CCCC     zero    control           C           A           A
## 110  110           CCCC elevated    control           C           A           A
## 111  111           CCHC     zero    control           D           A           E
## 112  112           CCHC elevated    control           D           A           E
## 113  113           HHHC     zero    control           A           E           C
## 114  114           HHHC elevated    control           A           E           C
## 115  115           CCCC     zero    control           A           E           C
## 116  116           CCCC elevated    control           A           E           C
## 117  117           HHCC elevated         CO           D           A           C
## 118  118           HHCC     zero         CO           D           A           C
## 119  119           CCHC elevated         CO           A           C           D
## 120  120           CCHC     zero         CO           A           C           D
## 121  121           HHCC elevated         CO           D           A           A
## 122  122           HHCC     zero         CO           D           A           A
## 123  123           CCHC elevated         CO           D           C           E
## 124  124           CCHC     zero         CO           D           C           E
## 125  125           CCCH elevated         CO           F           A           D
## 126  126           CCCH     zero         CO           F           A           D
## 127  127           CCCH     zero         CO           A           E           F
## 128  128           CCCH elevated         CO           A           E           F
## 129  129           CCCH     zero         CO           D           A           A
## 130  130           CCCH elevated         CO           D           A           A
## 131  131           CCCC     zero         CO           A           E           F
## 132  132           CCCC elevated         CO           A           E           F
## 133  133           HHHC     zero         CO           A           E           C
## 134  134           HHHC elevated         CO           A           E           C
## 135  135           CCCC     zero         CO           D           A           A
## 136  136           CCCC elevated         CO           D           A           A
## 137  137           CCCC     zero         CO           A           E           F
## 138  138           CCCC elevated         CO           A           E           F
## 139  139           CCCH     zero         CO           C           A           D
## 140  140           CCCH elevated         CO           C           A           D
## 141  141           CCHC     zero         CO           D           C           D
## 142  142           CCHC elevated         CO           D           C           D
## 143  143           HHHC     zero         CO           C           A           A
## 144  144           HHHC elevated         CO           C           A           A
## 145  145           CCHC     zero         CO           D           A           E
## 146  146           CCHC elevated         CO           D           A           E
## 147  147           CCCC elevated         CO           C           A           A
## 148  148           CCCC     zero         CO           C           A           A
## 149  149           HHHC elevated         CO           D           C           C
## 150  150           HHHC     zero         CO           D           C           C
## 151  151           CCCC elevated         CO           A           E           C
## 152  152           CCCC     zero         CO           A           E           C
## 153  153           HHCC elevated         CO           A           C           D
## 154  154           HHCC     zero         CO           A           C           D
## 155  155           CCCH elevated         CO           A           E           F
## 156  156           CCCH     zero         CO           A           E           F
## 157  157           CCCH elevated    control           A           E           F
## 158  158           CCCH     zero    control           A           E           F
## 159  159           CCCC elevated    control           A           E           F
## 160  160           CCCC     zero    control           A           E           F
## 161  161           CCHC elevated    control           D           C           E
## 162  162           CCHC     zero    control           D           C           E
## 163  163           HHCC elevated    control           D           A           A
## 164  164           HHCC     zero    control           D           A           A
## 165  165           CCCC elevated    control           D           A           A
## 166  166           CCCC     zero    control           D           A           A
## 167  167           CCCH elevated    control           D           A           A
## 168  168           CCCH     zero    control           D           A           A
## 169  169           CCHC elevated    control           A           C           D
## 170  170           CCHC     zero    control           A           C           D
## 171  171           HHCC elevated    control           D           A           C
## 172  172           HHCC     zero    control           D           A           C
## 173  175           CCCH elevated    control           F           A           D
## 174  176           CCCH     zero    control           F           A           D
## 175  177           HHCC     zero    control           D           A           A
## 176  178           HHCC elevated    control           D           A           A
## 177  179           HHCC elevated         CO           D           A           A
## 178  180           HHCC     zero         CO           D           A           A
## 179  181           HHCC     zero         CO           D           A           A
## 180  182           HHCC elevated         CO           D           A           A
## 181  183           HHCC elevated    control           D           A           A
## 182  184           HHCC     zero    control           D           A           A
## 183  186           HHHC     zero         CO           C           A           A
## 184  187           HHHC elevated         CO           C           A           A
## 185  188           HHHC elevated    control           C           A           A
##     Paternal_GM density
## 1             C      20
## 2             C      17
## 3             E      19
## 4             E      19
## 5             C      19
## 6             C      19
## 7             E      15
## 8             E      16
## 9             C      16
## 10            C      18
## 11            E      20
## 12            E      19
## 13            A      15
## 14            A       8
## 15            A      20
## 16            A      17
## 17            A      11
## 18            A      18
## 19            A      15
## 20            A      19
## 21            A      17
## 22            E      15
## 23            E      11
## 24            A      11
## 25            A       9
## 26            E      17
## 27            E      15
## 28            A      17
## 29            A      17
## 30            A      17
## 31            A      17
## 32            C      16
## 33            C      15
## 34            E      14
## 35            E       3
## 36            A      17
## 37            A      17
## 38            A      16
## 39            A      12
## 40            A      18
## 41            A      19
## 42            A       7
## 43            A       5
## 44            C      19
## 45            C      20
## 46            C      16
## 47            C      14
## 48            E      18
## 49            E      17
## 50            E      15
## 51            E       5
## 52            C      20
## 53            C      20
## 54            C      19
## 55            C      16
## 56            A      10
## 57            A       9
## 58            A      18
## 59            A      20
## 60            E      20
## 61            E      20
## 62            A      11
## 63            E      19
## 64            E      19
## 65            A      18
## 66            A      17
## 67            A      18
## 68            A      19
## 69            C      16
## 70            C      16
## 71            C      19
## 72            C      15
## 73            A      17
## 74            A      18
## 75            E      16
## 76            E      21
## 77            A      15
## 78            A      19
## 79            A      15
## 80            A      13
## 81            A      19
## 82            A      17
## 83            A      20
## 84            A      19
## 85            C      18
## 86            C      18
## 87            C      19
## 88            C      19
## 89            A      18
## 90            A      17
## 91            A      15
## 92            A      13
## 93            A      16
## 94            A      20
## 95            A      17
## 96            A      19
## 97            A      18
## 98            A      18
## 99            A      20
## 100           A      20
## 101           A      19
## 102           A      19
## 103           A      18
## 104           A      14
## 105           A      20
## 106           A      20
## 107           A      15
## 108           A      15
## 109           E      19
## 110           E      19
## 111           C      17
## 112           C      21
## 113           A      14
## 114           A      17
## 115           A      12
## 116           A       9
## 117           A      19
## 118           A      17
## 119           A      19
## 120           A      19
## 121           C      17
## 122           C      17
## 123           A      17
## 124           A      17
## 125           A      16
## 126           A      20
## 127           E      19
## 128           E      20
## 129           E      11
## 130           E      18
## 131           E      21
## 132           E      13
## 133           A      20
## 134           A      18
## 135           E      20
## 136           E      16
## 137           A      12
## 138           A       4
## 139           A      18
## 140           A      18
## 141           A      18
## 142           A      20
## 143           E       7
## 144           E       6
## 145           C      20
## 146           C      20
## 147           E      18
## 148           E      19
## 149           A      20
## 150           A      16
## 151           A      12
## 152           A      16
## 153           A       6
## 154           A      18
## 155           A      20
## 156           A      19
## 157           E      14
## 158           E      20
## 159           E      17
## 160           E      14
## 161           A      14
## 162           A      14
## 163           C       9
## 164           C      15
## 165           E      19
## 166           E      20
## 167           E       3
## 168           E      11
## 169           A      19
## 170           A      19
## 171           A       6
## 172           A      11
## 173           A      15
## 174           A      14
## 175           E      12
## 176           E      14
## 177           E      18
## 178           E      17
## 179           E      19
## 180           E      20
## 181           E      19
## 182           E      10
## 183           E      15
## 184           E      13
## 185           E      15
ggplot(S_data, aes(y=density, x=Temp, colour=Parental_treat)) + geom_boxplot() +facet_grid(~factor(Control_CO))

#presence absence
head(S_data)
##   Tank Parental_treat     Temp Control_CO Maternal_GF Maternal_GM Paternal_GF
## 1    1           HHCC     zero         CO           D           A           E
## 2    2           HHCC elevated         CO           D           A           E
## 3    3           CCCH     zero         CO           A           E           F
## 4    4           CCCH elevated         CO           A           E           F
## 5    5           CCHC     zero         CO           D           C           A
## 6    6           CCHC elevated         CO           D           C           A
##   Paternal_GM density
## 1           C      20
## 2           C      17
## 3           E      19
## 4           E      19
## 5           C      19
## 6           C      19
survival_prop <- mutate(S_data, absence= 21-density)
head(survival_prop)
##   Tank Parental_treat     Temp Control_CO Maternal_GF Maternal_GM Paternal_GF
## 1    1           HHCC     zero         CO           D           A           E
## 2    2           HHCC elevated         CO           D           A           E
## 3    3           CCCH     zero         CO           A           E           F
## 4    4           CCCH elevated         CO           A           E           F
## 5    5           CCHC     zero         CO           D           C           A
## 6    6           CCHC elevated         CO           D           C           A
##   Paternal_GM density absence
## 1           C      20       1
## 2           C      17       4
## 3           E      19       2
## 4           E      19       2
## 5           C      19       2
## 6           C      19       2
survival <- cbind(survival_prop$density, survival_prop$absence)
survival
##        [,1] [,2]
##   [1,]   20    1
##   [2,]   17    4
##   [3,]   19    2
##   [4,]   19    2
##   [5,]   19    2
##   [6,]   19    2
##   [7,]   15    6
##   [8,]   16    5
##   [9,]   16    5
##  [10,]   18    3
##  [11,]   20    1
##  [12,]   19    2
##  [13,]   15    6
##  [14,]    8   13
##  [15,]   20    1
##  [16,]   17    4
##  [17,]   11   10
##  [18,]   18    3
##  [19,]   15    6
##  [20,]   19    2
##  [21,]   17    4
##  [22,]   15    6
##  [23,]   11   10
##  [24,]   11   10
##  [25,]    9   12
##  [26,]   17    4
##  [27,]   15    6
##  [28,]   17    4
##  [29,]   17    4
##  [30,]   17    4
##  [31,]   17    4
##  [32,]   16    5
##  [33,]   15    6
##  [34,]   14    7
##  [35,]    3   18
##  [36,]   17    4
##  [37,]   17    4
##  [38,]   16    5
##  [39,]   12    9
##  [40,]   18    3
##  [41,]   19    2
##  [42,]    7   14
##  [43,]    5   16
##  [44,]   19    2
##  [45,]   20    1
##  [46,]   16    5
##  [47,]   14    7
##  [48,]   18    3
##  [49,]   17    4
##  [50,]   15    6
##  [51,]    5   16
##  [52,]   20    1
##  [53,]   20    1
##  [54,]   19    2
##  [55,]   16    5
##  [56,]   10   11
##  [57,]    9   12
##  [58,]   18    3
##  [59,]   20    1
##  [60,]   20    1
##  [61,]   20    1
##  [62,]   11   10
##  [63,]   19    2
##  [64,]   19    2
##  [65,]   18    3
##  [66,]   17    4
##  [67,]   18    3
##  [68,]   19    2
##  [69,]   16    5
##  [70,]   16    5
##  [71,]   19    2
##  [72,]   15    6
##  [73,]   17    4
##  [74,]   18    3
##  [75,]   16    5
##  [76,]   21    0
##  [77,]   15    6
##  [78,]   19    2
##  [79,]   15    6
##  [80,]   13    8
##  [81,]   19    2
##  [82,]   17    4
##  [83,]   20    1
##  [84,]   19    2
##  [85,]   18    3
##  [86,]   18    3
##  [87,]   19    2
##  [88,]   19    2
##  [89,]   18    3
##  [90,]   17    4
##  [91,]   15    6
##  [92,]   13    8
##  [93,]   16    5
##  [94,]   20    1
##  [95,]   17    4
##  [96,]   19    2
##  [97,]   18    3
##  [98,]   18    3
##  [99,]   20    1
## [100,]   20    1
## [101,]   19    2
## [102,]   19    2
## [103,]   18    3
## [104,]   14    7
## [105,]   20    1
## [106,]   20    1
## [107,]   15    6
## [108,]   15    6
## [109,]   19    2
## [110,]   19    2
## [111,]   17    4
## [112,]   21    0
## [113,]   14    7
## [114,]   17    4
## [115,]   12    9
## [116,]    9   12
## [117,]   19    2
## [118,]   17    4
## [119,]   19    2
## [120,]   19    2
## [121,]   17    4
## [122,]   17    4
## [123,]   17    4
## [124,]   17    4
## [125,]   16    5
## [126,]   20    1
## [127,]   19    2
## [128,]   20    1
## [129,]   11   10
## [130,]   18    3
## [131,]   21    0
## [132,]   13    8
## [133,]   20    1
## [134,]   18    3
## [135,]   20    1
## [136,]   16    5
## [137,]   12    9
## [138,]    4   17
## [139,]   18    3
## [140,]   18    3
## [141,]   18    3
## [142,]   20    1
## [143,]    7   14
## [144,]    6   15
## [145,]   20    1
## [146,]   20    1
## [147,]   18    3
## [148,]   19    2
## [149,]   20    1
## [150,]   16    5
## [151,]   12    9
## [152,]   16    5
## [153,]    6   15
## [154,]   18    3
## [155,]   20    1
## [156,]   19    2
## [157,]   14    7
## [158,]   20    1
## [159,]   17    4
## [160,]   14    7
## [161,]   14    7
## [162,]   14    7
## [163,]    9   12
## [164,]   15    6
## [165,]   19    2
## [166,]   20    1
## [167,]    3   18
## [168,]   11   10
## [169,]   19    2
## [170,]   19    2
## [171,]    6   15
## [172,]   11   10
## [173,]   15    6
## [174,]   14    7
## [175,]   12    9
## [176,]   14    7
## [177,]   18    3
## [178,]   17    4
## [179,]   19    2
## [180,]   20    1
## [181,]   19    2
## [182,]   10   11
## [183,]   15    6
## [184,]   13    8
## [185,]   15    6
s_glmer = glmer(survival ~ Parental_treat * Temp * Control_CO + (1 | Maternal_GF) + (1 | Maternal_GM)   + (1 | Paternal_GF) + (1 | Paternal_GM), data = survival_prop , family="binomial") 

model analysis

summary(s_glmer)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: survival ~ Parental_treat * Temp * Control_CO + (1 | Maternal_GF) +  
##     (1 | Maternal_GM) + (1 | Paternal_GF) + (1 | Paternal_GM)
##    Data: survival_prop
## 
##      AIC      BIC   logLik deviance df.resid 
##   1135.0   1212.3   -543.5   1087.0      161 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.0849 -0.8397  0.3283  1.2176  3.0426 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  Paternal_GF (Intercept) 0.21485  0.4635  
##  Maternal_GF (Intercept) 0.09429  0.3071  
##  Paternal_GM (Intercept) 0.17269  0.4156  
##  Maternal_GM (Intercept) 0.02675  0.1636  
## Number of obs: 185, groups:  
## Paternal_GF, 5; Maternal_GF, 4; Paternal_GM, 3; Maternal_GM, 3
## 
## Fixed effects:
##                                               Estimate Std. Error z value
## (Intercept)                                    1.45947    0.41390   3.526
## Parental_treatCCCH                             0.45859    0.25540   1.796
## Parental_treatHHCC                            -0.20611    0.25070  -0.822
## Parental_treatCCHC                             0.08185    0.31322   0.261
## Parental_treatHHHC                            -0.02164    0.26628  -0.081
## Tempzero                                       0.56943    0.23556   2.417
## Control_COcontrol                              0.04772    0.21873   0.218
## Parental_treatCCCH:Tempzero                   -0.76890    0.34933  -2.201
## Parental_treatHHCC:Tempzero                   -0.01589    0.34411  -0.046
## Parental_treatCCHC:Tempzero                   -0.22324    0.37779  -0.591
## Parental_treatHHHC:Tempzero                   -0.51561    0.35819  -1.439
## Parental_treatCCCH:Control_COcontrol          -0.85715    0.32340  -2.650
## Parental_treatHHCC:Control_COcontrol          -0.54782    0.31002  -1.767
## Parental_treatCCHC:Control_COcontrol          -0.12243    0.34970  -0.350
## Parental_treatHHHC:Control_COcontrol          -0.41504    0.34894  -1.189
## Tempzero:Control_COcontrol                    -0.31266    0.32708  -0.956
## Parental_treatCCCH:Tempzero:Control_COcontrol  1.15148    0.47338   2.432
## Parental_treatHHCC:Tempzero:Control_COcontrol -0.27576    0.46502  -0.593
## Parental_treatCCHC:Tempzero:Control_COcontrol -0.10474    0.51491  -0.203
## Parental_treatHHHC:Tempzero:Control_COcontrol  0.55561    0.51081   1.088
##                                               Pr(>|z|)    
## (Intercept)                                   0.000422 ***
## Parental_treatCCCH                            0.072565 .  
## Parental_treatHHCC                            0.411018    
## Parental_treatCCHC                            0.793850    
## Parental_treatHHHC                            0.935226    
## Tempzero                                      0.015635 *  
## Control_COcontrol                             0.827290    
## Parental_treatCCCH:Tempzero                   0.027731 *  
## Parental_treatHHCC:Tempzero                   0.963162    
## Parental_treatCCHC:Tempzero                   0.554577    
## Parental_treatHHHC:Tempzero                   0.150014    
## Parental_treatCCCH:Control_COcontrol          0.008038 ** 
## Parental_treatHHCC:Control_COcontrol          0.077220 .  
## Parental_treatCCHC:Control_COcontrol          0.726259    
## Parental_treatHHHC:Control_COcontrol          0.234262    
## Tempzero:Control_COcontrol                    0.339117    
## Parental_treatCCCH:Tempzero:Control_COcontrol 0.014997 *  
## Parental_treatHHCC:Tempzero:Control_COcontrol 0.553185    
## Parental_treatCCHC:Tempzero:Control_COcontrol 0.838812    
## Parental_treatHHHC:Tempzero:Control_COcontrol 0.276718    
## ---
## 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
Anova(s_glmer)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: survival
##                                  Chisq Df Pr(>Chisq)    
## Parental_treat                 21.9836  4  0.0002019 ***
## Temp                           10.0559  1  0.0015186 ** 
## Control_CO                     21.5229  1  3.496e-06 ***
## Parental_treat:Temp             1.6272  4  0.8039006    
## Parental_treat:Control_CO       9.2115  4  0.0560242 .  
## Temp:Control_CO                 0.1219  1  0.7269540    
## Parental_treat:Temp:Control_CO 11.4530  4  0.0219181 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(DHARMa)
## This is DHARMa 0.4.6. For overview type '?DHARMa'. For recent changes, type news(package = 'DHARMa')
plot(s_glmer)

plot(simulateResiduals(s_glmer))

plot(emmeans(s_glmer, pairwise ~ Control_CO, type = "response"))
## NOTE: Results may be misleading due to involvement in interactions

emmeans(s_glmer, pairwise ~ Control_CO, type="response" )
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Control_CO  prob     SE  df asymp.LCL asymp.UCL
##  CO         0.839 0.0514 Inf     0.712     0.917
##  control    0.784 0.0644 Inf     0.633     0.884
## 
## Results are averaged over the levels of: Parental_treat, Temp 
## Confidence level used: 0.95 
## Intervals are back-transformed from the logit scale 
## 
## $contrasts
##  contrast     odds.ratio    SE  df null z.ratio p.value
##  CO / control       1.44 0.116 Inf    1   4.531  <.0001
## 
## Results are averaged over the levels of: Parental_treat, Temp 
## Tests are performed on the log odds ratio scale
plot(emmeans(s_glmer, pairwise ~ Parental_treat, type="response" ) )
## NOTE: Results may be misleading due to involvement in interactions

emmeans(s_glmer, pairwise ~ Parental_treat, type="response")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Parental_treat  prob     SE  df asymp.LCL asymp.UCL
##  CCCC           0.844 0.0517 Inf     0.715     0.921
##  CCCH           0.835 0.0550 Inf     0.698     0.917
##  HHCC           0.756 0.0738 Inf     0.586     0.872
##  CCHC           0.828 0.0574 Inf     0.686     0.914
##  HHHC           0.793 0.0645 Inf     0.639     0.892
## 
## Results are averaged over the levels of: Temp, Control_CO 
## Confidence level used: 0.95 
## Intervals are back-transformed from the logit scale 
## 
## $contrasts
##  contrast    odds.ratio    SE  df null z.ratio p.value
##  CCCC / CCCH      1.069 0.154 Inf    1   0.463  0.9906
##  CCCC / HHCC      1.745 0.285 Inf    1   3.416  0.0057
##  CCCC / CCHC      1.124 0.258 Inf    1   0.510  0.9864
##  CCCC / HHHC      1.416 0.222 Inf    1   2.217  0.1735
##  CCCH / HHCC      1.633 0.262 Inf    1   3.060  0.0188
##  CCCH / CCHC      1.052 0.247 Inf    1   0.216  0.9995
##  CCCH / HHHC      1.325 0.266 Inf    1   1.404  0.6249
##  HHCC / CCHC      0.644 0.124 Inf    1  -2.285  0.1497
##  HHCC / HHHC      0.812 0.158 Inf    1  -1.074  0.8199
##  CCHC / HHHC      1.260 0.287 Inf    1   1.015  0.8488
## 
## Results are averaged over the levels of: Temp, Control_CO 
## P value adjustment: tukey method for comparing a family of 5 estimates 
## Tests are performed on the log odds ratio scale
plot(emmeans(s_glmer, pairwise ~ Temp, type="response" ) )
## NOTE: Results may be misleading due to involvement in interactions

emmeans(s_glmer, pairwise ~ Temp, type="response")
## NOTE: Results may be misleading due to involvement in interactions
## $emmeans
##  Temp      prob     SE  df asymp.LCL asymp.UCL
##  elevated 0.794 0.0621 Inf     0.647     0.891
##  zero     0.831 0.0535 Inf     0.700     0.912
## 
## Results are averaged over the levels of: Parental_treat, Control_CO 
## Confidence level used: 0.95 
## Intervals are back-transformed from the logit scale 
## 
## $contrasts
##  contrast        odds.ratio     SE  df null z.ratio p.value
##  elevated / zero      0.786 0.0632 Inf    1  -2.999  0.0027
## 
## Results are averaged over the levels of: Parental_treat, Control_CO 
## Tests are performed on the log odds ratio scale
plot(emmeans(s_glmer, pairwise ~ Temp * Control_CO* Parental_treat, type="response") )

emmeans(s_glmer, pairwise ~ Temp * Control_CO* Parental_treat, type="response")
## $emmeans
##  Temp     Control_CO Parental_treat  prob     SE  df asymp.LCL asymp.UCL
##  elevated CO         CCCC           0.811 0.0633 Inf     0.657     0.906
##  zero     CO         CCCC           0.884 0.0435 Inf     0.768     0.946
##  elevated control    CCCC           0.819 0.0615 Inf     0.667     0.910
##  zero     control    CCCC           0.854 0.0522 Inf     0.720     0.930
##  elevated CO         CCCH           0.872 0.0484 Inf     0.744     0.941
##  zero     CO         CCCH           0.848 0.0552 Inf     0.707     0.928
##  elevated control    CCCH           0.752 0.0778 Inf     0.572     0.873
##  zero     control    CCCH           0.852 0.0539 Inf     0.713     0.930
##  elevated CO         HHCC           0.778 0.0734 Inf     0.604     0.890
##  zero     CO         HHCC           0.859 0.0529 Inf     0.721     0.935
##  elevated control    HHCC           0.680 0.0912 Inf     0.483     0.828
##  zero     control    HHCC           0.672 0.0928 Inf     0.473     0.824
##  elevated CO         CCHC           0.824 0.0635 Inf     0.665     0.917
##  zero     CO         CCHC           0.868 0.0513 Inf     0.732     0.941
##  elevated control    CCHC           0.813 0.0662 Inf     0.649     0.910
##  zero     control    CCHC           0.801 0.0689 Inf     0.633     0.904
##  elevated CO         HHHC           0.808 0.0664 Inf     0.645     0.907
##  zero     CO         HHHC           0.816 0.0635 Inf     0.660     0.911
##  elevated control    HHHC           0.745 0.0804 Inf     0.560     0.870
##  zero     control    HHHC           0.797 0.0707 Inf     0.625     0.902
## 
## Confidence level used: 0.95 
## Intervals are back-transformed from the logit scale 
## 
## $contrasts
##  contrast                                      odds.ratio     SE  df null
##  elevated CO CCCC / zero CO CCCC                    0.566 0.1333 Inf    1
##  elevated CO CCCC / elevated control CCCC           0.953 0.2085 Inf    1
##  elevated CO CCCC / zero control CCCC               0.737 0.1666 Inf    1
##  elevated CO CCCC / elevated CO CCCH                0.632 0.1615 Inf    1
##  elevated CO CCCC / zero CO CCCH                    0.772 0.1907 Inf    1
##  elevated CO CCCC / elevated control CCCH           1.420 0.3236 Inf    1
##  elevated CO CCCC / zero control CCCH               0.749 0.1833 Inf    1
##  elevated CO CCCC / elevated CO HHCC                1.229 0.3081 Inf    1
##  elevated CO CCCC / zero CO HHCC                    0.706 0.1902 Inf    1
##  elevated CO CCCC / elevated control HHCC           2.026 0.4907 Inf    1
##  elevated CO CCCC / zero control HHCC               2.098 0.5232 Inf    1
##  elevated CO CCCC / elevated CO CCHC                0.921 0.2886 Inf    1
##  elevated CO CCCC / zero CO CCHC                    0.652 0.2152 Inf    1
##  elevated CO CCCC / elevated control CCHC           0.993 0.3080 Inf    1
##  elevated CO CCCC / zero control CCHC               1.066 0.3279 Inf    1
##  elevated CO CCCC / elevated CO HHHC                1.022 0.2721 Inf    1
##  elevated CO CCCC / zero CO HHHC                    0.968 0.2469 Inf    1
##  elevated CO CCCC / elevated control HHHC           1.475 0.3819 Inf    1
##  elevated CO CCCC / zero control HHHC               1.097 0.3101 Inf    1
##  zero CO CCCC / elevated control CCCC               1.685 0.3986 Inf    1
##  zero CO CCCC / zero control CCCC                   1.303 0.3170 Inf    1
##  zero CO CCCC / elevated CO CCCH                    1.117 0.3031 Inf    1
##  zero CO CCCC / zero CO CCCH                        1.364 0.3595 Inf    1
##  zero CO CCCC / elevated control CCCH               2.510 0.6164 Inf    1
##  zero CO CCCC / zero control CCCH                   1.324 0.3460 Inf    1
##  zero CO CCCC / elevated CO HHCC                    2.172 0.5789 Inf    1
##  zero CO CCCC / zero CO HHCC                        1.249 0.3547 Inf    1
##  zero CO CCCC / elevated control HHCC               3.581 0.9259 Inf    1
##  zero CO CCCC / zero control HHCC                   3.708 0.9840 Inf    1
##  zero CO CCCC / elevated CO CCHC                    1.628 0.5309 Inf    1
##  zero CO CCCC / zero CO CCHC                        1.152 0.3943 Inf    1
##  zero CO CCCC / elevated control CCHC               1.755 0.5671 Inf    1
##  zero CO CCCC / zero control CCHC                   1.884 0.6041 Inf    1
##  zero CO CCCC / elevated CO HHHC                    1.806 0.5066 Inf    1
##  zero CO CCCC / zero CO HHHC                        1.711 0.4616 Inf    1
##  zero CO CCCC / elevated control HHHC               2.608 0.7132 Inf    1
##  zero CO CCCC / zero control HHHC                   1.938 0.5740 Inf    1
##  elevated control CCCC / zero control CCCC          0.774 0.1755 Inf    1
##  elevated control CCCC / elevated CO CCCH           0.663 0.1700 Inf    1
##  elevated control CCCC / zero CO CCCH               0.809 0.2009 Inf    1
##  elevated control CCCC / elevated control CCCH      1.490 0.3411 Inf    1
##  elevated control CCCC / zero control CCCH          0.786 0.1931 Inf    1
##  elevated control CCCC / elevated CO HHCC           1.289 0.3244 Inf    1
##  elevated control CCCC / zero CO HHCC               0.741 0.2002 Inf    1
##  elevated control CCCC / elevated control HHCC      2.125 0.5168 Inf    1
##  elevated control CCCC / zero control HHCC          2.201 0.5510 Inf    1
##  elevated control CCCC / elevated CO CCHC           0.966 0.3035 Inf    1
##  elevated control CCCC / zero CO CCHC               0.684 0.2262 Inf    1
##  elevated control CCCC / elevated control CCHC      1.041 0.3239 Inf    1
##  elevated control CCCC / zero control CCHC          1.118 0.3448 Inf    1
##  elevated control CCCC / elevated CO HHHC           1.072 0.2863 Inf    1
##  elevated control CCCC / zero CO HHHC               1.016 0.2598 Inf    1
##  elevated control CCCC / elevated control HHHC      1.548 0.4019 Inf    1
##  elevated control CCCC / zero control HHHC          1.150 0.3261 Inf    1
##  zero control CCCC / elevated CO CCCH               0.857 0.2252 Inf    1
##  zero control CCCC / zero CO CCCH                   1.046 0.2666 Inf    1
##  zero control CCCC / elevated control CCCH          1.926 0.4546 Inf    1
##  zero control CCCC / zero control CCCH              1.016 0.2564 Inf    1
##  zero control CCCC / elevated CO HHCC               1.666 0.4299 Inf    1
##  zero control CCCC / zero CO HHCC                   0.958 0.2644 Inf    1
##  zero control CCCC / elevated control HHCC          2.748 0.6860 Inf    1
##  zero control CCCC / zero control HHCC              2.845 0.7303 Inf    1
##  zero control CCCC / elevated CO CCHC               1.249 0.3986 Inf    1
##  zero control CCCC / zero CO CCHC                   0.884 0.2966 Inf    1
##  zero control CCCC / elevated control CCHC          1.346 0.4256 Inf    1
##  zero control CCCC / zero control CCHC              1.446 0.4532 Inf    1
##  zero control CCCC / elevated CO HHHC               1.386 0.3779 Inf    1
##  zero control CCCC / zero CO HHHC                   1.313 0.3435 Inf    1
##  zero control CCCC / elevated control HHHC          2.001 0.5311 Inf    1
##  zero control CCCC / zero control HHHC              1.487 0.4294 Inf    1
##  elevated CO CCCH / zero CO CCCH                    1.221 0.3149 Inf    1
##  elevated CO CCCH / elevated control CCCH           2.247 0.5352 Inf    1
##  elevated CO CCCH / zero control CCCH               1.185 0.3019 Inf    1
##  elevated CO CCCH / elevated CO HHCC                1.944 0.5256 Inf    1
##  elevated CO CCCH / zero CO HHCC                    1.118 0.3216 Inf    1
##  elevated CO CCCH / elevated control HHCC           3.205 0.8409 Inf    1
##  elevated CO CCCH / zero control HHCC               3.319 0.8925 Inf    1
##  elevated CO CCCH / elevated CO CCHC                1.458 0.4866 Inf    1
##  elevated CO CCCH / zero CO CCHC                    1.031 0.3607 Inf    1
##  elevated CO CCCH / elevated control CCHC           1.571 0.5199 Inf    1
##  elevated CO CCCH / zero control CCHC               1.687 0.5540 Inf    1
##  elevated CO CCCH / elevated CO HHHC                1.616 0.5036 Inf    1
##  elevated CO CCCH / zero CO HHHC                    1.532 0.4634 Inf    1
##  elevated CO CCCH / elevated control HHHC           2.334 0.7122 Inf    1
##  elevated CO CCCH / zero control HHHC               1.735 0.5657 Inf    1
##  zero CO CCCH / elevated control CCCH               1.840 0.4218 Inf    1
##  zero CO CCCH / zero control CCCH                   0.971 0.2392 Inf    1
##  zero CO CCCH / elevated CO HHCC                    1.592 0.4181 Inf    1
##  zero CO CCCH / zero CO HHCC                        0.915 0.2567 Inf    1
##  zero CO CCCH / elevated control HHCC               2.626 0.6676 Inf    1
##  zero CO CCCH / zero control HHCC                   2.719 0.7097 Inf    1
##  zero CO CCCH / elevated CO CCHC                    1.194 0.3910 Inf    1
##  zero CO CCCH / zero CO CCHC                        0.845 0.2904 Inf    1
##  zero CO CCCH / elevated control CCHC               1.287 0.4176 Inf    1
##  zero CO CCCH / zero control CCHC                   1.382 0.4449 Inf    1
##  zero CO CCCH / elevated CO HHHC                    1.324 0.4036 Inf    1
##  zero CO CCCH / zero CO HHHC                        1.255 0.3708 Inf    1
##  zero CO CCCH / elevated control HHHC               1.912 0.5701 Inf    1
##  zero CO CCCH / zero control HHHC                   1.421 0.4542 Inf    1
##  elevated control CCCH / zero control CCCH          0.528 0.1186 Inf    1
##  elevated control CCCH / elevated CO HHCC           0.865 0.2101 Inf    1
##  elevated control CCCH / zero CO HHCC               0.497 0.1304 Inf    1
##  elevated control CCCH / elevated control HHCC      1.427 0.3335 Inf    1
##  elevated control CCCH / zero control HHCC          1.477 0.3564 Inf    1
##  elevated control CCCH / elevated CO CCHC           0.649 0.2020 Inf    1
##  elevated control CCCH / zero CO CCHC               0.459 0.1508 Inf    1
##  elevated control CCCH / elevated control CCHC      0.699 0.2156 Inf    1
##  elevated control CCCH / zero control CCHC          0.751 0.2294 Inf    1
##  elevated control CCCH / elevated CO HHHC           0.720 0.2076 Inf    1
##  elevated control CCCH / zero CO HHHC               0.682 0.1902 Inf    1
##  elevated control CCCH / elevated control HHHC      1.039 0.2925 Inf    1
##  elevated control CCCH / zero control HHHC          0.772 0.2350 Inf    1
##  zero control CCCH / elevated CO HHCC               1.640 0.4247 Inf    1
##  zero control CCCH / zero CO HHCC                   0.943 0.2612 Inf    1
##  zero control CCCH / elevated control HHCC          2.704 0.6774 Inf    1
##  zero control CCCH / zero control HHCC              2.800 0.7209 Inf    1
##  zero control CCCH / elevated CO CCHC               1.230 0.3988 Inf    1
##  zero control CCCH / zero CO CCHC                   0.870 0.2964 Inf    1
##  zero control CCCH / elevated control CCHC          1.325 0.4258 Inf    1
##  zero control CCCH / zero control CCHC              1.423 0.4536 Inf    1
##  zero control CCCH / elevated CO HHHC               1.364 0.4121 Inf    1
##  zero control CCCH / zero CO HHHC                   1.292 0.3786 Inf    1
##  zero control CCCH / elevated control HHHC          1.969 0.5819 Inf    1
##  zero control CCCH / zero control HHHC              1.463 0.4643 Inf    1
##  elevated CO HHCC / zero CO HHCC                    0.575 0.1442 Inf    1
##  elevated CO HHCC / elevated control HHCC           1.649 0.3623 Inf    1
##  elevated CO HHCC / zero control HHCC               1.707 0.3859 Inf    1
##  elevated CO HHCC / elevated CO CCHC                0.750 0.2198 Inf    1
##  elevated CO HHCC / zero CO CCHC                    0.530 0.1651 Inf    1
##  elevated CO HHCC / elevated control CCHC           0.808 0.2342 Inf    1
##  elevated CO HHCC / zero control CCHC               0.868 0.2490 Inf    1
##  elevated CO HHCC / elevated CO HHHC                0.832 0.2447 Inf    1
##  elevated CO HHCC / zero CO HHHC                    0.788 0.2243 Inf    1
##  elevated CO HHCC / elevated control HHHC           1.201 0.3445 Inf    1
##  elevated CO HHCC / zero control HHHC               0.892 0.2734 Inf    1
##  zero CO HHCC / elevated control HHCC               2.868 0.6924 Inf    1
##  zero CO HHCC / zero control HHCC                   2.970 0.7346 Inf    1
##  zero CO HHCC / elevated CO CCHC                    1.304 0.4051 Inf    1
##  zero CO HHCC / zero CO CCHC                        0.923 0.3024 Inf    1
##  zero CO HHCC / elevated control CCHC               1.405 0.4322 Inf    1
##  zero CO HHCC / zero control CCHC                   1.509 0.4599 Inf    1
##  zero CO HHCC / elevated CO HHHC                    1.446 0.4488 Inf    1
##  zero CO HHCC / zero CO HHHC                        1.371 0.4129 Inf    1
##  zero CO HHCC / elevated control HHHC               2.088 0.6335 Inf    1
##  zero CO HHCC / zero control HHHC                   1.552 0.4995 Inf    1
##  elevated control HHCC / zero control HHCC          1.035 0.2228 Inf    1
##  elevated control HHCC / elevated CO CCHC           0.455 0.1291 Inf    1
##  elevated control HHCC / zero CO CCHC               0.322 0.0973 Inf    1
##  elevated control HHCC / elevated control CCHC      0.490 0.1374 Inf    1
##  elevated control HHCC / zero control CCHC          0.526 0.1460 Inf    1
##  elevated control HHCC / elevated CO HHHC           0.504 0.1447 Inf    1
##  elevated control HHCC / zero CO HHHC               0.478 0.1324 Inf    1
##  elevated control HHCC / elevated control HHHC      0.728 0.2034 Inf    1
##  elevated control HHCC / zero control HHHC          0.541 0.1619 Inf    1
##  zero control HHCC / elevated CO CCHC               0.439 0.1245 Inf    1
##  zero control HHCC / zero CO CCHC                   0.311 0.0939 Inf    1
##  zero control HHCC / elevated control CCHC          0.473 0.1326 Inf    1
##  zero control HHCC / zero control CCHC              0.508 0.1408 Inf    1
##  zero control HHCC / elevated CO HHHC               0.487 0.1430 Inf    1
##  zero control HHCC / zero CO HHHC                   0.462 0.1312 Inf    1
##  zero control HHCC / elevated control HHHC          0.703 0.2013 Inf    1
##  zero control HHCC / zero control HHHC              0.523 0.1599 Inf    1
##  elevated CO CCHC / zero CO CCHC                    0.707 0.2089 Inf    1
##  elevated CO CCHC / elevated control CCHC           1.078 0.2940 Inf    1
##  elevated CO CCHC / zero control CCHC               1.157 0.3122 Inf    1
##  elevated CO CCHC / elevated CO HHHC                1.109 0.3675 Inf    1
##  elevated CO CCHC / zero CO HHHC                    1.051 0.3422 Inf    1
##  elevated CO CCHC / elevated control HHHC           1.601 0.5185 Inf    1
##  elevated CO CCHC / zero control HHHC               1.190 0.4041 Inf    1
##  zero CO CCHC / elevated control CCHC               1.523 0.4451 Inf    1
##  zero CO CCHC / zero control CCHC                   1.636 0.4733 Inf    1
##  zero CO CCHC / elevated CO HHHC                    1.568 0.5445 Inf    1
##  zero CO CCHC / zero CO HHHC                        1.486 0.5078 Inf    1
##  zero CO CCHC / elevated control HHHC               2.264 0.7699 Inf    1
##  zero CO CCHC / zero control HHHC                   1.682 0.5975 Inf    1
##  elevated control CCHC / zero control CCHC          1.074 0.2860 Inf    1
##  elevated control CCHC / elevated CO HHHC           1.029 0.3382 Inf    1
##  elevated control CCHC / zero CO HHHC               0.975 0.3148 Inf    1
##  elevated control CCHC / elevated control HHHC      1.486 0.4769 Inf    1
##  elevated control CCHC / zero control HHHC          1.104 0.3720 Inf    1
##  zero control CCHC / elevated CO HHHC               0.958 0.3125 Inf    1
##  zero control CCHC / zero CO HHHC                   0.908 0.2908 Inf    1
##  zero control CCHC / elevated control HHHC          1.384 0.4406 Inf    1
##  zero control CCHC / zero control HHHC              1.029 0.3439 Inf    1
##  elevated CO HHHC / zero CO HHHC                    0.948 0.2558 Inf    1
##  elevated CO HHHC / elevated control HHHC           1.444 0.3925 Inf    1
##  elevated CO HHHC / zero control HHHC               1.073 0.3141 Inf    1
##  zero CO HHHC / elevated control HHHC               1.524 0.3993 Inf    1
##  zero CO HHHC / zero control HHHC                   1.132 0.3207 Inf    1
##  elevated control HHHC / zero control HHHC          0.743 0.2120 Inf    1
##  z.ratio p.value
##   -2.417  0.6483
##   -0.218  1.0000
##   -1.348  0.9988
##   -1.796  0.9638
##   -1.048  1.0000
##    1.540  0.9933
##   -1.179  0.9998
##    0.822  1.0000
##   -1.290  0.9993
##    2.916  0.2795
##    2.972  0.2469
##   -0.261  1.0000
##   -1.297  0.9993
##   -0.023  1.0000
##    0.208  1.0000
##    0.081  1.0000
##   -0.126  1.0000
##    1.503  0.9950
##    0.326  1.0000
##    2.205  0.7977
##    1.089  0.9999
##    0.408  1.0000
##    1.177  0.9998
##    3.747  0.0249
##    1.075  1.0000
##    2.909  0.2838
##    0.782  1.0000
##    4.934  0.0001
##    4.939  0.0001
##    1.495  0.9953
##    0.413  1.0000
##    1.740  0.9737
##    1.976  0.9126
##    2.107  0.8539
##    1.992  0.9065
##    3.504  0.0568
##    2.234  0.7795
##   -1.131  0.9999
##   -1.602  0.9893
##   -0.852  1.0000
##    1.741  0.9736
##   -0.980  1.0000
##    1.009  1.0000
##   -1.109  0.9999
##    3.100  0.1812
##    3.151  0.1592
##   -0.109  1.0000
##   -1.150  0.9999
##    0.130  1.0000
##    0.363  1.0000
##    0.260  1.0000
##    0.061  1.0000
##    1.681  0.9817
##    0.493  1.0000
##   -0.586  1.0000
##    0.178  1.0000
##    2.776  0.3722
##    0.063  1.0000
##    1.979  0.9113
##   -0.156  1.0000
##    4.048  0.0080
##    4.073  0.0072
##    0.698  1.0000
##   -0.368  1.0000
##    0.941  1.0000
##    1.176  0.9998
##    1.196  0.9998
##    1.041  1.0000
##    2.612  0.4954
##    1.374  0.9984
##    0.773  1.0000
##    3.398  0.0791
##    0.668  1.0000
##    2.458  0.6167
##    0.386  1.0000
##    4.440  0.0015
##    4.461  0.0014
##    1.129  0.9999
##    0.087  1.0000
##    1.364  0.9985
##    1.591  0.9901
##    1.541  0.9932
##    1.410  0.9978
##    2.778  0.3712
##    1.689  0.9808
##    2.661  0.4574
##   -0.119  1.0000
##    1.772  0.9683
##   -0.315  1.0000
##    3.797  0.0209
##    3.832  0.0183
##    0.541  1.0000
##   -0.491  1.0000
##    0.776  1.0000
##    1.004  1.0000
##    0.921  1.0000
##    0.768  1.0000
##    2.173  0.8170
##    1.099  0.9999
##   -2.843  0.3260
##   -0.596  1.0000
##   -2.664  0.4551
##    1.520  0.9942
##    1.618  0.9881
##   -1.389  0.9981
##   -2.371  0.6837
##   -1.161  0.9998
##   -0.938  1.0000
##   -1.141  0.9999
##   -1.373  0.9984
##    0.135  1.0000
##   -0.850  1.0000
##    1.910  0.9351
##   -0.213  1.0000
##    3.971  0.0108
##    3.999  0.0097
##    0.637  1.0000
##   -0.409  1.0000
##    0.875  1.0000
##    1.106  0.9999
##    1.026  1.0000
##    0.875  1.0000
##    2.292  0.7403
##    1.200  0.9998
##   -2.207  0.7968
##    2.276  0.7513
##    2.367  0.6864
##   -0.982  1.0000
##   -2.037  0.8873
##   -0.736  1.0000
##   -0.495  1.0000
##   -0.627  1.0000
##   -0.837  1.0000
##    0.637  1.0000
##   -0.372  1.0000
##    4.364  0.0021
##    4.401  0.0018
##    0.855  1.0000
##   -0.246  1.0000
##    1.107  0.9999
##    1.350  0.9987
##    1.190  0.9998
##    1.047  1.0000
##    2.428  0.6405
##    1.366  0.9985
##    0.162  1.0000
##   -2.777  0.3718
##   -3.749  0.0248
##   -2.544  0.5494
##   -2.314  0.7247
##   -2.386  0.6718
##   -2.665  0.4548
##   -1.136  0.9999
##   -2.052  0.8807
##   -2.903  0.2877
##   -3.869  0.0160
##   -2.671  0.4499
##   -2.443  0.6285
##   -2.450  0.6230
##   -2.721  0.4124
##   -1.230  0.9996
##   -2.121  0.8463
##   -1.172  0.9998
##    0.274  1.0000
##    0.541  1.0000
##    0.312  1.0000
##    0.153  1.0000
##    1.454  0.9967
##    0.513  1.0000
##    1.441  0.9970
##    1.701  0.9793
##    1.295  0.9993
##    1.158  0.9999
##    2.402  0.6598
##    1.465  0.9963
##    0.267  1.0000
##    0.088  1.0000
##   -0.078  1.0000
##    1.234  0.9996
##    0.295  1.0000
##   -0.130  1.0000
##   -0.301  1.0000
##    1.020  1.0000
##    0.084  1.0000
##   -0.199  1.0000
##    1.351  0.9987
##    0.241  1.0000
##    1.607  0.9889
##    0.439  1.0000
##   -1.040  1.0000
## 
## P value adjustment: tukey method for comparing a family of 20 estimates 
## Tests are performed on the log odds ratio scale
plot(emmeans(s_glmer, pairwise ~ Temp * Control_CO* Parental_treat) )

emmeans(s_glmer, pairwise ~ Temp * Control_CO* Parental_treat)
## $emmeans
##  Temp     Control_CO Parental_treat emmean    SE  df asymp.LCL asymp.UCL
##  elevated CO         CCCC            1.459 0.414 Inf    0.6482      2.27
##  zero     CO         CCCC            2.029 0.424 Inf    1.1985      2.86
##  elevated control    CCCC            1.507 0.414 Inf    0.6948      2.32
##  zero     control    CCCC            1.764 0.418 Inf    0.9440      2.58
##  elevated CO         CCCH            1.918 0.433 Inf    1.0687      2.77
##  zero     CO         CCCH            1.719 0.428 Inf    0.8789      2.56
##  elevated control    CCCH            1.109 0.417 Inf    0.2917      1.93
##  zero     control    CCCH            1.748 0.427 Inf    0.9116      2.58
##  elevated CO         HHCC            1.253 0.425 Inf    0.4210      2.09
##  zero     CO         HHCC            1.807 0.436 Inf    0.9514      2.66
##  elevated control    HHCC            0.753 0.419 Inf   -0.0676      1.57
##  zero     control    HHCC            0.718 0.421 Inf   -0.1070      1.54
##  elevated CO         CCHC            1.541 0.437 Inf    0.6850      2.40
##  zero     CO         CCHC            1.888 0.449 Inf    1.0070      2.77
##  elevated control    CCHC            1.467 0.435 Inf    0.6145      2.32
##  zero     control    CCHC            1.395 0.433 Inf    0.5471      2.24
##  elevated CO         HHHC            1.438 0.428 Inf    0.5983      2.28
##  zero     CO         HHHC            1.492 0.423 Inf    0.6621      2.32
##  elevated control    HHHC            1.071 0.423 Inf    0.2414      1.90
##  zero     control    HHHC            1.367 0.437 Inf    0.5106      2.22
## 
## Results are given on the logit (not the response) scale. 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast                                      estimate    SE  df z.ratio
##  elevated CO CCCC - zero CO CCCC               -0.56943 0.236 Inf  -2.417
##  elevated CO CCCC - elevated control CCCC      -0.04772 0.219 Inf  -0.218
##  elevated CO CCCC - zero control CCCC          -0.30450 0.226 Inf  -1.348
##  elevated CO CCCC - elevated CO CCCH           -0.45859 0.255 Inf  -1.796
##  elevated CO CCCC - zero CO CCCH               -0.25912 0.247 Inf  -1.048
##  elevated CO CCCC - elevated control CCCH       0.35083 0.228 Inf   1.540
##  elevated CO CCCC - zero control CCCH          -0.28852 0.245 Inf  -1.179
##  elevated CO CCCC - elevated CO HHCC            0.20611 0.251 Inf   0.822
##  elevated CO CCCC - zero CO HHCC               -0.34743 0.269 Inf  -1.290
##  elevated CO CCCC - elevated control HHCC       0.70620 0.242 Inf   2.916
##  elevated CO CCCC - zero control HHCC           0.74108 0.249 Inf   2.972
##  elevated CO CCCC - elevated CO CCHC           -0.08185 0.313 Inf  -0.261
##  elevated CO CCCC - zero CO CCHC               -0.42804 0.330 Inf  -1.297
##  elevated CO CCCC - elevated control CCHC      -0.00714 0.310 Inf  -0.023
##  elevated CO CCCC - zero control CCHC           0.06407 0.308 Inf   0.208
##  elevated CO CCCC - elevated CO HHHC            0.02164 0.266 Inf   0.081
##  elevated CO CCCC - zero CO HHHC               -0.03218 0.255 Inf  -0.126
##  elevated CO CCCC - elevated control HHHC       0.38896 0.259 Inf   1.503
##  elevated CO CCCC - zero control HHHC           0.09219 0.283 Inf   0.326
##  zero CO CCCC - elevated control CCCC           0.52171 0.237 Inf   2.205
##  zero CO CCCC - zero control CCCC               0.26494 0.243 Inf   1.089
##  zero CO CCCC - elevated CO CCCH                0.11084 0.271 Inf   0.408
##  zero CO CCCC - zero CO CCCH                    0.31031 0.264 Inf   1.177
##  zero CO CCCC - elevated control CCCH           0.92026 0.246 Inf   3.747
##  zero CO CCCC - zero control CCCH               0.28091 0.261 Inf   1.075
##  zero CO CCCC - elevated CO HHCC                0.77554 0.267 Inf   2.909
##  zero CO CCCC - zero CO HHCC                    0.22200 0.284 Inf   0.782
##  zero CO CCCC - elevated control HHCC           1.27563 0.259 Inf   4.934
##  zero CO CCCC - zero control HHCC               1.31051 0.265 Inf   4.939
##  zero CO CCCC - elevated CO CCHC                0.48758 0.326 Inf   1.495
##  zero CO CCCC - zero CO CCHC                    0.14139 0.342 Inf   0.413
##  zero CO CCCC - elevated control CCHC           0.56229 0.323 Inf   1.740
##  zero CO CCCC - zero control CCHC               0.63350 0.321 Inf   1.976
##  zero CO CCCC - elevated CO HHHC                0.59107 0.281 Inf   2.107
##  zero CO CCCC - zero CO HHHC                    0.53725 0.270 Inf   1.992
##  zero CO CCCC - elevated control HHHC           0.95839 0.274 Inf   3.504
##  zero CO CCCC - zero control HHHC               0.66162 0.296 Inf   2.234
##  elevated control CCCC - zero control CCCC     -0.25677 0.227 Inf  -1.131
##  elevated control CCCC - elevated CO CCCH      -0.41087 0.256 Inf  -1.602
##  elevated control CCCC - zero CO CCCH          -0.21140 0.248 Inf  -0.852
##  elevated control CCCC - elevated control CCCH  0.39855 0.229 Inf   1.741
##  elevated control CCCC - zero control CCCH     -0.24080 0.246 Inf  -0.980
##  elevated control CCCC - elevated CO HHCC       0.25383 0.252 Inf   1.009
##  elevated control CCCC - zero CO HHCC          -0.29971 0.270 Inf  -1.109
##  elevated control CCCC - elevated control HHCC  0.75392 0.243 Inf   3.100
##  elevated control CCCC - zero control HHCC      0.78880 0.250 Inf   3.151
##  elevated control CCCC - elevated CO CCHC      -0.03413 0.314 Inf  -0.109
##  elevated control CCCC - zero CO CCHC          -0.38032 0.331 Inf  -1.150
##  elevated control CCCC - elevated control CCHC  0.04058 0.311 Inf   0.130
##  elevated control CCCC - zero control CCHC      0.11179 0.308 Inf   0.363
##  elevated control CCCC - elevated CO HHHC       0.06936 0.267 Inf   0.260
##  elevated control CCCC - zero CO HHHC           0.01554 0.256 Inf   0.061
##  elevated control CCCC - elevated control HHHC  0.43668 0.260 Inf   1.681
##  elevated control CCCC - zero control HHHC      0.13991 0.284 Inf   0.493
##  zero control CCCC - elevated CO CCCH          -0.15410 0.263 Inf  -0.586
##  zero control CCCC - zero CO CCCH               0.04537 0.255 Inf   0.178
##  zero control CCCC - elevated control CCCH      0.65533 0.236 Inf   2.776
##  zero control CCCC - zero control CCCH          0.01598 0.252 Inf   0.063
##  zero control CCCC - elevated CO HHCC           0.51060 0.258 Inf   1.979
##  zero control CCCC - zero CO HHCC              -0.04294 0.276 Inf  -0.156
##  zero control CCCC - elevated control HHCC      1.01070 0.250 Inf   4.048
##  zero control CCCC - zero control HHCC          1.04557 0.257 Inf   4.073
##  zero control CCCC - elevated CO CCHC           0.22265 0.319 Inf   0.698
##  zero control CCCC - zero CO CCHC              -0.12355 0.336 Inf  -0.368
##  zero control CCCC - elevated control CCHC      0.29736 0.316 Inf   0.941
##  zero control CCCC - zero control CCHC          0.36856 0.314 Inf   1.176
##  zero control CCCC - elevated CO HHHC           0.32614 0.273 Inf   1.196
##  zero control CCCC - zero CO HHHC               0.27232 0.262 Inf   1.041
##  zero control CCCC - elevated control HHHC      0.69346 0.265 Inf   2.612
##  zero control CCCC - zero control HHHC          0.39668 0.289 Inf   1.374
##  elevated CO CCCH - zero CO CCCH                0.19947 0.258 Inf   0.773
##  elevated CO CCCH - elevated control CCCH       0.80942 0.238 Inf   3.398
##  elevated CO CCCH - zero control CCCH           0.17007 0.255 Inf   0.668
##  elevated CO CCCH - elevated CO HHCC            0.66470 0.270 Inf   2.458
##  elevated CO CCCH - zero CO HHCC                0.11116 0.288 Inf   0.386
##  elevated CO CCCH - elevated control HHCC       1.16479 0.262 Inf   4.440
##  elevated CO CCCH - zero control HHCC           1.19967 0.269 Inf   4.461
##  elevated CO CCCH - elevated CO CCHC            0.37674 0.334 Inf   1.129
##  elevated CO CCCH - zero CO CCHC                0.03055 0.350 Inf   0.087
##  elevated CO CCCH - elevated control CCHC       0.45145 0.331 Inf   1.364
##  elevated CO CCCH - zero control CCHC           0.52266 0.328 Inf   1.591
##  elevated CO CCCH - elevated CO HHHC            0.48023 0.312 Inf   1.541
##  elevated CO CCCH - zero CO HHHC                0.42641 0.303 Inf   1.410
##  elevated CO CCCH - elevated control HHHC       0.84755 0.305 Inf   2.778
##  elevated CO CCCH - zero control HHHC           0.55078 0.326 Inf   1.689
##  zero CO CCCH - elevated control CCCH           0.60995 0.229 Inf   2.661
##  zero CO CCCH - zero control CCCH              -0.02940 0.246 Inf  -0.119
##  zero CO CCCH - elevated CO HHCC                0.46523 0.263 Inf   1.772
##  zero CO CCCH - zero CO HHCC                   -0.08831 0.280 Inf  -0.315
##  zero CO CCCH - elevated control HHCC           0.96532 0.254 Inf   3.797
##  zero CO CCCH - zero control HHCC               1.00020 0.261 Inf   3.832
##  zero CO CCCH - elevated CO CCHC                0.17727 0.327 Inf   0.541
##  zero CO CCCH - zero CO CCHC                   -0.16892 0.344 Inf  -0.491
##  zero CO CCCH - elevated control CCHC           0.25198 0.325 Inf   0.776
##  zero CO CCCH - zero control CCHC               0.32319 0.322 Inf   1.004
##  zero CO CCCH - elevated CO HHHC                0.28076 0.305 Inf   0.921
##  zero CO CCCH - zero CO HHHC                    0.22694 0.296 Inf   0.768
##  zero CO CCCH - elevated control HHHC           0.64808 0.298 Inf   2.173
##  zero CO CCCH - zero control HHHC               0.35131 0.320 Inf   1.099
##  elevated control CCCH - zero control CCCH     -0.63935 0.225 Inf  -2.843
##  elevated control CCCH - elevated CO HHCC      -0.14473 0.243 Inf  -0.596
##  elevated control CCCH - zero CO HHCC          -0.69826 0.262 Inf  -2.664
##  elevated control CCCH - elevated control HHCC  0.35537 0.234 Inf   1.520
##  elevated control CCCH - zero control HHCC      0.39025 0.241 Inf   1.618
##  elevated control CCCH - elevated CO CCHC      -0.43268 0.311 Inf  -1.389
##  elevated control CCCH - zero CO CCHC          -0.77887 0.329 Inf  -2.371
##  elevated control CCCH - elevated control CCHC -0.35797 0.308 Inf  -1.161
##  elevated control CCCH - zero control CCHC     -0.28677 0.306 Inf  -0.938
##  elevated control CCCH - elevated CO HHHC      -0.32919 0.289 Inf  -1.141
##  elevated control CCCH - zero CO HHHC          -0.38301 0.279 Inf  -1.373
##  elevated control CCCH - elevated control HHHC  0.03813 0.282 Inf   0.135
##  elevated control CCCH - zero control HHHC     -0.25865 0.304 Inf  -0.850
##  zero control CCCH - elevated CO HHCC           0.49463 0.259 Inf   1.910
##  zero control CCCH - zero CO HHCC              -0.05891 0.277 Inf  -0.213
##  zero control CCCH - elevated control HHCC      0.99472 0.251 Inf   3.971
##  zero control CCCH - zero control HHCC          1.02960 0.257 Inf   3.999
##  zero control CCCH - elevated CO CCHC           0.20667 0.324 Inf   0.637
##  zero control CCCH - zero CO CCHC              -0.13952 0.341 Inf  -0.409
##  zero control CCCH - elevated control CCHC      0.28138 0.321 Inf   0.875
##  zero control CCCH - zero control CCHC          0.35259 0.319 Inf   1.106
##  zero control CCCH - elevated CO HHHC           0.31016 0.302 Inf   1.026
##  zero control CCCH - zero CO HHHC               0.25634 0.293 Inf   0.875
##  zero control CCCH - elevated control HHHC      0.67748 0.296 Inf   2.292
##  zero control CCCH - zero control HHHC          0.38071 0.317 Inf   1.200
##  elevated CO HHCC - zero CO HHCC               -0.55354 0.251 Inf  -2.207
##  elevated CO HHCC - elevated control HHCC       0.50010 0.220 Inf   2.276
##  elevated CO HHCC - zero control HHCC           0.53497 0.226 Inf   2.367
##  elevated CO HHCC - elevated CO CCHC           -0.28796 0.293 Inf  -0.982
##  elevated CO HHCC - zero CO CCHC               -0.63415 0.311 Inf  -2.037
##  elevated CO HHCC - elevated control CCHC      -0.21324 0.290 Inf  -0.736
##  elevated CO HHCC - zero control CCHC          -0.14204 0.287 Inf  -0.495
##  elevated CO HHCC - elevated CO HHHC           -0.18446 0.294 Inf  -0.627
##  elevated CO HHCC - zero CO HHHC               -0.23828 0.285 Inf  -0.837
##  elevated CO HHCC - elevated control HHHC       0.18286 0.287 Inf   0.637
##  elevated CO HHCC - zero control HHHC          -0.11392 0.306 Inf  -0.372
##  zero CO HHCC - elevated control HHCC           1.05363 0.241 Inf   4.364
##  zero CO HHCC - zero control HHCC               1.08851 0.247 Inf   4.401
##  zero CO HHCC - elevated CO CCHC                0.26558 0.311 Inf   0.855
##  zero CO HHCC - zero CO CCHC                   -0.08061 0.328 Inf  -0.246
##  zero CO HHCC - elevated control CCHC           0.34029 0.308 Inf   1.107
##  zero CO HHCC - zero control CCHC               0.41150 0.305 Inf   1.350
##  zero CO HHCC - elevated CO HHHC                0.36907 0.310 Inf   1.190
##  zero CO HHCC - zero CO HHHC                    0.31525 0.301 Inf   1.047
##  zero CO HHCC - elevated control HHHC           0.73639 0.303 Inf   2.428
##  zero CO HHCC - zero control HHHC               0.43962 0.322 Inf   1.366
##  elevated control HHCC - zero control HHCC      0.03488 0.215 Inf   0.162
##  elevated control HHCC - elevated CO CCHC      -0.78805 0.284 Inf  -2.777
##  elevated control HHCC - zero CO CCHC          -1.13424 0.303 Inf  -3.749
##  elevated control HHCC - elevated control CCHC -0.71334 0.280 Inf  -2.544
##  elevated control HHCC - zero control CCHC     -0.64213 0.277 Inf  -2.314
##  elevated control HHCC - elevated CO HHHC      -0.68456 0.287 Inf  -2.386
##  elevated control HHCC - zero CO HHHC          -0.73838 0.277 Inf  -2.665
##  elevated control HHCC - elevated control HHHC -0.31724 0.279 Inf  -1.136
##  elevated control HHCC - zero control HHHC     -0.61401 0.299 Inf  -2.052
##  zero control HHCC - elevated CO CCHC          -0.82293 0.283 Inf  -2.903
##  zero control HHCC - zero CO CCHC              -1.16912 0.302 Inf  -3.869
##  zero control HHCC - elevated control CCHC     -0.74822 0.280 Inf  -2.671
##  zero control HHCC - zero control CCHC         -0.67701 0.277 Inf  -2.443
##  zero control HHCC - elevated CO HHHC          -0.71944 0.294 Inf  -2.450
##  zero control HHCC - zero CO HHHC              -0.77326 0.284 Inf  -2.721
##  zero control HHCC - elevated control HHHC     -0.35212 0.286 Inf  -1.230
##  zero control HHCC - zero control HHHC         -0.64889 0.306 Inf  -2.121
##  elevated CO CCHC - zero CO CCHC               -0.34619 0.295 Inf  -1.172
##  elevated CO CCHC - elevated control CCHC       0.07471 0.273 Inf   0.274
##  elevated CO CCHC - zero control CCHC           0.14592 0.270 Inf   0.541
##  elevated CO CCHC - elevated CO HHHC            0.10349 0.331 Inf   0.312
##  elevated CO CCHC - zero CO HHHC                0.04967 0.326 Inf   0.153
##  elevated CO CCHC - elevated control HHHC       0.47081 0.324 Inf   1.454
##  elevated CO CCHC - zero control HHHC           0.17404 0.340 Inf   0.513
##  zero CO CCHC - elevated control CCHC           0.42090 0.292 Inf   1.441
##  zero CO CCHC - zero control CCHC               0.49211 0.289 Inf   1.701
##  zero CO CCHC - elevated CO HHHC                0.44968 0.347 Inf   1.295
##  zero CO CCHC - zero CO HHHC                    0.39586 0.342 Inf   1.158
##  zero CO CCHC - elevated control HHHC           0.81700 0.340 Inf   2.402
##  zero CO CCHC - zero control HHHC               0.52023 0.355 Inf   1.465
##  elevated control CCHC - zero control CCHC      0.07120 0.266 Inf   0.267
##  elevated control CCHC - elevated CO HHHC       0.02878 0.329 Inf   0.088
##  elevated control CCHC - zero CO HHHC          -0.02504 0.323 Inf  -0.078
##  elevated control CCHC - elevated control HHHC  0.39610 0.321 Inf   1.234
##  elevated control CCHC - zero control HHHC      0.09932 0.337 Inf   0.295
##  zero control CCHC - elevated CO HHHC          -0.04242 0.326 Inf  -0.130
##  zero control CCHC - zero CO HHHC              -0.09625 0.320 Inf  -0.301
##  zero control CCHC - elevated control HHHC      0.32489 0.318 Inf   1.020
##  zero control CCHC - zero control HHHC          0.02812 0.334 Inf   0.084
##  elevated CO HHHC - zero CO HHHC               -0.05382 0.270 Inf  -0.199
##  elevated CO HHHC - elevated control HHHC       0.36732 0.272 Inf   1.351
##  elevated CO HHHC - zero control HHHC           0.07054 0.293 Inf   0.241
##  zero CO HHHC - elevated control HHHC           0.42114 0.262 Inf   1.607
##  zero CO HHHC - zero control HHHC               0.12436 0.283 Inf   0.439
##  elevated control HHHC - zero control HHHC     -0.29678 0.285 Inf  -1.040
##  p.value
##   0.6483
##   1.0000
##   0.9988
##   0.9638
##   1.0000
##   0.9933
##   0.9998
##   1.0000
##   0.9993
##   0.2795
##   0.2469
##   1.0000
##   0.9993
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   0.9950
##   1.0000
##   0.7977
##   0.9999
##   1.0000
##   0.9998
##   0.0249
##   1.0000
##   0.2838
##   1.0000
##   0.0001
##   0.0001
##   0.9953
##   1.0000
##   0.9737
##   0.9126
##   0.8539
##   0.9065
##   0.0568
##   0.7795
##   0.9999
##   0.9893
##   1.0000
##   0.9736
##   1.0000
##   1.0000
##   0.9999
##   0.1812
##   0.1592
##   1.0000
##   0.9999
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   0.9817
##   1.0000
##   1.0000
##   1.0000
##   0.3722
##   1.0000
##   0.9113
##   1.0000
##   0.0080
##   0.0072
##   1.0000
##   1.0000
##   1.0000
##   0.9998
##   0.9998
##   1.0000
##   0.4954
##   0.9984
##   1.0000
##   0.0791
##   1.0000
##   0.6167
##   1.0000
##   0.0015
##   0.0014
##   0.9999
##   1.0000
##   0.9985
##   0.9901
##   0.9932
##   0.9978
##   0.3712
##   0.9808
##   0.4574
##   1.0000
##   0.9683
##   1.0000
##   0.0209
##   0.0183
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   0.8170
##   0.9999
##   0.3260
##   1.0000
##   0.4551
##   0.9942
##   0.9881
##   0.9981
##   0.6837
##   0.9998
##   1.0000
##   0.9999
##   0.9984
##   1.0000
##   1.0000
##   0.9351
##   1.0000
##   0.0108
##   0.0097
##   1.0000
##   1.0000
##   1.0000
##   0.9999
##   1.0000
##   1.0000
##   0.7403
##   0.9998
##   0.7968
##   0.7513
##   0.6864
##   1.0000
##   0.8873
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   0.0021
##   0.0018
##   1.0000
##   1.0000
##   0.9999
##   0.9987
##   0.9998
##   1.0000
##   0.6405
##   0.9985
##   1.0000
##   0.3718
##   0.0248
##   0.5494
##   0.7247
##   0.6718
##   0.4548
##   0.9999
##   0.8807
##   0.2877
##   0.0160
##   0.4499
##   0.6285
##   0.6230
##   0.4124
##   0.9996
##   0.8463
##   0.9998
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   0.9967
##   1.0000
##   0.9970
##   0.9793
##   0.9993
##   0.9999
##   0.6598
##   0.9963
##   1.0000
##   1.0000
##   1.0000
##   0.9996
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   1.0000
##   0.9987
##   1.0000
##   0.9889
##   1.0000
##   1.0000
## 
## Results are given on the log odds ratio (not the response) scale. 
## P value adjustment: tukey method for comparing a family of 20 estimates
#for graphs
JSurvEMM = (emmeans(s_glmer, ~ Parental_treat * Temp * Control_CO, type = "response") %>% as.data.frame)
JSurvEMM
##  Parental_treat Temp     Control_CO      prob         SE  df asymp.LCL
##  CCCC           elevated CO         0.8114509 0.06332549 Inf 0.6566144
##  CCCH           elevated CO         0.8719218 0.04839717 Inf 0.7443406
##  HHCC           elevated CO         0.7778809 0.07337432 Inf 0.6037307
##  CCHC           elevated CO         0.8236558 0.06345805 Inf 0.6648562
##  HHHC           elevated CO         0.8081175 0.06641898 Inf 0.6452685
##  CCCC           zero     CO         0.8837979 0.04351337 Inf 0.7682517
##  CCCH           zero     CO         0.8479470 0.05523970 Inf 0.7065873
##  HHCC           zero     CO         0.8589867 0.05287199 Inf 0.7213936
##  CCHC           zero     CO         0.8684711 0.05131547 Inf 0.7324379
##  HHHC           zero     CO         0.8163249 0.06345694 Inf 0.6597429
##  CCCC           elevated control    0.8186441 0.06153763 Inf 0.6670345
##  CCCH           elevated control    0.7518744 0.07775598 Inf 0.5724224
##  HHCC           elevated control    0.6798897 0.09115580 Inf 0.4830958
##  CCHC           elevated control    0.8125407 0.06621856 Inf 0.6489742
##  HHHC           elevated control    0.7446929 0.08042386 Inf 0.5600664
##  CCCC           zero     control    0.8537051 0.05224894 Inf 0.7199088
##  CCCH           zero     control    0.8516985 0.05389711 Inf 0.7133370
##  HHCC           zero     control    0.6722521 0.09279113 Inf 0.4732641
##  CCHC           zero     control    0.8014528 0.06887360 Inf 0.6334579
##  HHHC           zero     control    0.7969403 0.07072915 Inf 0.6249571
##  asymp.UCL
##  0.9064201
##  0.9408921
##  0.8895041
##  0.9166455
##  0.9069831
##  0.9457989
##  0.9281299
##  0.9347719
##  0.9409213
##  0.9106127
##  0.9104852
##  0.8727535
##  0.8283776
##  0.9104119
##  0.8698437
##  0.9298191
##  0.9298458
##  0.8240198
##  0.9041073
##  0.9023768
## 
## Confidence level used: 0.95 
## Intervals are back-transformed from the logit scale

plot modeled data

#combine column for x axis
JSurvEMM_graph <- JSurvEMM %>%  
 unite(Temp:Control_CO, col="Juv_treat", sep="_", remove=FALSE)
JSurvEMM_graph
##    Parental_treat        Juv_treat     Temp Control_CO      prob         SE  df
## 1            CCCC      elevated_CO elevated         CO 0.8114509 0.06332549 Inf
## 2            CCCH      elevated_CO elevated         CO 0.8719218 0.04839717 Inf
## 3            HHCC      elevated_CO elevated         CO 0.7778809 0.07337432 Inf
## 4            CCHC      elevated_CO elevated         CO 0.8236558 0.06345805 Inf
## 5            HHHC      elevated_CO elevated         CO 0.8081175 0.06641898 Inf
## 6            CCCC          zero_CO     zero         CO 0.8837979 0.04351337 Inf
## 7            CCCH          zero_CO     zero         CO 0.8479470 0.05523970 Inf
## 8            HHCC          zero_CO     zero         CO 0.8589867 0.05287199 Inf
## 9            CCHC          zero_CO     zero         CO 0.8684711 0.05131547 Inf
## 10           HHHC          zero_CO     zero         CO 0.8163249 0.06345694 Inf
## 11           CCCC elevated_control elevated    control 0.8186441 0.06153763 Inf
## 12           CCCH elevated_control elevated    control 0.7518744 0.07775598 Inf
## 13           HHCC elevated_control elevated    control 0.6798897 0.09115580 Inf
## 14           CCHC elevated_control elevated    control 0.8125407 0.06621856 Inf
## 15           HHHC elevated_control elevated    control 0.7446929 0.08042386 Inf
## 16           CCCC     zero_control     zero    control 0.8537051 0.05224894 Inf
## 17           CCCH     zero_control     zero    control 0.8516985 0.05389711 Inf
## 18           HHCC     zero_control     zero    control 0.6722521 0.09279113 Inf
## 19           CCHC     zero_control     zero    control 0.8014528 0.06887360 Inf
## 20           HHHC     zero_control     zero    control 0.7969403 0.07072915 Inf
##    asymp.LCL asymp.UCL
## 1  0.6566144 0.9064201
## 2  0.7443406 0.9408921
## 3  0.6037307 0.8895041
## 4  0.6648562 0.9166455
## 5  0.6452685 0.9069831
## 6  0.7682517 0.9457989
## 7  0.7065873 0.9281299
## 8  0.7213936 0.9347719
## 9  0.7324379 0.9409213
## 10 0.6597429 0.9106127
## 11 0.6670345 0.9104852
## 12 0.5724224 0.8727535
## 13 0.4830958 0.8283776
## 14 0.6489742 0.9104119
## 15 0.5600664 0.8698437
## 16 0.7199088 0.9298191
## 17 0.7133370 0.9298458
## 18 0.4732641 0.8240198
## 19 0.6334579 0.9041073
## 20 0.6249571 0.9023768
cbPalette <- c("#56B4E9", "#E69F00", "#D55E00","#009E73", "#999999")                     

#better labels#
graph <- ggplot(JSurvEMM_graph, aes (x = Juv_treat,  y=prob, colour=Parental_treat)) + geom_pointrange(aes (ymin = prob-SE, ymax = prob+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="Probability of survival") +
  
  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 = 16)) + 
  
  scale_colour_manual(values=cbPalette, name = "Cross-generation treatment", 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("Survival_graph.eps", graph, height = 6, width = 14, dpi = 320)