Data Preparation

There are two datasets containing the relevant data:

Because color should not respond to the immediate environment (at least not like we’re measuring it), we will only use the data from the \(pred^-\) treatment.

data_col<-read.csv("../data_raw/Plasticity Color Data.csv")
data_exp<-read.csv("../data_raw/F2_Data_122821.csv") %>%
  filter(assay_water == "pred-")

data <- right_join (data_exp, data_col, by = "ID") %>%
  mutate(tutor_pop = ifelse(is.na(tutor_pop), "0", tutor_pop))

Orange Body

model_orange <- glmmTMB(Body.Orange.Relative.Area ~ 
                          pop + (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'ordbeta', data)

kable(summary(model_orange)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.0279803 0.1449583 -20.8886305 0.0000000
popAL 0.3817716 0.1881825 2.0287307 0.0424857
pred_trtY 0.0193086 0.0681104 0.2834899 0.7768013
tutor_popAH -0.2490617 0.0806309 -3.0889126 0.0020089
tutor_popAL -0.2130395 0.0803220 -2.6523165 0.0079942
plot_ob <- plot_results(model_orange, trait = "Body Orange")
plot_ob

Xanthophore Body

model_xantho <- glmmTMB(Body.Xanthophore.Relative.Area ~ 
                          pop + (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'ordbeta', data)

kable(summary(model_xantho)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.8779178 0.1336049 -21.5405059 0.0000000
popAL 0.3074338 0.1708181 1.7997727 0.0718965
pred_trtY -0.0140733 0.0670113 -0.2100134 0.8336572
tutor_popAH -0.2926029 0.0800063 -3.6572489 0.0002549
tutor_popAL -0.2242972 0.0799065 -2.8069954 0.0050006
plot_xb <- plot_results(model_xantho, trait = "Body Xanthophore")
plot_xb

Black Body

model_black <- glmmTMB(Body.Black.Relative.Area ~ 
                          pop + (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'ordbeta', data)

kable(summary(model_black)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.4478348 0.0740513 -19.5517857 0.0000000
popAL -0.0396747 0.0851796 -0.4657771 0.6413751
pred_trtY -0.0564906 0.0546020 -1.0345874 0.3008617
tutor_popAH -0.1115785 0.0669139 -1.6674925 0.0954165
tutor_popAL -0.1466930 0.0663947 -2.2094089 0.0271462
plot_bb <- plot_results(model_black, trait = "Relative Black")
plot_bb

Melanistic Body

model_mela <- glmmTMB(Body.Melanistic.Relative.Area ~ 
                          pop + (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'ordbeta', data)

kable(summary(model_mela)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.2427688 0.0611392 -20.3268599 0.0000000
popAL -0.0709926 0.0645424 -1.0999370 0.2713596
pred_trtY -0.0442109 0.0491121 -0.9002035 0.3680120
tutor_popAH -0.0425365 0.0598988 -0.7101397 0.4776175
tutor_popAL -0.1248912 0.0597034 -2.0918610 0.0364510
plot_mb <- plot_results(model_mela, trait = "Melanistic Body")
plot_mb

Orange Tail

model_otail <- glmmTMB(Tail.Orange.Relative.Area ~ 
                          pop + (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'ordbeta', data)

kable(summary(model_otail)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.4264611 0.3397561 -4.1984853 0.0000269
popAL 0.2802265 0.4391477 0.6381146 0.5233991
pred_trtY 0.0480832 0.1098119 0.4378690 0.6614812
tutor_popAH -0.0720344 0.1397059 -0.5156147 0.6061235
tutor_popAL 0.0594725 0.1308539 0.4544949 0.6494726
plot_ot <- plot_results(model_otail, trait = "Orange Tail")
plot_ot

Black Tail

model_btail <- glmmTMB(Tail.Black.Relative.Area ~ 
                          pop + (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'ordbeta', data)

kable(summary(model_btail)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.8438320 0.2777521 -6.6384093 0.0000000
popAL 0.6176345 0.3746099 1.6487403 0.0992009
pred_trtY -0.0735815 0.0914806 -0.8043394 0.4212010
tutor_popAH -0.2038920 0.1138814 -1.7903896 0.0733913
tutor_popAL -0.0285915 0.1094231 -0.2612935 0.7938662
plot_bt <- plot_results(model_btail, trait = "Black Tail")
plot_bt

Orange Number

model_onr <- glmmTMB(Body.Orange.Number ~ 
                          pop * (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'genpois', data)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
kable(summary(model_onr)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.2197138 0.2124562 1.0341607 0.3010610
popAL 0.1455943 0.2966396 0.4908122 0.6235593
pred_trtY 0.0696245 0.0688513 1.0112303 0.3119062
tutor_popAH -0.0895483 0.0846228 -1.0582059 0.2899616
tutor_popAL -0.2651231 0.0894610 -2.9635604 0.0030410
popAL:pred_trtY -0.0521478 0.0940562 -0.5544322 0.5792831
popAL:tutor_popAH 0.0289782 0.1178495 0.2458915 0.8057662
popAL:tutor_popAL 0.2516081 0.1178501 2.1349839 0.0327623
plot_on <- plot_results(model_onr, trait = "Orange Spots")
plot_on

Black Number

model_bnr <- glmmTMB(Body.Black.Number ~ 
                          pop * (pred_trt + tutor_pop) +
                          (1|mom_ID), 
                        family = 'genpois', data)

kable(summary(model_bnr)$coefficients)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.4574978 0.0715445 20.3718946 0.0000000
popAL 0.0218482 0.1026157 0.2129132 0.8313946
pred_trtY -0.0453144 0.0656282 -0.6904717 0.4898976
tutor_popAH 0.0665402 0.0796043 0.8358867 0.4032186
tutor_popAL 0.0604472 0.0814005 0.7425907 0.4577295
popAL:pred_trtY -0.0239052 0.0953106 -0.2508134 0.8019584
popAL:tutor_popAH -0.2540757 0.1188058 -2.1385806 0.0324697
popAL:tutor_popAL 0.0194073 0.1116936 0.1737548 0.8620581
plot_bn <- plot_results(model_bnr, trait = "Black Spots")
plot_bn

sjPlot::tab_model(model_orange, model_xantho,
                  model_black, model_mela,
                  model_otail, model_btail,
                  model_onr, model_bnr,
                  show.se = TRUE, 
                  show.ci = FALSE, 
                  collapse.se = TRUE,
                  show.icc = FALSE,
                  show.r2 = FALSE)
  Body Orange Relative Area Body Xanthophore Relative
Area
Body Black Relative Area Body Melanistic Relative
Area
Tail Orange Relative Area Tail Black Relative Area Body Orange Number Body Black Number
Predictors Estimates p Estimates p Estimates p Estimates p Estimates p Estimates p Incidence Rate Ratios p Incidence Rate Ratios p
(Intercept) 0.05
(0.01)
<0.001 0.06
(0.01)
<0.001 0.24
(0.02)
<0.001 0.29
(0.02)
<0.001 0.24
(0.08)
<0.001 0.16
(0.04)
<0.001 1.25
(0.26)
0.301 4.30
(0.31)
<0.001
pop [AL] 1.46
(0.28)
0.042 1.36
(0.23)
0.072 0.96
(0.08)
0.641 0.93
(0.06)
0.271 1.32
(0.58)
0.523 1.85
(0.69)
0.099 1.16
(0.34)
0.624 1.02
(0.10)
0.831
pred trt [Y] 1.02
(0.07)
0.777 0.99
(0.07)
0.834 0.95
(0.05)
0.301 0.96
(0.05)
0.368 1.05
(0.12)
0.661 0.93
(0.08)
0.421 1.07
(0.07)
0.312 0.96
(0.06)
0.490
tutor pop [AH] 0.78
(0.06)
0.002 0.75
(0.06)
<0.001 0.89
(0.06)
0.095 0.96
(0.06)
0.478 0.93
(0.13)
0.606 0.82
(0.09)
0.073 0.91
(0.08)
0.290 1.07
(0.09)
0.403
tutor pop [AL] 0.81
(0.06)
0.008 0.80
(0.06)
0.005 0.86
(0.06)
0.027 0.88
(0.05)
0.036 1.06
(0.14)
0.649 0.97
(0.11)
0.794 0.77
(0.07)
0.003 1.06
(0.09)
0.458
pop [AL] × pred trt [Y] 0.95
(0.09)
0.579 0.98
(0.09)
0.802
pop [AL] × tutor pop [AH] 1.03
(0.12)
0.806 0.78
(0.09)
0.032
pop [AL] × tutor pop [AL] 1.29
(0.15)
0.033 1.02
(0.11)
0.862
Random Effects
σ2 3.02 2.94 1.76 1.58 1.52 1.82 0.14 0.10
τ00 0.20 mom_ID 0.16 mom_ID 0.03 mom_ID 0.01 mom_ID 1.18 mom_ID 0.90 mom_ID 0.53 mom_ID 0.01 mom_ID
N 30 mom_ID 30 mom_ID 30 mom_ID 30 mom_ID 30 mom_ID 30 mom_ID 30 mom_ID 30 mom_ID
Observations 194 194 194 194 194 194 194 194
plot_ob + plot_xb + 
plot_bb + plot_mb +
plot_ot + plot_bt +
plot_on + plot_bn +
  plot_layout(ncol = 1,
              axis_titles = "collect",
              guides = "collect") +
  plot_annotation(title = "                 High Predation                   Low Predation") &
  theme(legend.position = 'bottom')