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] 24
## Cowpea Mung
## mean 32.025 30.770
## SD 1.355 1.009
## SE 0.043 0.038
## 'data.frame': 1420 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/ 246 levels "d101","d102",..: 1 1 1 1 1 2 2 2 2 2 ...
## $ IDm : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 18 20 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 3 3 3 3 3 ...
## $ pref.tot : int 13 13 13 13 13 10 10 10 10 10 ...
## $ host : Factor w/ 2 levels "C","M": 2 2 1 1 1 1 2 1 2 2 ...
## $ Whost : num 70.9 62.6 328.4 310.1 210.4 ...
## $ IDo : int 1 3 6 7 8 1 2 3 3 5 ...
## $ code : Factor w/ 1420 levels "C-101-6","C-101-7",..: 735 736 1 2 3 4 737 5 738 739 ...
## $ state : Factor w/ 1 level "emerged": 1 1 1 1 1 1 1 1 1 1 ...
## $ day.em : Factor w/ 12 levels "10.4.18","11.4.18",..: 4 3 7 5 3 4 3 4 3 3 ...
## $ dev.dur.o : int 31 30 34 32 30 31 30 31 30 30 ...
## $ Wo : num 7.98 7.79 5.99 5.55 7.03 ...
## $ sex : Factor w/ 1 level "f": 1 1 1 1 1 1 1 1 1 1 ...
## $ mated : Factor w/ 3 levels "not","succ","unsucc": 2 2 1 2 2 2 1 2 1 2 ...
## $ pref.C.o : int 0 10 NA 15 9 15 NA 18 NA 10 ...
## $ pref.tot.o: int 1 19 NA 31 13 21 NA 20 NA 19 ...
## $ day.dead : Factor w/ 43 levels "","1.5.18","10.5.18",..: 19 7 10 15 15 33 3 39 17 40 ...
## $ adsurv.o : int 38 32 30 18 20 16 28 22 38 24 ...
## $ rel.pref : num 0.615 0.615 0.615 0.615 0.615 ...
## $ rel.pref.o: num 0 0.526 NA 0.484 0.692 ...
## $ y : int 31 30 34 32 30 31 30 31 30 30 ...
## $ WH : num -0.149 -1.224 0.848 0.445 -1.751 ...
## $ PREF : num -0.403 -0.403 -0.403 -0.403 -0.403 ...
## $ date : num 3 3 3 3 3 3 3 3 3 3 ...
## $ DATE : num -0.482 -0.482 -0.482 -0.482 -0.482 ...
We have dams, sires and their offspring, i.e. parental and offspring generation.
## offspring dams sires
## 1 1420 246 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 26.12677 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 37 41 42 46 51 56 61 66 67 71 72 76 81
## [20] 86 96 101 106 116 121 126 131 141 156 161 166 176
##
## Iterations = 50001:549501
## Thinning interval = 500
## Sample size = 1000
##
## DIC: 4215.541
##
## G-structure: ~us(host):animal
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 0.4014 0.12157 0.6772 1000.0
## hostM:hostC.animal 0.2353 0.07389 0.4093 707.8
## hostC:hostM.animal 0.2353 0.07389 0.4093 707.8
## hostM:hostM.animal 0.4086 0.21436 0.6221 1000.0
##
## R-structure: ~idh(host):units
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC.units 1.3656 1.0936 1.6512 1000
## hostM.units 0.5521 0.3943 0.7256 1000
##
## 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.901143 31.712616 32.102610 1000.0 <0.001 ***
## hostM -1.261854 -1.388274 -1.114866 1000.0 <0.001 ***
## WH 0.138547 0.034711 0.229066 1000.0 0.004 **
## ord.f 0.063910 -0.002369 0.136302 1000.0 0.070 .
## DATE 0.325559 0.206044 0.453887 1000.0 <0.001 ***
## PREF -0.079529 -0.179796 0.031365 881.2 0.136
## hostM:WH -0.086874 -0.196076 0.031843 1000.0 0.168
## hostM:DATE 0.003551 -0.140631 0.142220 1000.0 0.998
## hostM:PREF 0.076623 -0.056285 0.206322 712.0 0.236
## ---
## 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.345 0.122,0.677
## 2 hostM:hostC.animal 0.284 0.074,0.409
## 3 hostC:hostM.animal 0.284 0.074,0.409
## 4 hostM:hostM.animal 0.401 0.214,0.622
## 5 hostC.units 1.393 1.094,1.651
## 6 hostM.units 0.55 0.394,0.726
## 7 (Intercept) 31.899 31.713,32.103
## 8 hostM -1.285 -1.388,-1.115
## 9 WH 0.145 0.035,0.229
## 10 ord.f 0.06 -0.002,0.136
## 11 DATE 0.326 0.206,0.454
## 12 PREF -0.073 -0.18,0.031
## 13 hostM:WH -0.092 -0.196,0.032
## 14 hostM:DATE -0.017 -0.141,0.142
## 15 hostM:PREF 0.051 -0.056,0.206
## [1] "Removed missing and outlier values:"
## [1] 13
## Cowpea Mung
## mean 5.826 6.515
## SD 0.707 0.615
## SE 0.031 0.030
## 'data.frame': 1431 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/ 246 levels "d101","d102",..: 1 1 1 1 1 2 2 2 2 2 ...
## $ IDm : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 18 20 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 3 3 3 3 3 ...
## $ pref.tot : int 13 13 13 13 13 10 10 10 10 10 ...
## $ host : Factor w/ 2 levels "C","M": 2 2 1 1 1 1 2 1 2 2 ...
## $ Whost : num 70.9 62.6 328.4 310.1 210.4 ...
## $ IDo : int 1 3 6 7 8 1 2 3 3 5 ...
## $ code : Factor w/ 1431 levels "C-101-6","C-101-7",..: 744 745 1 2 3 4 746 5 747 748 ...
## $ state : Factor w/ 1 level "emerged": 1 1 1 1 1 1 1 1 1 1 ...
## $ day.em : Factor w/ 18 levels "1.5.18","10.4.18",..: 5 4 8 6 4 5 4 5 4 4 ...
## $ dev.dur.o : int 31 30 34 32 30 31 30 31 30 30 ...
## $ Wo : num 7.98 7.79 5.99 5.55 7.03 ...
## $ sex : Factor w/ 1 level "f": 1 1 1 1 1 1 1 1 1 1 ...
## $ mated : Factor w/ 3 levels "not","succ","unsucc": 2 2 1 2 2 2 1 2 1 2 ...
## $ pref.C.o : int 0 10 NA 15 9 15 NA 18 NA 10 ...
## $ pref.tot.o: int 1 19 NA 31 13 21 NA 20 NA 19 ...
## $ day.dead : Factor w/ 41 levels "","1.5.18","10.5.18",..: 17 7 9 13 13 31 3 37 15 38 ...
## $ adsurv.o : int 38 32 30 18 20 16 28 22 38 24 ...
## $ rel.pref : num 0.615 0.615 0.615 0.615 0.615 ...
## $ rel.pref.o: num 0 0.526 NA 0.484 0.692 ...
## $ y : num 7.98 7.79 5.99 5.55 7.03 ...
## $ WH : num -0.15 -1.223 0.843 0.438 -1.764 ...
## $ PREF : num -0.402 -0.402 -0.402 -0.402 -0.402 ...
## $ date : num 3 3 3 3 3 3 3 3 3 3 ...
## $ DATE : num -0.48 -0.48 -0.48 -0.48 -0.48 ...
We have dams, sires and their offspring, i.e. parental and offspring generation.
## offspring dams sires
## 1 1431 246 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 23.11864 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: 2314.343
##
## G-structure: ~us(host):animal
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 0.2224 0.1469 0.3212 1152.1
## hostM:hostC.animal 0.2024 0.1391 0.2662 543.3
## hostC:hostM.animal 0.2024 0.1391 0.2662 543.3
## hostM:hostM.animal 0.2474 0.1775 0.3205 1000.0
##
## R-structure: ~idh(host):units
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC.units 0.2723 0.19925 0.3366 1000
## hostM.units 0.1329 0.07969 0.1783 1000
##
## 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) 5.793309 5.659829 5.904313 1000.0 <0.001 ***
## hostM 0.721307 0.650484 0.792163 1000.0 <0.001 ***
## WH -0.080818 -0.130033 -0.032493 1000.0 <0.001 ***
## ord.f 0.008314 -0.037415 0.052017 866.1 0.712
## DATE 0.064132 -0.005619 0.149485 1000.0 0.098 .
## PREF 0.082059 0.026907 0.143967 872.8 0.008 **
## hostM:WH 0.045739 -0.022386 0.102224 1000.0 0.170
## hostM:DATE -0.050536 -0.126978 0.020461 1000.0 0.196
## hostM:PREF -0.081952 -0.145965 -0.014821 1000.0 0.018 *
## ---
## 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.235 0.147,0.321
## 2 hostM:hostC.animal 0.197 0.139,0.266
## 3 hostC:hostM.animal 0.197 0.139,0.266
## 4 hostM:hostM.animal 0.233 0.178,0.321
## 5 hostC.units 0.256 0.199,0.337
## 6 hostM.units 0.129 0.08,0.178
## 7 (Intercept) 5.784 5.66,5.904
## 8 hostM 0.728 0.65,0.792
## 9 WH -0.083 -0.13,-0.032
## 10 ord.f 0.007 -0.037,0.052
## 11 DATE 0.058 -0.006,0.149
## 12 PREF 0.086 0.027,0.144
## 13 hostM:WH 0.047 -0.022,0.102
## 14 hostM:DATE -0.057 -0.127,0.02
## 15 hostM:PREF -0.081 -0.146,-0.015
## [1] "Removed missing and outlier values:"
## [1] 19
## Cowpea Mung
## mean 22.926 26.189
## SD 6.368 6.129
## SE 0.093 0.095
## 'data.frame': 1425 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/ 246 levels "d101","d102",..: 1 1 1 1 1 2 2 2 2 2 ...
## $ IDm : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 18 20 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 3 3 3 3 3 ...
## $ pref.tot : int 13 13 13 13 13 10 10 10 10 10 ...
## $ host : Factor w/ 2 levels "C","M": 2 2 1 1 1 1 2 1 2 2 ...
## $ Whost : num 70.9 62.6 328.4 310.1 210.4 ...
## $ IDo : int 1 3 6 7 8 1 2 3 3 5 ...
## $ code : Factor w/ 1425 levels "C-101-6","C-101-7",..: 745 746 1 2 3 4 747 5 748 749 ...
## $ state : Factor w/ 1 level "emerged": 1 1 1 1 1 1 1 1 1 1 ...
## $ day.em : Factor w/ 19 levels "1.5.18","10.4.18",..: 5 4 8 6 4 5 4 5 4 4 ...
## $ dev.dur.o : int 31 30 34 32 30 31 30 31 30 30 ...
## $ Wo : num 7.98 7.79 5.99 5.55 7.03 ...
## $ sex : Factor w/ 1 level "f": 1 1 1 1 1 1 1 1 1 1 ...
## $ mated : Factor w/ 3 levels "not","succ","unsucc": 2 2 1 2 2 2 1 2 1 2 ...
## $ pref.C.o : int 0 10 NA 15 9 15 NA 18 NA 10 ...
## $ pref.tot.o: int 1 19 NA 31 13 21 NA 20 NA 19 ...
## $ day.dead : Factor w/ 39 levels "1.5.18","10.5.18",..: 16 6 8 12 12 30 2 35 14 36 ...
## $ adsurv.o : int 38 32 30 18 20 16 28 22 38 24 ...
## $ rel.pref : num 0.615 0.615 0.615 0.615 0.615 ...
## $ rel.pref.o: num 0 0.526 NA 0.484 0.692 ...
## $ y : int 38 32 30 18 20 16 28 22 38 24 ...
## $ WH : num -0.154 -1.226 0.84 0.434 -1.774 ...
## $ PREF : num -0.398 -0.398 -0.398 -0.398 -0.398 ...
## $ date : num 3 3 3 3 3 3 3 3 3 3 ...
## $ DATE : num -0.478 -0.478 -0.478 -0.478 -0.478 ...
We have dams, sires and their offspring, i.e. parental and offspring generation.
## offspring dams sires
## 1 1425 246 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.87861 mins
## [1] 1 6 16 46 51 101 121 136 151 156 196 201 216 251 266 281 301 336 351
## [20] 386 401
## [1] 1 6 11 16 21 31 36 41 46 51 56 61 66 71 76 81 86 91 96
## [20] 101 106 111 116 121 126 131 136 141 156 161 166 176
##
## Iterations = 50001:549501
## Thinning interval = 500
## Sample size = 1000
##
## DIC: 8882.52
##
## G-structure: ~us(host):animal
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 18.45 11.004 26.40 1332.9
## hostM:hostC.animal 15.12 9.696 21.68 740.9
## hostC:hostM.animal 15.12 9.696 21.68 740.9
## hostM:hostM.animal 19.29 11.649 27.45 1000.0
##
## R-structure: ~idh(host):units
##
## post.mean l-95% CI u-95% CI eff.samp
## hostC.units 21.9 15.96 27.81 1176
## hostM.units 19.2 13.02 25.18 1000
##
## 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) 23.46440 22.43163 24.73896 908.4 <0.001 ***
## hostM 3.35632 2.59515 3.97491 1000.0 <0.001 ***
## WH -0.53336 -0.92965 -0.11066 1000.0 0.016 *
## ord.f -0.34542 -0.76600 0.06885 1000.0 0.100 .
## DATE 0.52057 -0.11282 1.27268 1000.0 0.110
## PREF 0.19451 -0.36551 0.73299 1000.0 0.500
## hostM:WH 0.53005 -0.05209 1.12435 1000.0 0.078 .
## hostM:DATE -0.56724 -1.27240 0.11666 1000.0 0.114
## hostM:PREF -0.30423 -0.91632 0.40205 1000.0 0.394
## ---
## 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 16.489 11.004,26.402
## 2 hostM:hostC.animal 15.466 9.696,21.677
## 3 hostC:hostM.animal 15.466 9.696,21.677
## 4 hostM:hostM.animal 19.877 11.649,27.454
## 5 hostC.units 22.43 15.96,27.815
## 6 hostM.units 21.025 13.021,25.177
## 7 (Intercept) 23.62 22.432,24.739
## 8 hostM 3.338 2.595,3.975
## 9 WH -0.499 -0.93,-0.111
## 10 ord.f -0.306 -0.766,0.069
## 11 DATE 0.443 -0.113,1.273
## 12 PREF 0.219 -0.366,0.733
## 13 hostM:WH 0.456 -0.052,1.124
## 14 hostM:DATE -0.625 -1.272,0.117
## 15 hostM:PREF -0.369 -0.916,0.402
Session info:
## Time difference of 72.12401 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