PART 3A (Host preference - daughters only): ‘Minimal’ and ‘Full’ models (testing all 4 predictions)

Data preparation

Load libraries and read the full dataset (N = 3 431) of which we recorded host preference for 665 daughters. We remove offspring of dams for which host preference was not recorded.

##                               Cowpea  Mung
## Daughter preference of Cowpea  0.681 0.517
## 'data.frame':    665 obs. of  26 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/ 239 levels "d101","d102",..: 1 1 1 1 2 2 2 2 3 3 ...
##  $ IDm       : Factor w/ 82 levels "s11","s12","s13",..: 18 18 18 18 20 20 20 20 21 21 ...
##  $ ord.f     : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ pref.C    : int  8 8 8 8 3 3 3 3 13 13 ...
##  $ pref.tot  : int  13 13 13 13 10 10 10 10 14 14 ...
##  $ host      : Factor w/ 2 levels "C","M": 2 2 1 1 1 1 2 2 1 1 ...
##  $ Whost     : num  70.9 62.6 310.1 210.4 332 ...
##  $ IDo       : int  1 3 7 8 1 3 5 6 2 5 ...
##  $ code      : Factor w/ 665 levels "C-101-7","C-101-8",..: 365 366 1 2 3 4 367 368 5 6 ...
##  $ 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",..: 4 3 5 3 4 4 3 3 3 4 ...
##  $ dev.dur.o : int  31 30 32 30 31 31 30 30 30 31 ...
##  $ Wo        : num  7.98 7.79 5.55 7.03 4.32 ...
##  $ sex       : Factor w/ 1 level "f": 1 1 1 1 1 1 1 1 1 1 ...
##  $ mated     : Factor w/ 1 level "succ": 1 1 1 1 1 1 1 1 1 1 ...
##  $ pref.C.o  : int  0 10 15 9 15 18 10 3 7 13 ...
##  $ pref.tot.o: int  1 19 31 13 21 20 19 12 13 24 ...
##  $ day.dead  : Factor w/ 35 levels "","1.5.18","10.5.18",..: 17 7 13 13 27 31 32 30 31 26 ...
##  $ adsurv.o  : int  38 32 18 20 16 22 24 22 23 15 ...
##  $ rel.pref  : num  0.615 0.615 0.615 0.615 0.3 ...
##  $ rel.pref.o: num  0 0.526 0.484 0.692 0.714 ...
##  $ WH        : num  -0.113 -1.168 0.48 -1.75 0.97 ...
##  $ PREF      : num  -0.38 -0.38 -0.38 -0.38 -1.63 ...
##  $ date      : num  3 3 3 3 3 3 3 3 3 3 ...
##  $ DATE      : num  -0.489 -0.489 -0.489 -0.489 -0.489 ...
Creating pedigree for the animal model approach

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

##   offspring dams sires
## 1       665  239    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). Residual variance was allowed to be estimated separately per host type (rcov=~idh(host):units).

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. We estimate residual variance (units) separately per each host type.

##  [1]   1   6  16  26  31  61  76  91  96 116 121
##  [1]   1  36  41  46  66  71  76  96 101 106 141 176
## 
##  Iterations = 60001:359701
##  Thinning interval  = 300
##  Sample size  = 1000 
## 
##  DIC: 19846.32 
## 
##  G-structure:  ~us(host):animal
## 
##                    post.mean   l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 1.056e-03  3.146e-09 0.003833     1000
## hostM:hostC.animal 2.498e-05 -1.386e-03 0.001191     1000
## hostC:hostM.animal 2.498e-05 -1.386e-03 0.001191     1000
## hostM:hostM.animal 1.244e-03  2.775e-09 0.004807     1000
## 
##  R-structure:  ~idh(host):units
## 
##             post.mean l-95% CI u-95% CI eff.samp
## hostC.units   0.02983  0.02030  0.04032     1160
## hostM.units   0.03480  0.02322  0.04848     1000
## 
##  Location effects: cbind(pref.C.o, pref.tot.o) ~ host + WH + ord.f + DATE 
## 
##             post.mean  l-95% CI  u-95% CI eff.samp  pMCMC    
## (Intercept) -0.434883 -0.527074 -0.351040     1000 <0.001 ***
## hostM       -0.247735 -0.330321 -0.181139     1000 <0.001 ***
## WH           0.005534 -0.029727  0.042473     1000  0.778    
## ord.f        0.008708 -0.022501  0.049018     1000  0.640    
## DATE        -0.049622 -0.088381 -0.013052     1185 <0.001 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Time difference of 7.456047 mins
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. Maternal effects variance is ignored.

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

