PART 3B (Larval survival - juveniles only): ‘Minimal’ and ‘Full’ models (testing all 4 predictions)

Data preparation

Load libraries and read the full dataset (N = 3 431). We remove entries from dams for which host preference was not recorded.

##                      Cowpea Mung
## Larval survival rate  0.889 0.93
## 'data.frame':    3146 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/ 249 levels "d101","d102",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ IDm       : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 18 18 18 18 18 18 ...
##  $ ord.f     : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ pref.C    : int  8 8 8 8 8 8 8 8 8 8 ...
##  $ pref.tot  : int  13 13 13 13 13 13 13 13 13 13 ...
##  $ host      : Factor w/ 2 levels "C","M": 1 2 1 2 1 2 1 1 1 1 ...
##  $ Whost     : num  355 70.9 357.2 77.9 293.4 ...
##  $ IDo       : int  1 1 2 2 3 3 4 5 6 7 ...
##  $ code      : Factor w/ 3146 levels "C-101-1","C-101-10",..: 1 1728 3 1729 4 1730 5 6 7 8 ...
##  $ state     : Factor w/ 2 levels "dead","emerged": 2 2 2 2 2 2 2 1 2 2 ...
##  $ day.em    : Factor w/ 23 levels "","1.5.18","10.4.18",..: 16 6 9 4 8 5 8 1 9 7 ...
##  $ dev.dur.o : int  40 31 34 29 33 30 33 NA 34 32 ...
##  $ Wo        : num  3.53 7.98 3.21 3.9 4.36 ...
##  $ sex       : Factor w/ 3 levels "","f","m": 3 2 3 3 3 2 3 1 2 2 ...
##  $ mated     : Factor w/ 4 levels "","not","succ",..: 2 3 2 2 2 3 2 1 2 3 ...
##  $ pref.C.o  : int  NA 0 NA NA NA 10 NA NA NA 15 ...
##  $ pref.tot.o: int  NA 1 NA NA NA 19 NA NA NA 31 ...
##  $ day.dead  : Factor w/ 45 levels "","1.5.18","10.5.18",..: 30 21 34 2 5 8 5 1 11 17 ...
##  $ adsurv.o  : int  4 38 12 20 27 32 27 NA 30 18 ...
##  $ rel.pref  : num  0.615 0.615 0.615 0.615 0.615 ...
##  $ rel.pref.o: num  NA 0 NA NA NA ...
##  $ y         : Factor w/ 2 levels "dead","emerged": 2 2 2 2 2 2 2 1 2 2 ...
##  $ WH        : num  1.36933 -0.16654 1.41634 0.76934 0.00367 ...
##  $ PREF      : num  -0.408 -0.408 -0.408 -0.408 -0.408 ...
##  $ date      : num  3 3 3 3 3 3 3 3 3 3 ...
##  $ DATE      : num  -0.511 -0.511 -0.511 -0.511 -0.511 ...
Creating pedigree for the animal model approach

We have dams, sires and their offspring, i.e. parental and offspring generation.

##   offspring dams sires
## 1      3146  249    82

Bayesian ‘animal’ model approach to comparison of minimal models (DIC) and phenotypic variance partitioning

