This file is to be used with the continuous life-history traits from the study (duration of larval development, body mass and adult lifespan). We alternate between analyses of respective traits through assigning them into the response variable y
.
Load libraries and read the full dataset (N = 3 431). We analyse data on female and male offspring separately due to the profound sexual dimorphism in seed beetle life history. We remove offspring of dams for which host preference was not recorded. We also exclude outliers in the response variable that are larger than 3-times trait SD.
## [1] "Removed missing and outlier values:"
## [1] 27
## Cowpea Mung
## mean 31.526 30.456
## SD 1.481 1.102
## SE 0.044 0.042
## 'data.frame': 1384 obs. of 27 variables:
## $ day.mated : Factor w/ 6 levels "11.3.18","12.3.18",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ IDf : Factor w/ 245 levels "d101","d102",..: 1 1 1 1 1 1 2 2 2 2 ...
## $ IDm : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 18 18 20 20 20 20 ...
## $ ord.f : int 1 1 1 1 1 1 1 1 1 1 ...
## $ pref.C : int 8 8 8 8 8 8 3 3 3 3 ...
## $ pref.tot : int 13 13 13 13 13 13 10 10 10 10 ...
## $ host : Factor w/ 2 levels "C","M": 1 2 1 1 1 1 2 1 1 2 ...
## $ Whost : num 357.2 77.9 293.4 327.4 266.9 ...
## $ IDo : int 2 2 3 4 9 10 1 2 4 4 ...
## $ code : Factor w/ 1384 levels "C-101-10","C-101-2",..: 2 758 3 4 5 1 759 6 7 760 ...
## $ state : Factor w/ 1 level "emerged": 1 1 1 1 1 1 1 1 1 1 ...
## $ day.em : Factor w/ 13 levels "10.4.18","11.4.18",..: 7 2 6 6 7 5 2 3 4 2 ...
## $ dev.dur.o : int 34 29 33 33 34 32 29 30 31 29 ...
## $ Wo : num 3.21 3.9 4.36 3.55 3.34 ...
## $ sex : Factor w/ 1 level "m": 1 1 1 1 1 1 1 1 1 1 ...
## $ mated : Factor w/ 2 levels "not","unsucc": 1 1 1 1 1 1 1 1 1 1 ...
## $ pref.C.o : logi NA NA NA NA NA NA ...
## $ pref.tot.o: logi NA NA NA NA NA NA ...
## $ day.dead : Factor w/ 34 levels "","1.5.18","10.5.18",..: 25 2 5 5 34 28 33 3 28 29 ...
## $ adsurv.o : int 12 20 27 27 23 16 27 28 17 23 ...
## $ rel.pref : num 0.615 0.615 0.615 0.615 0.615 ...
## $ rel.pref.o: num NA NA NA NA NA NA NA NA NA NA ...
## $ y : int 34 29 33 33 34 32 29 30 31 29 ...
## $ WH : num 1.379 0.8039 -0.0229 0.7236 -0.606 ...
## $ PREF : num -0.421 -0.421 -0.421 -0.421 -0.421 ...
## $ date : num 3 3 3 3 3 3 3 3 3 3 ...
## $ DATE : num -0.568 -0.568 -0.568 -0.568 -0.568 ...
We have dams, sires and their offspring, i.e. parental and offspring generation.
## offspring dams sires
## 1 1384 245 82
In the full model, we test the effect of novel host type (Prediction 3) and dam host preference on offspring performance (Prediction 4). The full model includes all the terms from the minimal model: host type (host
, original/novel), bean mass (WH
, standardized within each host type), dam mating order (ord.f
, mating sequence, 1 to 4), and day mated (DATE
, 1-6). We added dam host preference (PREF
, the relative preference ratio of cowpea: 0-1) along with its interaction with host type dam host preference:host (PREF:host
). This interaction tested if effect of the strength of preference for the original host on offspring traits differs depending on the host type. We also included interactions between host type and bean mass bean mass:host (WH:host
), as well as host type and day mated day mated:host (DATE:host
), as fixed effects to test for potential host-specific influences.
The random effects structure follows that of the best-selected minimal model (Gcov) and omitted maternal effects as they proved to be negligible in the traits we study. Additive genetic variance is specified using the pedigree and the identity of the offspring as animal
in the random-effects part of the model. We defined random effects for each host separately as interaction with host
- animal (us(host):animal
) where ‘us’ - unstructured
also modeled additive genetic covariance to estimate thecorrelation (\(r_{G}\)). Residual variation was allowed to be estimated separately per host type (rcov=~idh(host):units
).
## Time difference of 24.62634 mins
## [1] 1 6 16 46 51 101 121 136 151 201 216 251 266 281 301 336 351 386 401
## [1] 1 6 11 21 31 36 41 46 56 61 66 71 76 86 96 101 106 116 121
## [20] 141 156 161 166 176
##
## Iterations = 50001:549501
## Thinning interval = 500
## Sample size = 1000
##
## DIC: 4367.705
##
## G-structure: ~us(host):animal
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 0.48661 0.1318 0.8257 1000.0
## hostM:hostC.animal 0.06899 -0.1773 0.3237 872.2
## hostC:hostM.animal 0.06899 -0.1773 0.3237 872.2
## hostM:hostM.animal 0.61537 0.3496 0.9098 1118.4
##
## R-structure: ~idh(host):units
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC.units 1.6994 1.3746 2.0263 868
## hostM.units 0.5637 0.3612 0.7745 1159
##
## Location effects: y ~ host + WH + ord.f + DATE + PREF + WH:host + DATE:host + PREF:host
##
## post.mean l-95% CI u-95% CI eff.samp pMCMC
## (Intercept) 31.4087159 31.1873455 31.6074366 783.8 <0.001 ***
## hostM -1.1087319 -1.2955964 -0.9351366 1000.0 <0.001 ***
## WH 0.0883105 -0.0174457 0.1886133 1000.0 0.102
## ord.f 0.0657660 -0.0128390 0.1338175 826.8 0.076 .
## DATE 0.1506042 0.0279481 0.2913931 898.7 0.024 *
## PREF -0.0479961 -0.1741870 0.0676600 1000.0 0.370
## hostM:WH 0.0008302 -0.1311580 0.1381230 1000.0 0.972
## hostM:DATE 0.1436706 -0.0256059 0.3262640 1000.0 0.126
## hostM:PREF 0.0816452 -0.0836764 0.2283500 1000.0 0.264
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Copy-friendly output of the ‘full’ model:
## Par Est 95% CredI
## 1 hostC:hostC.animal 0.546 0.132,0.826
## 2 hostM:hostC.animal 0.092 -0.177,0.324
## 3 hostC:hostM.animal 0.092 -0.177,0.324
## 4 hostM:hostM.animal 0.615 0.35,0.91
## 5 hostC.units 1.721 1.375,2.026
## 6 hostM.units 0.617 0.361,0.775
## 7 (Intercept) 31.442 31.187,31.607
## 8 hostM -1.148 -1.296,-0.935
## 9 WH 0.105 -0.017,0.189
## 10 ord.f 0.054 -0.013,0.134
## 11 DATE 0.122 0.028,0.291
## 12 PREF -0.025 -0.174,0.068
## 13 hostM:WH 0.031 -0.131,0.138
## 14 hostM:DATE 0.112 -0.026,0.326
## 15 hostM:PREF 0.051 -0.084,0.228
## [1] "Removed missing and outlier values:"
## [1] 45
## Cowpea Mung
## mean 3.527 3.885
## SD 0.564 0.459
## SE 0.027 0.027
## 'data.frame': 1399 obs. of 27 variables:
## $ day.mated : Factor w/ 6 levels "11.3.18","12.3.18",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ IDf : Factor w/ 245 levels "d101","d102",..: 1 1 1 1 1 1 1 2 2 2 ...
## $ IDm : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 18 18 18 20 20 20 ...
## $ ord.f : int 1 1 1 1 1 1 1 1 1 1 ...
## $ pref.C : int 8 8 8 8 8 8 8 3 3 3 ...
## $ pref.tot : int 13 13 13 13 13 13 13 10 10 10 ...
## $ host : Factor w/ 2 levels "C","M": 1 1 2 1 1 1 1 2 1 1 ...
## $ Whost : num 355 357.2 77.9 293.4 327.4 ...
## $ IDo : int 1 2 2 3 4 9 10 1 2 4 ...
## $ code : Factor w/ 1399 levels "C-101-1","C-101-10",..: 1 3 776 4 5 6 2 777 7 8 ...
## $ state : Factor w/ 1 level "emerged": 1 1 1 1 1 1 1 1 1 1 ...
## $ day.em : Factor w/ 17 levels "10.4.18","11.4.18",..: 13 7 2 6 6 7 5 2 3 4 ...
## $ dev.dur.o : int 40 34 29 33 33 34 32 29 30 31 ...
## $ Wo : num 3.53 3.21 3.9 4.36 3.55 ...
## $ sex : Factor w/ 1 level "m": 1 1 1 1 1 1 1 1 1 1 ...
## $ mated : Factor w/ 2 levels "not","unsucc": 1 1 1 1 1 1 1 1 1 1 ...
## $ pref.C.o : logi NA NA NA NA NA NA ...
## $ pref.tot.o: logi NA NA NA NA NA NA ...
## $ day.dead : Factor w/ 34 levels "","1.5.18","10.5.18",..: 23 25 2 5 5 34 28 33 3 28 ...
## $ adsurv.o : int 4 12 20 27 27 23 16 27 28 17 ...
## $ rel.pref : num 0.615 0.615 0.615 0.615 0.615 ...
## $ rel.pref.o: num NA NA NA NA NA NA NA NA NA NA ...
## $ y : num 3.53 3.21 3.9 4.36 3.55 ...
## $ WH : num 1.3273 1.3741 0.8086 -0.0316 0.7169 ...
## $ PREF : num -0.425 -0.425 -0.425 -0.425 -0.425 ...
## $ date : num 3 3 3 3 3 3 3 3 3 3 ...
## $ DATE : num -0.557 -0.557 -0.557 -0.557 -0.557 ...
We have dams, sires and their offspring, i.e. parental and offspring generation.
## offspring dams sires
## 1 1399 245 82
In the full model, we test the effect of novel host type (Prediction 3) and dam host preference on offspring performance (Prediction 4).
The random effects structure follows that of the best-selected minimal model (Gcov) and omitted maternal effects as they proved to be negligible in the traits we study.
## Time difference of 22.10817 mins
## [1] 1 6 16 46 51 101 121 136 151 201 216 251 266 281 301 336 351 386 401
## [1] 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91
## [20] 96 101 106 116 121 126 131 141 151 156 161 166 176
##
## Iterations = 50001:549501
## Thinning interval = 500
## Sample size = 1000
##
## DIC: 1824.062
##
## G-structure: ~us(host):animal
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 0.07717 0.03640 0.1177 1000.0
## hostM:hostC.animal 0.08050 0.04812 0.1111 872.8
## hostC:hostM.animal 0.08050 0.04812 0.1111 872.8
## hostM:hostM.animal 0.10720 0.06714 0.1473 1000.0
##
## R-structure: ~idh(host):units
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC.units 0.2356 0.19712 0.2703 1000.0
## hostM.units 0.1038 0.06969 0.1331 810.3
##
## Location effects: y ~ host + WH + ord.f + DATE + PREF + WH:host + DATE:host + PREF:host
##
## post.mean l-95% CI u-95% CI eff.samp pMCMC
## (Intercept) 3.499310 3.414499 3.593030 1000.0 <0.001 ***
## hostM 0.353014 0.303469 0.407818 929.8 <0.001 ***
## WH -0.049781 -0.088652 -0.011214 1000.0 0.014 *
## ord.f 0.012736 -0.017174 0.046741 1000.0 0.462
## DATE 0.084688 0.037499 0.139207 1000.0 0.002 **
## PREF 0.005966 -0.042396 0.046032 1000.0 0.808
## hostM:WH 0.043634 -0.010910 0.090527 1125.9 0.108
## hostM:DATE -0.018732 -0.071579 0.035175 1000.0 0.486
## hostM:PREF 0.012492 -0.037789 0.063344 1000.0 0.634
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Copy-friendly output of the ‘full’ model:
## Par Est 95% CredI
## 1 hostC:hostC.animal 0.072 0.036,0.118
## 2 hostM:hostC.animal 0.08 0.048,0.111
## 3 hostC:hostM.animal 0.08 0.048,0.111
## 4 hostM:hostM.animal 0.108 0.067,0.147
## 5 hostC.units 0.231 0.197,0.27
## 6 hostM.units 0.1 0.07,0.133
## 7 (Intercept) 3.466 3.414,3.593
## 8 hostM 0.349 0.303,0.408
## 9 WH -0.039 -0.089,-0.011
## 10 ord.f 0.006 -0.017,0.047
## 11 DATE 0.074 0.037,0.139
## 12 PREF 0 -0.042,0.046
## 13 hostM:WH 0.04 -0.011,0.091
## 14 hostM:DATE -0.018 -0.072,0.035
## 15 hostM:PREF 0.008 -0.038,0.063
## [1] "Removed missing and outlier values:"
## [1] 55
## Cowpea Mung
## mean 16.913 19.366
## SD 5.367 5.164
## SE 0.084 0.091
## 'data.frame': 1389 obs. of 27 variables:
## $ day.mated : Factor w/ 6 levels "11.3.18","12.3.18",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ IDf : Factor w/ 245 levels "d101","d102",..: 1 1 1 1 1 1 1 2 2 2 ...
## $ IDm : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 18 18 18 20 20 20 ...
## $ ord.f : int 1 1 1 1 1 1 1 1 1 1 ...
## $ pref.C : int 8 8 8 8 8 8 8 3 3 3 ...
## $ pref.tot : int 13 13 13 13 13 13 13 10 10 10 ...
## $ host : Factor w/ 2 levels "C","M": 1 1 2 1 1 1 1 2 1 1 ...
## $ Whost : num 355 357.2 77.9 293.4 327.4 ...
## $ IDo : int 1 2 2 3 4 9 10 1 2 4 ...
## $ code : Factor w/ 1389 levels "C-101-1","C-101-10",..: 1 3 769 4 5 6 2 770 7 8 ...
## $ state : Factor w/ 1 level "emerged": 1 1 1 1 1 1 1 1 1 1 ...
## $ day.em : Factor w/ 18 levels "10.4.18","11.4.18",..: 13 7 2 6 6 7 5 2 3 4 ...
## $ dev.dur.o : int 40 34 29 33 33 34 32 29 30 31 ...
## $ Wo : num 3.53 3.21 3.9 4.36 3.55 ...
## $ sex : Factor w/ 1 level "m": 1 1 1 1 1 1 1 1 1 1 ...
## $ mated : Factor w/ 2 levels "not","unsucc": 1 1 1 1 1 1 1 1 1 1 ...
## $ pref.C.o : logi NA NA NA NA NA NA ...
## $ pref.tot.o: logi NA NA NA NA NA NA ...
## $ day.dead : Factor w/ 33 levels "1.5.18","10.5.18",..: 22 24 1 4 4 33 27 32 2 27 ...
## $ adsurv.o : int 4 12 20 27 27 23 16 27 28 17 ...
## $ rel.pref : num 0.615 0.615 0.615 0.615 0.615 ...
## $ rel.pref.o: num NA NA NA NA NA NA NA NA NA NA ...
## $ y : int 4 12 20 27 27 23 16 27 28 17 ...
## $ WH : num 1.3359 1.3832 0.8069 -0.0377 0.7189 ...
## $ PREF : num -0.421 -0.421 -0.421 -0.421 -0.421 ...
## $ date : num 3 3 3 3 3 3 3 3 3 3 ...
## $ DATE : num -0.562 -0.562 -0.562 -0.562 -0.562 ...
We have dams, sires and their offspring, i.e. parental and offspring generation.
## offspring dams sires
## 1 1389 245 82
In the full model, we test the effect of novel host type (Prediction 3) and dam host preference on offspring performance (Prediction 4).
The random effects structure follows that of the best-selected minimal model (Gcov) and omitted maternal effects as they proved to be negligible in the traits we study.
## Time difference of 22.28531 mins
## [1] 1 6 16 46 51 55 101 121 136 151 156 196 201 216 251 266 281 301 336
## [20] 351 386 401
## [1] 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91
## [20] 96 101 106 111 116 121 126 131 136 141 151 156 161 166 176
##
## Iterations = 50001:549501
## Thinning interval = 500
## Sample size = 1000
##
## DIC: 8060.474
##
## G-structure: ~us(host):animal
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 10.48 5.638 15.07 802.9
## hostM:hostC.animal 12.52 7.992 17.02 896.4
## hostC:hostM.animal 12.52 7.992 17.02 896.4
## hostM:hostM.animal 17.97 10.891 25.44 1000.0
##
## R-structure: ~idh(host):units
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC.units 17.944 14.526 22.17 842.1
## hostM.units 9.383 4.214 14.15 1000.0
##
## Location effects: y ~ host + WH + ord.f + DATE + PREF + WH:host + DATE:host + PREF:host
##
## post.mean l-95% CI u-95% CI eff.samp pMCMC
## (Intercept) 16.34844 15.33784 17.25904 1000.0 <0.001 ***
## hostM 2.34066 1.79238 2.88531 1000.0 <0.001 ***
## WH -0.41263 -0.74164 -0.03831 1000.0 0.018 *
## ord.f 0.23939 -0.11563 0.58656 810.1 0.198
## DATE 0.78392 0.19909 1.26183 1000.0 0.002 **
## PREF 0.12466 -0.26719 0.57173 1160.1 0.568
## hostM:WH 0.05502 -0.46299 0.56016 1212.4 0.858
## hostM:DATE -0.32242 -0.91018 0.23727 1219.2 0.280
## hostM:PREF -0.06136 -0.58961 0.46968 1000.0 0.832
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Copy-friendly output of the ‘full’ model:
## Par Est 95% CredI
## 1 hostC:hostC.animal 9.233 5.638,15.068
## 2 hostM:hostC.animal 12.53 7.992,17.017
## 3 hostC:hostM.animal 12.53 7.992,17.017
## 4 hostM:hostM.animal 16.837 10.891,25.443
## 5 hostC.units 18.709 14.526,22.166
## 6 hostM.units 9.58 4.214,14.146
## 7 (Intercept) 16.298 15.338,17.259
## 8 hostM 2.355 1.792,2.885
## 9 WH -0.365 -0.742,-0.038
## 10 ord.f 0.21 -0.116,0.587
## 11 DATE 0.797 0.199,1.262
## 12 PREF 0.128 -0.267,0.572
## 13 hostM:WH -0.06 -0.463,0.56
## 14 hostM:DATE -0.36 -0.91,0.237
## 15 hostM:PREF -0.109 -0.59,0.47
Session info:
## Time difference of 69.01983 mins
## R version 4.0.0 (2020-04-24)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 18363)
##
## Matrix products: default
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] QGglmm_0.7.4 MCMCglmm_2.29 ape_5.3 coda_0.19-3 scales_1.1.1
## [6] MuMIn_1.43.17 lme4_1.1-23 Matrix_1.2-18
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.4.6 compiler_4.0.0 nloptr_1.2.2.1 tools_4.0.0
## [5] boot_1.3-24 digest_0.6.25 statmod_1.4.34 evaluate_0.14
## [9] lifecycle_0.2.0 nlme_3.1-147 lattice_0.20-41 rlang_0.4.6
## [13] yaml_2.2.1 parallel_4.0.0 xfun_0.14 stringr_1.4.0
## [17] knitr_1.28 stats4_4.0.0 grid_4.0.0 R6_2.4.1
## [21] rmarkdown_2.2 tensorA_0.36.1 minqa_1.2.4 corpcor_1.6.9
## [25] magrittr_1.5 htmltools_0.4.0 MASS_7.3-51.5 splines_4.0.0
## [29] colorspace_1.4-1 cubature_2.0.4 stringi_1.4.6 munsell_0.5.0
END