Heritability: \(h^{2} = V_{A}/(V_{A} + 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.000     0,0.004
## Vres 0.029   0.02,0.04
## Vtot 0.030 0.021,0.043
## h2   0.001     0,0.119
## CVa  0.010      0,0.12
## emu  0.000     0,0.014
## [1] "Raw scale estimates (QGparams):"
## [1] "Using the closed forms for a Poisson - log model."
##    mean.obs   var.obs    var.a.obs      h2.obs
## 1 0.6574141 0.6709698 0.0004565064 0.000680368

and in the novel (Mung)

##        Est       CredI
## Vadd 0.000     0,0.005
## Vres 0.035 0.023,0.048
## Vtot 0.036  0.024,0.05
## h2   0.001     0,0.126
## CVa  0.008     0,0.134
## emu  0.000     0,0.018
## [1] "Raw scale estimates (QGparams):"
## [1] "Using the closed forms for a Poisson - log model."
##    mean.obs   var.obs   var.a.obs      h2.obs
## 1 0.5144804 0.5241939 0.001317166 0.002512746
Estimating cross-environmental genetic correlation (GxE)

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.046 -0.905,0.948

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). We estimate residual variance (units) separately per each host type.

##  [1]   1   6  11  16  21  26  31  51  61  66  76  86  91  96 101 107 116 121
##  [1]   1   6  11  51  56  61  66 101 106 111 116 156 161 166 221 276 281 326 331
## [20] 386 441 496
## 
##  Iterations = 50001:549501
##  Thinning interval  = 500
##  Sample size  = 1000 
## 
##  DIC: 19849.88 
## 
##  G-structure:  ~us(host):animal
## 
##                    post.mean   l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 9.572e-04  5.566e-10 0.003374     1000
## hostM:hostC.animal 2.797e-05 -1.358e-03 0.001604     1153
## hostC:hostM.animal 2.797e-05 -1.358e-03 0.001604     1153
## hostM:hostM.animal 1.335e-03  3.947e-08 0.005335     1000
## 
##                ~us(host):dam
## 
##                 post.mean   l-95% CI u-95% CI eff.samp
## hostC:hostC.dam 9.455e-04  5.859e-11 0.003675     1000
## hostM:hostC.dam 1.356e-05 -1.402e-03 0.001443     1146
## hostC:hostM.dam 1.356e-05 -1.402e-03 0.001443     1146
## hostM:hostM.dam 1.250e-03  8.811e-10 0.004600     1000
## 
##  R-structure:  ~idh(host):units
## 
##             post.mean l-95% CI u-95% CI eff.samp
## hostC.units   0.02966  0.02064  0.03986    924.3
## hostM.units   0.03446  0.02189  0.04787   1000.0
## 
##  Location effects: cbind(pref.C.o, pref.tot.o) ~ host + WH + ord.f + DATE 
## 
##             post.mean  l-95% CI  u-95% CI eff.samp  pMCMC    
## (Intercept) -0.435620 -0.525712 -0.337571     1000 <0.001 ***
## hostM       -0.248258 -0.323750 -0.182367     1000 <0.001 ***
## WH           0.005825 -0.032325  0.042212     1000  0.770    
## ord.f        0.008673 -0.029079  0.043008     1000  0.638    
## DATE        -0.048329 -0.080627 -0.007699     1000  0.020 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Time difference of 13.7619 mins
Estimating heritability, evolvability and maternal effects

We calculate heritability, evolvability and maternal effects proportion 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_{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.000     0,0.003
## Vmat 0.000     0,0.004
## Vres 0.027  0.021,0.04
## Vtot 0.028 0.022,0.042
## m2   0.000     0,0.111
## h2   0.000     0,0.107
## CVa  0.016     0,0.113
## emu  0.000     0,0.013
## [1] "Raw scale estimates (QGparams):"
## [1] "Using the closed forms for a Poisson - log model."
##    mean.obs   var.obs    var.a.obs       h2.obs
## 1 0.6571536 0.6710023 0.0004133827 0.0006160675

and in the novel (Mung)

##        Est       CredI
## Vadd 0.000     0,0.005
## Vmat 0.000     0,0.005
## Vres 0.032 0.022,0.048
## Vtot 0.033 0.025,0.053
## m2   0.001     0,0.116
## h2   0.001     0,0.141
## CVa  0.010     0,0.141
## emu  0.000      0,0.02
## [1] "Raw scale estimates (QGparams):"
## [1] "Using the closed forms for a Poisson - log model."
##    mean.obs   var.obs   var.a.obs      h2.obs
## 1 0.5140896 0.5240625 0.001410833 0.002692108
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.022 -0.898,0.999
##                                       Est        CredI
## dam-related covariance novel-original   0 -0.001,0.001

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 allowed to be estimated separately per host type (rcov=~idh(host):units).

## Time difference of 12.50469 mins

##  [1]   1   6  16  46  51 101 121 136 151 156 196 201 206 216 246 251 266 281 301
## [20] 336 351 386 401
## [1]   1  36  41  66  71 106 141 176
## 
##  Iterations = 50001:549501
##  Thinning interval  = 500
##  Sample size  = 1000 
## 
##  DIC: 19853.27 
## 
##  G-structure:  ~us(host):animal
## 
##                    post.mean   l-95% CI u-95% CI eff.samp
## hostC:hostC.animal 9.256e-04  1.446e-10 0.003368   1000.0
## hostM:hostC.animal 3.521e-05 -1.317e-03 0.001385   1157.4
## hostC:hostM.animal 3.521e-05 -1.317e-03 0.001385   1157.4
## hostM:hostM.animal 1.298e-03  2.496e-09 0.005600    904.4
## 
##  R-structure:  ~idh(host):units
## 
##             post.mean l-95% CI u-95% CI eff.samp
## hostC.units   0.02959  0.01960  0.04022   1000.0
## hostM.units   0.03421  0.02225  0.04594    906.5
## 
##  Location effects: cbind(pref.C.o, pref.tot.o) ~ host + WH + ord.f + DATE + PREF + WH:host + DATE:host + PREF:host 
## 
##              post.mean   l-95% CI   u-95% CI eff.samp  pMCMC    
## (Intercept) -0.4333866 -0.5277276 -0.3381198     1592 <0.001 ***
## hostM       -0.2491236 -0.3241015 -0.1802623     1000 <0.001 ***
## WH           0.0003389 -0.0463467  0.0491787     1000  0.980    
## ord.f        0.0080676 -0.0270372  0.0470594     1000  0.690    
## DATE        -0.0507864 -0.0936524  0.0035481     1000  0.048 *  
## PREF         0.0084391 -0.0414349  0.0571935     1000  0.732    
## hostM:WH     0.0108014 -0.0748511  0.0761709     1000  0.760    
## hostM:DATE   0.0035927 -0.0661617  0.0831093     1000  0.942    
## hostM:PREF  -0.0258098 -0.0956927  0.0494892     1000  0.502    
## ---
## 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       0,0.003
## 2  hostM:hostC.animal      0  -0.001,0.001
## 3  hostC:hostM.animal      0  -0.001,0.001
## 4  hostM:hostM.animal      0       0,0.006
## 5         hostC.units  0.029     0.02,0.04
## 6         hostM.units  0.032   0.022,0.046
## 7         (Intercept) -0.409 -0.528,-0.338
## 8               hostM -0.247  -0.324,-0.18
## 9                  WH   0.01  -0.046,0.049
## 10              ord.f -0.001  -0.027,0.047
## 11               DATE -0.053  -0.094,0.004
## 12               PREF  0.014  -0.041,0.057
## 13           hostM:WH  0.017  -0.075,0.076
## 14         hostM:DATE -0.016  -0.066,0.083
## 15         hostM:PREF -0.037  -0.096,0.049

Session info:

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