The minimal model contains only fixed effects stemming from our experimental design. The fixed effects are: host type (host, “C” (original)/“M” (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). Additive genetic variance is specified using the pedigree and the identity of the offspring as animal in the random-effect part. Maternal effects above the additive genetic variance (including non-genetic and genetic maternal effects, but also genetic dominance) is specified with calling dam in the random-effect part of the model. We defined the random effects for each host separately as interaction with host - animal (host:animal) and dam (host:dam). We extracted additive genetic (proxy of GxE) and maternal effects covariance (MxE) between novel and original host using term us (unstructured). Note that in the binomial model, residual variance is fixed to 1 (see priors), so the model becomes estimable.

Below, we provide outcome for the best-selected model structure in the continuous traits (Gcov) and for comparison also the estimates from the most complex saturated model (Gcov + Mcov).


The Gcov model (the best model for all the continuous traits)

Here, we specify both separate variance per host type and cross-environmental covariance for additive genetic (animal). Maternal effects are ignored. Residual variance (units) is set to 1 (fix=1).

## Time difference of 8.303483 hours

##  [1]   1   6  11  16  26  31  41  51  61  76  81  91 121
##  [1]  1  6 11 26 31 36 41 51 56 61 66 81 86 91
## 
##  Iterations = 500001:5490001
##  Thinning interval  = 5000
##  Sample size  = 999 
## 
##  DIC: 1839.752 
## 
##  G-structure:  ~us(host):animal
## 
##                    post.mean   l-95% CI u-95% CI eff.samp
## hostC:hostC.animal    1.2854  6.402e-02    2.722    999.0
## hostM:hostC.animal    0.2958 -6.094e-01    1.195    936.7
## hostC:hostM.animal    0.2958 -6.094e-01    1.195    936.7
## hostM:hostM.animal    1.3671  7.282e-06    3.534    835.0
## 
##  R-structure:  ~units
## 
##       post.mean l-95% CI u-95% CI eff.samp
## units         1        1        1        0
## 
##  Location effects: y ~ host + WH + ord.f + DATE 
## 
##             post.mean  l-95% CI  u-95% CI eff.samp  pMCMC   
## (Intercept)  2.871323  2.347545  3.377522     1115 <0.001 **
## hostM        0.608837 -0.110407  1.398235      999 0.0821 . 
## WH          -0.168751 -0.311231 -0.001735      999 0.0280 * 
## ord.f       -0.028113 -0.188128  0.126334      999 0.7508   
## DATE         0.081407 -0.098633  0.259491      999 0.3864   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Copy-friendly output of the ‘minimal’ model:

##                   Par    Est     95% CredI
## 1  hostC:hostC.animal  0.916   0.064,2.722
## 2  hostM:hostC.animal  0.002  -0.609,1.195
## 3  hostC:hostM.animal  0.002  -0.609,1.195
## 4  hostM:hostM.animal  0.804       0,3.534
## 5               units      1           1,1
## 6         (Intercept)  2.782   2.348,3.378
## 7               hostM  0.631   -0.11,1.398
## 8                  WH -0.159 -0.311,-0.002
## 9               ord.f -0.071  -0.188,0.126
## 10               DATE  0.095  -0.099,0.259
Estimating heritability and evolvability

We calculate heritability and evolvability based on the minimal model, i.e. after accounting for the design effects (bean mass, dam mating order, day mated). Additive genetic variance is given by animal.

Additive genetic variance: \(V_{A} = V_{animal}\)

Heritability: \(h^{2} = V_{A}/(V_{A} + V_{M} + V_{residual})\)

Coef. of add. gen. variation: \(CV_{A} = \sqrt{V_{A}}/\overline{y}\)

Evolvability: \(e_{\mu} = V_{A}/\overline{y}^2\), or \(e_{\mu} = CV_{A}^2\)

Parameter estimates in the original host type (Cowpea)

##        Est       CredI
## Vadd 0.916 0.064,2.722
## Vres 1.000         1,1
## Vtot 1.916 1.064,3.722
## h2   0.608 0.222,0.794
## CVa  1.401 0.524,2.004
## emu  1.159 0.081,3.444
## [1] "Raw scale estimates (QGparams):"
## [1] "Computing observed mean..."
## [1] "Computing variances..."
## [1] "Computing Psi..."
##        Est
## mean 0.894
## Vtot 0.094
## Vadd 0.006
## h2   0.060
## CVa  0.084
## emu  0.007

and in the novel (Mung)

##        Est       CredI
## Vadd 0.804     0,3.534
## Vres 1.000         1,1
## Vtot 1.804     1,4.534
## h2   0.624  0.06,0.821
## CVa  1.072 0.189,2.149
## emu  0.929     0,4.086
## [1] "Raw scale estimates (QGparams):"
## [1] "Computing observed mean..."
## [1] "Computing variances..."
## [1] "Computing Psi..."
##        Est
## mean 0.930
## Vtot 0.065
## Vadd 0.003
## h2   0.040
## CVa  0.055
## emu  0.003
Estimating cross-environmental genetic correlation

Using the additive genetic covariance between the two hosts, we estimate

genetic correlation: \(r_{G} = COV_{A(novel-original)}/\sqrt{(V_{A(novel)}V_{A(orignal)})}\)

##                             Est        CredI
## genetic correlation (rG): 0.286 -0.469,0.985

The Gcov + Mcov model (saturated model - NOT USED)

Here, we specify both separate variance per host type and the cross-environmental covariance for both additive genetic (animal) and maternal effects (dam). Residual variance (units) is set to 1 (fix=1).

## Time difference of 8.757259 hours

##  [1]   1   6  16  26  31  41  61  76  81  91  96 116 121
##  [1]   1   6  11  21  26  31  46  51  56  61  66  71  76  81  91  96 101 106 111
## [20] 116 121 126 141 146 151 161 166 171 181 186 191 201 206 211 226 231 236 241
## [39] 246 251 256 261 271 276 281 286 291 296 301 306 321 326 331 341 346 351
## 
##  Iterations = 500001:5490001
##  Thinning interval  = 5000
##  Sample size  = 999 
## 
##  DIC: 1844.241 
## 
##  G-structure:  ~us(host):animal
## 
##                    post.mean   l-95% CI u-95% CI eff.samp
## hostC:hostC.animal    0.6477  1.719e-06   1.9181      999
## hostM:hostC.animal    0.1164 -4.693e-01   0.9724      999
## hostC:hostM.animal    0.1164 -4.693e-01   0.9724      999
## hostM:hostM.animal    1.0430  6.940e-05   2.8938      999
## 
##                ~us(host):dam
## 
##                 post.mean   l-95% CI u-95% CI eff.samp
## hostC:hostC.dam   0.39513  1.497e-06   0.9036    999.0
## hostM:hostC.dam   0.09348 -1.735e-01   0.4480    999.0
## hostC:hostM.dam   0.09348 -1.735e-01   0.4480    999.0
## hostM:hostM.dam   0.24102  1.196e-08   0.8159    908.1
## 
##  R-structure:  ~units
## 
##       post.mean l-95% CI u-95% CI eff.samp
## units         1        1        1        0
## 
##  Location effects: y ~ host + WH + ord.f + DATE 
## 
##             post.mean l-95% CI u-95% CI eff.samp  pMCMC   
## (Intercept)   2.80187  2.29494  3.32137    999.0 <0.001 **
## hostM         0.64095  0.02194  1.44672    999.0  0.046 * 
## WH           -0.16596 -0.31633 -0.01136    999.0  0.042 * 
## ord.f        -0.02278 -0.19663  0.14358    781.4  0.791   
## DATE          0.08889 -0.09198  0.26299   1069.1  0.350   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Copy-friendly output of the ‘minimal’ model:

##                   Par    Est     95% CredI
## 1  hostC:hostC.animal   0.01       0,1.918
## 2  hostM:hostC.animal  0.002  -0.469,0.972
## 3  hostC:hostM.animal  0.002  -0.469,0.972
## 4  hostM:hostM.animal  0.012       0,2.894
## 5     hostC:hostC.dam  0.006       0,0.904
## 6     hostM:hostC.dam -0.001  -0.174,0.448
## 7     hostC:hostM.dam -0.001  -0.174,0.448
## 8     hostM:hostM.dam  0.006       0,0.816
## 9               units      1           1,1
## 10        (Intercept)  2.776   2.295,3.321
## 11              hostM  0.612   0.022,1.447
## 12                 WH -0.208 -0.316,-0.011
## 13              ord.f -0.038  -0.197,0.144
## 14               DATE  0.102  -0.092,0.263
Estimating heritability, evolvability and maternal effects

We calculate heritability, evolvability and maternal effects based on the minimal model, i.e. after accounting for the design effects (bean mass, dam mating order, day mated). Additive genetic variance is given by animal.

Additive genetic variance: \(V_{A} = V_{animal}\)

Maternal effects above the additive genetic effects: \(V_M = V_{dam}\)

Maternal effects proportion: \(m^2 = V_{M}/(V_{A} + V_{M} + V_{residual})\)

Heritability: \(h^{2} = V_{A}/(V_{A} + V_{M} + V_{residual})\)

Coef. of add. gen. variation: \(CV_{A} = \sqrt{V_{A}}/\overline{y}\)

Evolvability: \(e_{\mu} = V_{A}/\overline{y}^2\), or \(e_{\mu} = CV_{A}^2\)

Parameter estimates in the original host type (Cowpea)

##        Est       CredI
## Vadd 0.010     0,1.918
## Vmat 0.006     0,0.904
## Vres 1.000         1,1
## Vtot 1.524 1.152,3.262
## m2   0.002     0,0.443
## h2   0.004     0,0.631
## CVa  0.466 0.004,1.559
## emu  0.012     0,2.427
## [1] "Raw scale estimates (QGparams):"
## [1] "Computing observed mean..."
## [1] "Computing variances..."
## [1] "Computing Psi..."
##        Est
## mean 0.903
## Vtot 0.087
## Vadd 0.000
## h2   0.001
## CVa  0.008
## emu  0.000

and in the novel (Mung)

##        Est       CredI
## Vadd 0.012     0,2.894
## Vmat 0.006     0,0.816
## Vres 1.000         1,1
## Vtot 1.448  1.01,4.054
## m2   0.002     0,0.368
## h2   0.003     0,0.722
## CVa  1.109 0.009,1.829
## emu  0.014     0,3.346
## [1] "Raw scale estimates (QGparams):"
## [1] "Computing observed mean..."
## [1] "Computing variances..."
## [1] "Computing Psi..."
##        Est
## mean 0.943
## Vtot 0.054
## Vadd 0.000
## h2   0.001
## CVa  0.006
## emu  0.000
Estimating cross-environmental genetic correlation and maternal effects covariance

Using the additive genetic covariance between the two hosts, we estimate

genetic correlation: \(r_{G} = COV_{A(novel-original)}/\sqrt{(V_{A(novel)}V_{A(orignal)})}\)

dam-related covariance between offspring in the original and novel host: \(COV_{dam(novel-original)}\) (Due to low maternal effects variance in both hosts and potential computational problems - dividing by zero; we do not estimate maternal effects correlation (\(r_{M}\)). The covariance estimate is unreliable because of the low variance too.)

##                             Est    CredI
## genetic correlation (rG): 0.505 -0.825,1
##                                          Est        CredI
## dam-related covariance novel-original -0.001 -0.174,0.448

Bayesian full model (animal model approach):

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 for all the continuous traits (Gcov) and omitted maternal effects as they proved to be negligible in the traits we study (see also the Gcov + Mcov model above). 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 the correlation (\(r_{G}\)). Residual variation was was fixed to 1.

## Time difference of 10.04946 hours

##  [1]   1   6  11  16  26  46  51  76  91 101 121 136 151 201 216 226 251 266 276
## [20] 281 301 336 351 386 401
##  [1]  1  6 11 26 31 36 41 51 56 61 66 81 86 91
## 
##  Iterations = 500001:5490001
##  Thinning interval  = 5000
##  Sample size  = 999 
## 
##  DIC: 1840.441 
## 
##  G-structure:  ~us(host):animal
## 
##                    post.mean  l-95% CI u-95% CI eff.samp
## hostC:hostC.animal    1.3832  0.002722    2.918    999.0
## hostM:hostC.animal    0.3271 -0.527271    1.329    869.1
## hostC:hostM.animal    0.3271 -0.527271    1.329    869.1
## hostM:hostM.animal    1.3372  0.000031    3.497    906.3
## 
##  R-structure:  ~units
## 
##       post.mean l-95% CI u-95% CI eff.samp
## units         1        1        1        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)   2.90516  2.34052  3.44057    999.0 <0.001 **
## hostM         0.60032 -0.09438  1.44721    999.0 0.0901 . 
## WH           -0.14395 -0.35315  0.04967    941.5 0.1682   
## ord.f        -0.02821 -0.20611  0.12442    999.0 0.7568   
## DATE          0.13502 -0.15314  0.35020    999.0 0.2583   
## PREF         -0.04355 -0.25807  0.18346    999.0 0.7107   
## hostM:WH     -0.06797 -0.37605  0.22138   1096.5 0.6787   
## hostM:DATE   -0.14829 -0.50116  0.24034    999.0 0.4044   
## hostM:PREF    0.20597 -0.10636  0.54910    999.0 0.2202   
## ---
## 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.693  0.003,2.918
## 2  hostM:hostC.animal  0.011 -0.527,1.329
## 3  hostC:hostM.animal  0.011 -0.527,1.329
## 4  hostM:hostM.animal  0.007      0,3.497
## 5               units      1          1,1
## 6         (Intercept)  2.868  2.341,3.441
## 7               hostM  0.512 -0.094,1.447
## 8                  WH -0.161  -0.353,0.05
## 9               ord.f -0.021 -0.206,0.124
## 10               DATE  0.095  -0.153,0.35
## 11               PREF -0.042 -0.258,0.183
## 12           hostM:WH -0.035 -0.376,0.221
## 13         hostM:DATE -0.122  -0.501,0.24
## 14         hostM:PREF  0.242 -0.106,0.549

Session info:

## Time difference of 27.1102 hours
## 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