Historical Sweden sensitivity analyses

Loading details

source("0__helpers.R")
opts_chunk$set(warning=TRUE, cache=F,cache.lazy=F,tidy=FALSE,autodep=TRUE,dev=c('png','pdf'),fig.width=20,fig.height=12.5,out.width='1440px',out.height='900px')

make_path = function(file) {
    get_coefficient_path(file, "ddb")
} 
# options for each chunk calling knit_child
opts_chunk$set(warning=FALSE, message = FALSE, echo = FALSE)

Analysis description

Data subset

The ddb.1 dataset contains only those participants where paternal age is known and the birthdate is between 1760 and 1880.

Model description

All of the following models are the same as our main model m3, except for the noted changes to test robustness.

s1: Mediation via age

Here, we tested whether the effect on reproductive success is mediated by age (mortality). We entered an unknown age for people who did not have a death date on their records and most likely outlived the observation period of the church records.

Model summary

Full summary

model_summary = summary(model, use_cache = FALSE, priors = TRUE)
print(model_summary)
##  Family: hurdle_poisson(log) 
## Formula: children ~ paternalage + age + birth_cohort + male + maternalage.factor + paternalage.mean + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born + (1 | idParents) 
##          hu ~ paternalage + age + birth_cohort + male + maternalage.factor + paternalage.mean + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born + (1 | idParents)
##    Data: model_data (Number of observations: 56662) 
## Samples: 6 chains, each with iter = 1000; warmup = 500; thin = 1; 
##          total post-warmup samples = 3000
##    WAIC: Not computed
##  
## Priors: 
## b ~ normal(0,5)
## sd ~ student_t(3, 0, 5)
## b_hu ~ normal(0,5)
## sd_hu ~ student_t(3, 0, 10)
## 
## Group-Level Effects: 
## ~idParents (Number of levels: 14746) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.35      0.01     0.34     0.36       1244 1.00
## sd(hu_Intercept)     0.95      0.02     0.90     0.99        892 1.01
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     1.08      0.08     0.93     1.24        193
## paternalage                  -0.05      0.02    -0.09    -0.01        791
## age50102                      0.27      0.01     0.25     0.29       2347
## age025                       -1.86      0.15    -2.16    -1.59       2005
## ageunknown                    0.13      0.01     0.10     0.15       2500
## birth_cohort1750M1755        -0.14      0.11    -0.37     0.08        540
## birth_cohort1755M1760         0.12      0.09    -0.06     0.31        278
## birth_cohort1760M1765         0.20      0.09     0.03     0.36        215
## birth_cohort1765M1770         0.15      0.08    -0.02     0.31        203
## birth_cohort1770M1775         0.11      0.09    -0.06     0.28        217
## birth_cohort1775M1780         0.09      0.08    -0.08     0.26        205
## birth_cohort1780M1785         0.20      0.08     0.03     0.36        209
## birth_cohort1785M1790         0.15      0.08    -0.01     0.31        194
## birth_cohort1790M1795         0.08      0.08    -0.08     0.23        183
## birth_cohort1795M1800         0.07      0.08    -0.07     0.22        177
## birth_cohort1800M1805         0.01      0.08    -0.13     0.16        173
## birth_cohort1805M1810         0.03      0.07    -0.11     0.18        170
## birth_cohort1810M1815         0.06      0.07    -0.08     0.21        166
## birth_cohort1815M1820         0.12      0.07    -0.01     0.27        165
## birth_cohort1820M1825         0.16      0.07     0.02     0.30        165
## birth_cohort1825M1830         0.13      0.07    -0.01     0.28        164
## birth_cohort1830M1835         0.17      0.07     0.03     0.31        168
## birth_cohort1835M1840         0.18      0.07     0.03     0.32        168
## birth_cohort1840M1845         0.17      0.07     0.02     0.31        169
## birth_cohort1845M1850         0.18      0.07     0.04     0.33        166
## male1                         0.03      0.01     0.02     0.04       3000
## maternalage.factor1020        0.04      0.03    -0.02     0.10       3000
## maternalage.factor3559        0.06      0.01     0.04     0.08       2000
## paternalage.mean              0.06      0.02     0.02     0.09        811
## paternal_loss01               0.06      0.04    -0.01     0.13       3000
## paternal_loss15               0.03      0.02    -0.01     0.08       1369
## paternal_loss510             -0.02      0.02    -0.06     0.02       1351
## paternal_loss1015            -0.02      0.02    -0.05     0.02       1399
## paternal_loss1520            -0.07      0.02    -0.10    -0.03       1179
## paternal_loss2025            -0.02      0.02    -0.05     0.01       1058
## paternal_loss2530            -0.02      0.01    -0.05     0.01       1063
## paternal_loss3035            -0.02      0.01    -0.04     0.01       1198
## paternal_loss3540             0.02      0.01     0.00     0.05       1291
## paternal_loss4045             0.03      0.01     0.00     0.06       1811
## maternal_loss01               0.08      0.05    -0.03     0.18       3000
## maternal_loss15               0.01      0.03    -0.04     0.07       1577
## maternal_loss510             -0.01      0.02    -0.06     0.03       1618
## maternal_loss1015            -0.03      0.02    -0.07     0.02       1640
## maternal_loss1520            -0.03      0.02    -0.07     0.01       1708
## maternal_loss2025            -0.06      0.02    -0.10    -0.03       1460
## maternal_loss2530            -0.02      0.02    -0.05     0.01       1492
## maternal_loss3035            -0.02      0.01    -0.04     0.01       1340
## maternal_loss3540             0.00      0.01    -0.02     0.03       1614
## maternal_loss4045            -0.01      0.01    -0.04     0.01       2046
## older_siblings1               0.02      0.01     0.00     0.04       1513
## older_siblings2               0.03      0.01     0.00     0.06        947
## older_siblings3               0.03      0.02     0.00     0.07        939
## older_siblings4               0.01      0.02    -0.03     0.05        896
## older_siblings5P              0.02      0.03    -0.03     0.07        845
## nr.siblings                   0.02      0.00     0.02     0.03        877
## last_born1                   -0.02      0.01    -0.04     0.00       3000
## hu_Intercept                 -0.27      0.23    -0.73     0.20        192
## hu_paternalage               -0.33      0.07    -0.47    -0.20        655
## hu_age50102                  -1.32      0.05    -1.42    -1.23       2367
## hu_age025                     5.99      0.11     5.78     6.19       3000
## hu_ageunknown                 0.74      0.04     0.67     0.82       2175
## hu_birth_cohort1750M1755      0.26      0.34    -0.42     0.95        522
## hu_birth_cohort1755M1760      0.00      0.29    -0.58     0.57        319
## hu_birth_cohort1760M1765     -0.28      0.27    -0.81     0.28        245
## hu_birth_cohort1765M1770     -0.53      0.26    -1.06    -0.02        236
## hu_birth_cohort1770M1775     -0.37      0.28    -0.91     0.18        242
## hu_birth_cohort1775M1780     -0.39      0.26    -0.91     0.14        227
## hu_birth_cohort1780M1785     -0.47      0.27    -1.02     0.07        242
## hu_birth_cohort1785M1790     -0.29      0.25    -0.79     0.24        227
## hu_birth_cohort1790M1795     -0.15      0.23    -0.62     0.30        191
## hu_birth_cohort1795M1800     -0.21      0.23    -0.68     0.26        189
## hu_birth_cohort1800M1805     -0.32      0.23    -0.78     0.13        181
## hu_birth_cohort1805M1810     -0.44      0.23    -0.89     0.02        174
## hu_birth_cohort1810M1815     -0.33      0.22    -0.78     0.12        176
## hu_birth_cohort1815M1820     -0.53      0.22    -0.99    -0.09        173
## hu_birth_cohort1820M1825     -0.73      0.22    -1.18    -0.31        170
## hu_birth_cohort1825M1830     -0.84      0.22    -1.29    -0.40        168
## hu_birth_cohort1830M1835     -1.02      0.22    -1.47    -0.58        170
## hu_birth_cohort1835M1840     -1.10      0.22    -1.55    -0.66        168
## hu_birth_cohort1840M1845     -1.05      0.22    -1.49    -0.61        168
## hu_birth_cohort1845M1850     -1.09      0.22    -1.53    -0.65        168
## hu_male1                     -0.05      0.02    -0.09     0.00       3000
## hu_maternalage.factor1020     0.00      0.11    -0.22     0.22       3000
## hu_maternalage.factor3559     0.07      0.04     0.00     0.14       3000
## hu_paternalage.mean           0.32      0.07     0.18     0.46        696
## hu_paternal_loss01            0.58      0.12     0.36     0.81       3000
## hu_paternal_loss15            0.60      0.08     0.45     0.75       1602
## hu_paternal_loss510           0.66      0.06     0.54     0.79       1461
## hu_paternal_loss1015          0.45      0.06     0.33     0.57       1414
## hu_paternal_loss1520          0.42      0.05     0.31     0.53       1158
## hu_paternal_loss2025          0.30      0.05     0.20     0.40       1203
## hu_paternal_loss2530          0.24      0.05     0.15     0.34       1152
## hu_paternal_loss3035          0.18      0.05     0.08     0.27       1123
## hu_paternal_loss3540          0.15      0.05     0.06     0.24       1250
## hu_paternal_loss4045          0.07      0.05    -0.03     0.16       3000
## hu_maternal_loss01            0.99      0.16     0.68     1.30       3000
## hu_maternal_loss15            0.77      0.09     0.60     0.94       3000
## hu_maternal_loss510           0.73      0.07     0.59     0.86       3000
## hu_maternal_loss1015          0.72      0.07     0.59     0.85       3000
## hu_maternal_loss1520          0.59      0.06     0.48     0.72       3000
## hu_maternal_loss2025          0.42      0.05     0.31     0.52       3000
## hu_maternal_loss2530          0.24      0.05     0.15     0.34       1978
## hu_maternal_loss3035          0.21      0.05     0.11     0.30       1803
## hu_maternal_loss3540          0.12      0.04     0.04     0.20       3000
## hu_maternal_loss4045          0.05      0.04    -0.04     0.13       3000
## hu_older_siblings1            0.09      0.04     0.02     0.17       1267
## hu_older_siblings2            0.17      0.05     0.07     0.27        858
## hu_older_siblings3            0.27      0.06     0.14     0.40        751
## hu_older_siblings4            0.26      0.08     0.11     0.43        781
## hu_older_siblings5P           0.37      0.10     0.17     0.58        666
## hu_nr.siblings               -0.01      0.01    -0.03     0.01        817
## hu_last_born1                -0.03      0.03    -0.09     0.04       3000
##                           Rhat
## Intercept                 1.03
## paternalage               1.00
## age50102                  1.00
## age025                    1.00
## ageunknown                1.00
## birth_cohort1750M1755     1.01
## birth_cohort1755M1760     1.02
## birth_cohort1760M1765     1.02
## birth_cohort1765M1770     1.02
## birth_cohort1770M1775     1.02
## birth_cohort1775M1780     1.03
## birth_cohort1780M1785     1.03
## birth_cohort1785M1790     1.03
## birth_cohort1790M1795     1.03
## birth_cohort1795M1800     1.03
## birth_cohort1800M1805     1.03
## birth_cohort1805M1810     1.03
## birth_cohort1810M1815     1.03
## birth_cohort1815M1820     1.03
## birth_cohort1820M1825     1.03
## birth_cohort1825M1830     1.03
## birth_cohort1830M1835     1.03
## birth_cohort1835M1840     1.03
## birth_cohort1840M1845     1.03
## birth_cohort1845M1850     1.03
## male1                     1.00
## maternalage.factor1020    1.00
## maternalage.factor3559    1.00
## paternalage.mean          1.00
## paternal_loss01           1.00
## paternal_loss15           1.00
## paternal_loss510          1.00
## paternal_loss1015         1.00
## paternal_loss1520         1.00
## paternal_loss2025         1.00
## paternal_loss2530         1.01
## paternal_loss3035         1.01
## paternal_loss3540         1.01
## paternal_loss4045         1.00
## maternal_loss01           1.00
## maternal_loss15           1.00
## maternal_loss510          1.00
## maternal_loss1015         1.00
## maternal_loss1520         1.00
## maternal_loss2025         1.00
## maternal_loss2530         1.00
## maternal_loss3035         1.00
## maternal_loss3540         1.00
## maternal_loss4045         1.00
## older_siblings1           1.00
## older_siblings2           1.00
## older_siblings3           1.00
## older_siblings4           1.00
## older_siblings5P          1.00
## nr.siblings               1.01
## last_born1                1.00
## hu_Intercept              1.02
## hu_paternalage            1.00
## hu_age50102               1.00
## hu_age025                 1.00
## hu_ageunknown             1.00
## hu_birth_cohort1750M1755  1.01
## hu_birth_cohort1755M1760  1.01
## hu_birth_cohort1760M1765  1.01
## hu_birth_cohort1765M1770  1.01
## hu_birth_cohort1770M1775  1.02
## hu_birth_cohort1775M1780  1.01
## hu_birth_cohort1780M1785  1.01
## hu_birth_cohort1785M1790  1.02
## hu_birth_cohort1790M1795  1.02
## hu_birth_cohort1795M1800  1.02
## hu_birth_cohort1800M1805  1.02
## hu_birth_cohort1805M1810  1.02
## hu_birth_cohort1810M1815  1.02
## hu_birth_cohort1815M1820  1.02
## hu_birth_cohort1820M1825  1.02
## hu_birth_cohort1825M1830  1.02
## hu_birth_cohort1830M1835  1.02
## hu_birth_cohort1835M1840  1.02
## hu_birth_cohort1840M1845  1.02
## hu_birth_cohort1845M1850  1.02
## hu_male1                  1.00
## hu_maternalage.factor1020 1.00
## hu_maternalage.factor3559 1.00
## hu_paternalage.mean       1.00
## hu_paternal_loss01        1.00
## hu_paternal_loss15        1.00
## hu_paternal_loss510       1.00
## hu_paternal_loss1015      1.00
## hu_paternal_loss1520      1.00
## hu_paternal_loss2025      1.00
## hu_paternal_loss2530      1.00
## hu_paternal_loss3035      1.00
## hu_paternal_loss3540      1.00
## hu_paternal_loss4045      1.00
## hu_maternal_loss01        1.00
## hu_maternal_loss15        1.00
## hu_maternal_loss510       1.00
## hu_maternal_loss1015      1.00
## hu_maternal_loss1520      1.00
## hu_maternal_loss2025      1.00
## hu_maternal_loss2530      1.00
## hu_maternal_loss3035      1.00
## hu_maternal_loss3540      1.00
## hu_maternal_loss4045      1.00
## hu_older_siblings1        1.00
## hu_older_siblings2        1.00
## hu_older_siblings3        1.00
## hu_older_siblings4        1.00
## hu_older_siblings5P       1.00
## hu_nr.siblings            1.00
## hu_last_born1             1.00
## 
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample 
## is a crude measure of effective sample size, and Rhat is the potential 
## scale reduction factor on split chains (at convergence, Rhat = 1).

Table of fixed effects

Estimates are exp(b). When they are referring to the hurdle (hu) component, or a dichotomous outcome, they are odds ratios, when they are referring to a Poisson component, they are hazard ratios. In both cases, they are presented with 95% credibility intervals. To see the effects on the response scale (probability or number of children), consult the marginal effect plots.

fixed_eff = data.frame(model_summary$fixed, check.names = F)
fixed_eff$Est.Error = fixed_eff$Eff.Sample = fixed_eff$Rhat = NULL
fixed_eff$`Odds/hazard ratio` = exp(fixed_eff$Estimate)
fixed_eff$`OR/HR low 95%` = exp(fixed_eff$`l-95% CI`)
fixed_eff$`OR/HR high 95%` = exp(fixed_eff$`u-95% CI`)
fixed_eff = fixed_eff %>% select(`Odds/hazard ratio`, `OR/HR low 95%`, `OR/HR high 95%`)
pander::pander(fixed_eff)
  Odds/hazard ratio OR/HR low 95% OR/HR high 95%
Intercept 2.959 2.537 3.451
paternalage 0.9515 0.9173 0.9882
age50102 1.309 1.278 1.341
age025 0.1555 0.1149 0.2044
ageunknown 1.135 1.111 1.16
birth_cohort1750M1755 0.8677 0.6918 1.084
birth_cohort1755M1760 1.132 0.9435 1.366
birth_cohort1760M1765 1.218 1.029 1.436
birth_cohort1765M1770 1.163 0.9844 1.366
birth_cohort1770M1775 1.112 0.9393 1.32
birth_cohort1775M1780 1.098 0.926 1.291
birth_cohort1780M1785 1.216 1.034 1.435
birth_cohort1785M1790 1.167 0.9931 1.366
birth_cohort1790M1795 1.078 0.9231 1.256
birth_cohort1795M1800 1.076 0.9287 1.25
birth_cohort1800M1805 1.012 0.8769 1.169
birth_cohort1805M1810 1.034 0.8933 1.197
birth_cohort1810M1815 1.063 0.9207 1.228
birth_cohort1815M1820 1.131 0.9854 1.304
birth_cohort1820M1825 1.172 1.018 1.354
birth_cohort1825M1830 1.142 0.9924 1.322
birth_cohort1830M1835 1.184 1.029 1.364
birth_cohort1835M1840 1.195 1.035 1.382
birth_cohort1840M1845 1.183 1.025 1.366
birth_cohort1845M1850 1.2 1.041 1.386
male1 1.031 1.018 1.045
maternalage.factor1020 1.041 0.9836 1.102
maternalage.factor3559 1.065 1.042 1.088
paternalage.mean 1.058 1.018 1.098
paternal_loss01 1.063 0.9908 1.141
paternal_loss15 1.035 0.9882 1.085
paternal_loss510 0.9829 0.9425 1.023
paternal_loss1015 0.9832 0.9475 1.019
paternal_loss1520 0.9344 0.9046 0.9664
paternal_loss2025 0.9767 0.9466 1.008
paternal_loss2530 0.9806 0.9522 1.009
paternal_loss3035 0.9845 0.9582 1.012
paternal_loss3540 1.023 0.9977 1.05
paternal_loss4045 1.031 1.004 1.057
maternal_loss01 1.082 0.9729 1.201
maternal_loss15 1.014 0.9595 1.072
maternal_loss510 0.9884 0.9416 1.035
maternal_loss1015 0.9743 0.9334 1.017
maternal_loss1520 0.9711 0.9352 1.009
maternal_loss2025 0.9388 0.9089 0.9705
maternal_loss2530 0.9799 0.9498 1.009
maternal_loss3035 0.9838 0.9586 1.01
maternal_loss3540 1.005 0.98 1.03
maternal_loss4045 0.9861 0.9641 1.01
older_siblings1 1.017 0.9962 1.038
older_siblings2 1.029 1.001 1.057
older_siblings3 1.033 0.9978 1.068
older_siblings4 1.013 0.9703 1.055
older_siblings5P 1.021 0.9673 1.075
nr.siblings 1.023 1.018 1.029
last_born1 0.9814 0.9627 1
hu_Intercept 0.7633 0.4801 1.219
hu_paternalage 0.7185 0.626 0.8199
hu_age50102 0.2662 0.2413 0.2924
hu_age025 399.2 323.9 488.1
hu_ageunknown 2.096 1.946 2.26
hu_birth_cohort1750M1755 1.291 0.6596 2.576
hu_birth_cohort1755M1760 0.9961 0.5614 1.762
hu_birth_cohort1760M1765 0.7561 0.4448 1.317
hu_birth_cohort1765M1770 0.586 0.3454 0.9838
hu_birth_cohort1770M1775 0.6883 0.4031 1.201
hu_birth_cohort1775M1780 0.676 0.4031 1.148
hu_birth_cohort1780M1785 0.6223 0.3622 1.068
hu_birth_cohort1785M1790 0.7488 0.4537 1.266
hu_birth_cohort1790M1795 0.8599 0.5402 1.356
hu_birth_cohort1795M1800 0.8088 0.509 1.291
hu_birth_cohort1800M1805 0.7227 0.4566 1.134
hu_birth_cohort1805M1810 0.6438 0.411 1.025
hu_birth_cohort1810M1815 0.721 0.4577 1.124
hu_birth_cohort1815M1820 0.5895 0.3732 0.9119
hu_birth_cohort1820M1825 0.4795 0.3072 0.7337
hu_birth_cohort1825M1830 0.4311 0.2765 0.669
hu_birth_cohort1830M1835 0.3593 0.2297 0.5579
hu_birth_cohort1835M1840 0.3341 0.2125 0.519
hu_birth_cohort1840M1845 0.3513 0.2262 0.5424
hu_birth_cohort1845M1850 0.3366 0.2167 0.5216
hu_male1 0.9548 0.9127 0.9992
hu_maternalage.factor1020 1 0.8004 1.243
hu_maternalage.factor3559 1.075 1.002 1.152
hu_paternalage.mean 1.371 1.199 1.579
hu_paternal_loss01 1.787 1.435 2.244
hu_paternal_loss15 1.825 1.566 2.118
hu_paternal_loss510 1.938 1.715 2.193
hu_paternal_loss1015 1.572 1.392 1.773
hu_paternal_loss1520 1.52 1.367 1.698
hu_paternal_loss2025 1.354 1.22 1.496
hu_paternal_loss2530 1.27 1.157 1.403
hu_paternal_loss3035 1.194 1.082 1.311
hu_paternal_loss3540 1.161 1.064 1.269
hu_paternal_loss4045 1.072 0.9735 1.178
hu_maternal_loss01 2.685 1.979 3.667
hu_maternal_loss15 2.165 1.814 2.551
hu_maternal_loss510 2.067 1.808 2.368
hu_maternal_loss1015 2.051 1.798 2.332
hu_maternal_loss1520 1.811 1.608 2.05
hu_maternal_loss2025 1.515 1.369 1.68
hu_maternal_loss2530 1.276 1.158 1.403
hu_maternal_loss3035 1.229 1.122 1.345
hu_maternal_loss3540 1.131 1.041 1.226
hu_maternal_loss4045 1.046 0.9625 1.14
hu_older_siblings1 1.094 1.015 1.18
hu_older_siblings2 1.186 1.075 1.314
hu_older_siblings3 1.309 1.152 1.492
hu_older_siblings4 1.3 1.111 1.536
hu_older_siblings5P 1.445 1.187 1.785
hu_nr.siblings 0.989 0.9713 1.007
hu_last_born1 0.9746 0.9169 1.036

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 1.89 [1.43;2.34] [1.58;2.19]
estimate father 35y 2.09 [1.63;2.54] [1.8;2.39]
percentage change 10.79 [3.14;20.2] [5.61;16.78]
OR/IRR 0.95 [0.92;0.99] [0.93;0.98]
OR hurdle 0.72 [0.63;0.82] [0.66;0.78]

Marginal effect plots

In these marginal effect plots, we set all predictors except the one shown on the X axis to their mean and in the case of factors to their reference level. We then plot the estimated association between the X axis predictor and the outcome on the response scale (e.g. probability of survival/marriage or number of children).

plot.brmsMarginalEffects_shades(
    x = marginal_effects(model, re_formula = NA, probs = c(0.025,0.975)),
    y = marginal_effects(model, re_formula = NA, probs = c(0.1,0.9)), 
    ask = FALSE)

Coefficient plot

Here, we plotted the 95% posterior densities for the unexponentiated model coefficients (b_). The darkly shaded area represents the 50% credibility interval, the dark line represent the posterior mean estimate.

mcmc_areas(as.matrix(model$fit), regex_pars = "b_[^I]", point_est = "mean", prob = 0.50, prob_outer = 0.95) + ggtitle("Posterior densities with means and 50% intervals") + analysis_theme + theme(axis.text = element_text(size = 12), panel.grid = element_blank()) + xlab("Coefficient size")

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

In posterior predictive checks, we test whether we can approximately reproduce the real data distribution from our model.

brms::pp_check(model, re_formula = NA, type = "dens_overlay")

brms::pp_check(model, re_formula = NA, type = "hist")

Rhat

Did the 6 chains converge?

stanplot(model, pars = "^b_[^I]", type = 'rhat')

Effective sample size over average sample size

stanplot(model, pars = "^b", type = 'neff_hist')

Trace plots

Trace plots are only shown in the case of nonconvergence.

if(any( summary(model)$fixed[,"Rhat"] > 1.1)) { # only do traceplots if not converged
    plot(model, N = 3, ask = FALSE)
}

File/cluster script name

This model was stored in the file: coefs/ddb/s1_control_age.rds.

Click the following link to see the script used to generate this model:

opts_chunk$set(echo = FALSE)
clusterscript = str_replace(basename(model_filename), "\\.rds",".html")
cat("[Cluster script](" , clusterscript, ")", sep = "")

Cluster script

s2: Mediation via reproductive timing

Here, we tested whether the paternal age effect on reproductive succes is mediated by reproductive timing (as indexed by anchors’ ages at first and last birth). Because age at first and last birth are by definition only available for anchors who had at least one child, this analysis has to be restricted to such anchors. Hence, paternal age effects on mortality until age 1 and 15 cannot, in principle, be mediated by reproductive timing of the anchors.

Model summary

Full summary

model_summary = summary(model, use_cache = FALSE, priors = TRUE)
print(model_summary)
##  Family: hurdle_poisson(log) 
## Formula: children ~ paternalage + age_at_1st_child + age_at_last_child + birth_cohort + male + maternalage.factor + paternalage.mean + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born + (1 | idParents) 
##          hu ~ paternalage + age_at_1st_child + age_at_last_child + birth_cohort + male + maternalage.factor + paternalage.mean + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born + (1 | idParents)
##    Data: model_data (Number of observations: 22520) 
## Samples: 6 chains, each with iter = 800; warmup = 300; thin = 1; 
##          total post-warmup samples = 3000
##    WAIC: Not computed
##  
## Priors: 
## b ~ normal(0,5)
## sd ~ student_t(3, 0, 5)
## b_hu ~ normal(0,5)
## sd_hu ~ student_t(3, 0, 10)
## 
## Group-Level Effects: 
## ~idParents (Number of levels: 10473) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.02      0.01     0.00     0.04        144 1.05
## sd(hu_Intercept)     4.84      3.72     0.27    13.93       2842 1.00
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     0.59      0.06     0.46     0.70        130
## paternalage                  -0.01      0.02    -0.04     0.02        817
## age_at_1st_child             -0.69      0.01    -0.70    -0.67       3000
## age_at_last_child             0.68      0.00     0.67     0.69       3000
## birth_cohort1750M1755        -0.09      0.10    -0.29     0.11        426
## birth_cohort1755M1760         0.10      0.08    -0.05     0.25        192
## birth_cohort1760M1765         0.09      0.07    -0.04     0.23        141
## birth_cohort1765M1770         0.13      0.07     0.00     0.26        138
## birth_cohort1770M1775         0.13      0.07     0.00     0.27        146
## birth_cohort1775M1780         0.06      0.07    -0.07     0.19        141
## birth_cohort1780M1785         0.05      0.07    -0.08     0.18        134
## birth_cohort1785M1790         0.13      0.06     0.01     0.26        134
## birth_cohort1790M1795         0.09      0.06    -0.03     0.21        119
## birth_cohort1795M1800         0.06      0.06    -0.05     0.18        112
## birth_cohort1800M1805         0.05      0.06    -0.06     0.17        111
## birth_cohort1805M1810         0.07      0.06    -0.03     0.19        109
## birth_cohort1810M1815         0.04      0.06    -0.07     0.16        109
## birth_cohort1815M1820         0.13      0.06     0.02     0.24        102
## birth_cohort1820M1825         0.13      0.06     0.02     0.25        105
## birth_cohort1825M1830         0.14      0.06     0.04     0.25        103
## birth_cohort1830M1835         0.14      0.06     0.03     0.25        102
## birth_cohort1835M1840         0.15      0.06     0.05     0.27         99
## birth_cohort1840M1845         0.17      0.06     0.07     0.29        101
## birth_cohort1845M1850         0.21      0.06     0.10     0.32        102
## male1                        -0.05      0.01    -0.06    -0.04       3000
## maternalage.factor1020        0.00      0.03    -0.06     0.05       3000
## maternalage.factor3559        0.02      0.01     0.00     0.04       3000
## paternalage.mean              0.01      0.02    -0.02     0.05        841
## paternal_loss01               0.03      0.03    -0.03     0.09       3000
## paternal_loss15               0.00      0.02    -0.04     0.03       3000
## paternal_loss510             -0.02      0.02    -0.05     0.01       3000
## paternal_loss1015            -0.01      0.01    -0.04     0.02       3000
## paternal_loss1520            -0.03      0.01    -0.06    -0.01       3000
## paternal_loss2025            -0.01      0.01    -0.03     0.01       3000
## paternal_loss2530            -0.01      0.01    -0.03     0.01       3000
## paternal_loss3035             0.00      0.01    -0.02     0.02       2355
## paternal_loss3540             0.01      0.01    -0.01     0.03       3000
## paternal_loss4045             0.02      0.01     0.00     0.04       3000
## maternal_loss01               0.06      0.04    -0.02     0.15       3000
## maternal_loss15              -0.01      0.02    -0.05     0.04       3000
## maternal_loss510              0.02      0.02    -0.01     0.06       3000
## maternal_loss1015            -0.01      0.02    -0.04     0.02       3000
## maternal_loss1520             0.00      0.02    -0.03     0.03       3000
## maternal_loss2025            -0.02      0.01    -0.04     0.01       3000
## maternal_loss2530             0.01      0.01    -0.02     0.03       3000
## maternal_loss3035             0.01      0.01    -0.01     0.03       3000
## maternal_loss3540             0.01      0.01    -0.01     0.03       3000
## maternal_loss4045             0.00      0.01    -0.02     0.02       3000
## older_siblings1               0.00      0.01    -0.02     0.02       1473
## older_siblings2               0.00      0.01    -0.03     0.02       1004
## older_siblings3               0.00      0.02    -0.03     0.03        891
## older_siblings4              -0.03      0.02    -0.06     0.01        894
## older_siblings5P             -0.01      0.02    -0.05     0.04        765
## nr.siblings                   0.01      0.00     0.01     0.02       1107
## last_born1                    0.00      0.01    -0.02     0.02       3000
## hu_Intercept                 -1.52      5.04   -11.22     7.86       3000
## hu_paternalage               -4.28      4.26   -12.65     3.94       2399
## hu_age_at_1st_child          -3.54      4.53   -12.69     5.18       2810
## hu_age_at_last_child         -4.75      4.08   -12.93     3.10       2207
## hu_birth_cohort1750M1755      0.05      4.95    -9.43     9.81       3000
## hu_birth_cohort1755M1760      0.17      4.98    -9.49    10.12       3000
## hu_birth_cohort1760M1765      0.06      5.09    -9.80    10.06       3000
## hu_birth_cohort1765M1770     -0.05      4.78    -9.17     9.39       3000
## hu_birth_cohort1770M1775     -0.07      5.19   -10.33    10.07       3000
## hu_birth_cohort1775M1780     -0.25      4.96   -10.03     9.48       3000
## hu_birth_cohort1780M1785      0.12      4.95    -9.58     9.80       2346
## hu_birth_cohort1785M1790     -0.05      5.11    -9.92    10.11       3000
## hu_birth_cohort1790M1795     -0.08      5.17   -10.32     9.63       3000
## hu_birth_cohort1795M1800     -0.05      4.93    -9.50     9.63       3000
## hu_birth_cohort1800M1805     -0.02      5.10   -10.16     9.86       3000
## hu_birth_cohort1805M1810     -0.19      4.77    -9.47     9.32       3000
## hu_birth_cohort1810M1815     -0.23      5.08   -10.23     9.72       3000
## hu_birth_cohort1815M1820     -0.09      4.96    -9.81     9.42       3000
## hu_birth_cohort1820M1825     -0.05      5.14   -10.01     9.79       3000
## hu_birth_cohort1825M1830     -0.14      4.81    -9.79     9.06       3000
## hu_birth_cohort1830M1835     -0.12      4.84    -9.69     9.19       3000
## hu_birth_cohort1835M1840     -0.10      4.90    -9.79     9.10       3000
## hu_birth_cohort1840M1845     -0.24      4.69    -9.48     8.52       2447
## hu_birth_cohort1845M1850     -0.20      5.13   -10.22     9.76       3000
## hu_male1                     -0.57      4.83    -9.95     9.09       3000
## hu_maternalage.factor1020    -0.18      4.80    -9.72     8.88       2676
## hu_maternalage.factor3559    -0.34      4.90   -10.05     9.24       3000
## hu_paternalage.mean          -4.28      4.29   -12.63     4.36       2223
## hu_paternal_loss01           -0.03      5.06   -10.01     9.59       3000
## hu_paternal_loss15           -0.18      4.71    -9.22     9.01       3000
## hu_paternal_loss510          -0.16      4.81    -9.49     9.20       3000
## hu_paternal_loss1015         -0.16      4.97   -10.23     9.59       3000
## hu_paternal_loss1520          0.09      4.98    -9.74     9.90       3000
## hu_paternal_loss2025         -0.26      4.75    -9.87     8.85       3000
## hu_paternal_loss2530          0.11      4.85    -9.84     9.24       2641
## hu_paternal_loss3035         -0.19      4.92    -9.95     9.15       3000
## hu_paternal_loss3540         -0.22      4.99    -9.88     9.25       3000
## hu_paternal_loss4045         -0.27      4.86    -9.77     9.20       3000
## hu_maternal_loss01           -0.16      4.85    -9.55     9.01       3000
## hu_maternal_loss15           -0.14      4.88    -9.73     9.50       2407
## hu_maternal_loss510          -0.24      5.07   -10.12     9.61       3000
## hu_maternal_loss1015         -0.03      4.80    -9.46     9.22       3000
## hu_maternal_loss1520         -0.08      4.91   -10.11     9.65       3000
## hu_maternal_loss2025         -0.14      4.84    -9.56     9.30       2324
## hu_maternal_loss2530         -0.12      4.85    -9.37     9.10       3000
## hu_maternal_loss3035         -0.18      4.88    -9.82     9.19       3000
## hu_maternal_loss3540         -0.20      4.92    -9.91     9.33       3000
## hu_maternal_loss4045         -0.24      4.93   -10.15     9.57       3000
## hu_older_siblings1           -0.26      5.04   -10.07     9.61       3000
## hu_older_siblings2           -0.12      4.96    -9.93     9.55       3000
## hu_older_siblings3           -0.02      5.16    -9.95     9.98       3000
## hu_older_siblings4           -0.14      5.13   -10.26     9.73       3000
## hu_older_siblings5P          -0.01      4.91    -9.86     9.56       3000
## hu_nr.siblings               -3.38      3.40   -10.96     1.86       1913
## hu_last_born1                -0.35      4.99   -10.27     9.33       3000
##                           Rhat
## Intercept                 1.02
## paternalage               1.00
## age_at_1st_child          1.00
## age_at_last_child         1.00
## birth_cohort1750M1755     1.01
## birth_cohort1755M1760     1.02
## birth_cohort1760M1765     1.02
## birth_cohort1765M1770     1.02
## birth_cohort1770M1775     1.02
## birth_cohort1775M1780     1.02
## birth_cohort1780M1785     1.02
## birth_cohort1785M1790     1.02
## birth_cohort1790M1795     1.03
## birth_cohort1795M1800     1.03
## birth_cohort1800M1805     1.03
## birth_cohort1805M1810     1.03
## birth_cohort1810M1815     1.03
## birth_cohort1815M1820     1.03
## birth_cohort1820M1825     1.03
## birth_cohort1825M1830     1.03
## birth_cohort1830M1835     1.03
## birth_cohort1835M1840     1.03
## birth_cohort1840M1845     1.03
## birth_cohort1845M1850     1.03
## male1                     1.00
## maternalage.factor1020    1.00
## maternalage.factor3559    1.00
## paternalage.mean          1.00
## paternal_loss01           1.00
## paternal_loss15           1.00
## paternal_loss510          1.00
## paternal_loss1015         1.00
## paternal_loss1520         1.00
## paternal_loss2025         1.00
## paternal_loss2530         1.00
## paternal_loss3035         1.00
## paternal_loss3540         1.00
## paternal_loss4045         1.00
## maternal_loss01           1.00
## maternal_loss15           1.00
## maternal_loss510          1.00
## maternal_loss1015         1.00
## maternal_loss1520         1.00
## maternal_loss2025         1.00
## maternal_loss2530         1.00
## maternal_loss3035         1.00
## maternal_loss3540         1.00
## maternal_loss4045         1.00
## older_siblings1           1.00
## older_siblings2           1.00
## older_siblings3           1.00
## older_siblings4           1.00
## older_siblings5P          1.00
## nr.siblings               1.00
## last_born1                1.00
## hu_Intercept              1.00
## hu_paternalage            1.00
## hu_age_at_1st_child       1.00
## hu_age_at_last_child      1.00
## hu_birth_cohort1750M1755  1.00
## hu_birth_cohort1755M1760  1.00
## hu_birth_cohort1760M1765  1.00
## hu_birth_cohort1765M1770  1.00
## hu_birth_cohort1770M1775  1.00
## hu_birth_cohort1775M1780  1.00
## hu_birth_cohort1780M1785  1.00
## hu_birth_cohort1785M1790  1.00
## hu_birth_cohort1790M1795  1.00
## hu_birth_cohort1795M1800  1.00
## hu_birth_cohort1800M1805  1.00
## hu_birth_cohort1805M1810  1.00
## hu_birth_cohort1810M1815  1.00
## hu_birth_cohort1815M1820  1.00
## hu_birth_cohort1820M1825  1.00
## hu_birth_cohort1825M1830  1.00
## hu_birth_cohort1830M1835  1.00
## hu_birth_cohort1835M1840  1.00
## hu_birth_cohort1840M1845  1.00
## hu_birth_cohort1845M1850  1.00
## hu_male1                  1.00
## hu_maternalage.factor1020 1.00
## hu_maternalage.factor3559 1.00
## hu_paternalage.mean       1.00
## hu_paternal_loss01        1.00
## hu_paternal_loss15        1.00
## hu_paternal_loss510       1.00
## hu_paternal_loss1015      1.00
## hu_paternal_loss1520      1.00
## hu_paternal_loss2025      1.00
## hu_paternal_loss2530      1.00
## hu_paternal_loss3035      1.00
## hu_paternal_loss3540      1.00
## hu_paternal_loss4045      1.00
## hu_maternal_loss01        1.00
## hu_maternal_loss15        1.00
## hu_maternal_loss510       1.00
## hu_maternal_loss1015      1.00
## hu_maternal_loss1520      1.00
## hu_maternal_loss2025      1.00
## hu_maternal_loss2530      1.00
## hu_maternal_loss3035      1.00
## hu_maternal_loss3540      1.00
## hu_maternal_loss4045      1.00
## hu_older_siblings1        1.00
## hu_older_siblings2        1.00
## hu_older_siblings3        1.00
## hu_older_siblings4        1.00
## hu_older_siblings5P       1.00
## hu_nr.siblings            1.00
## hu_last_born1             1.00
## 
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample 
## is a crude measure of effective sample size, and Rhat is the potential 
## scale reduction factor on split chains (at convergence, Rhat = 1).

Table of fixed effects

Estimates are exp(b). When they are referring to the hurdle (hu) component, or a dichotomous outcome, they are odds ratios, when they are referring to a Poisson component, they are hazard ratios. In both cases, they are presented with 95% credibility intervals. To see the effects on the response scale (probability or number of children), consult the marginal effect plots.

fixed_eff = data.frame(model_summary$fixed, check.names = F)
fixed_eff$Est.Error = fixed_eff$Eff.Sample = fixed_eff$Rhat = NULL
fixed_eff$`Odds/hazard ratio` = exp(fixed_eff$Estimate)
fixed_eff$`OR/HR low 95%` = exp(fixed_eff$`l-95% CI`)
fixed_eff$`OR/HR high 95%` = exp(fixed_eff$`u-95% CI`)
fixed_eff = fixed_eff %>% select(`Odds/hazard ratio`, `OR/HR low 95%`, `OR/HR high 95%`)
pander::pander(fixed_eff)
  Odds/hazard ratio OR/HR low 95% OR/HR high 95%
Intercept 1.8 1.582 2.021
paternalage 0.9913 0.9609 1.023
age_at_1st_child 0.5029 0.4966 0.5094
age_at_last_child 1.969 1.951 1.987
birth_cohort1750M1755 0.9164 0.7509 1.122
birth_cohort1755M1760 1.107 0.9509 1.287
birth_cohort1760M1765 1.097 0.9655 1.255
birth_cohort1765M1770 1.133 0.9979 1.295
birth_cohort1770M1775 1.138 0.9989 1.308
birth_cohort1775M1780 1.058 0.9318 1.21
birth_cohort1780M1785 1.049 0.9267 1.203
birth_cohort1785M1790 1.14 1.012 1.301
birth_cohort1790M1795 1.09 0.9708 1.233
birth_cohort1795M1800 1.067 0.9538 1.201
birth_cohort1800M1805 1.048 0.9388 1.184
birth_cohort1805M1810 1.077 0.9672 1.214
birth_cohort1810M1815 1.04 0.9306 1.17
birth_cohort1815M1820 1.136 1.023 1.278
birth_cohort1820M1825 1.139 1.024 1.28
birth_cohort1825M1830 1.148 1.038 1.288
birth_cohort1830M1835 1.148 1.034 1.288
birth_cohort1835M1840 1.163 1.047 1.309
birth_cohort1840M1845 1.188 1.069 1.335
birth_cohort1845M1850 1.23 1.11 1.382
male1 0.9522 0.9401 0.9649
maternalage.factor1020 0.9956 0.9461 1.046
maternalage.factor3559 1.019 1.001 1.037
paternalage.mean 1.014 0.9834 1.048
paternal_loss01 1.026 0.966 1.089
paternal_loss15 0.996 0.9595 1.033
paternal_loss510 0.9794 0.9494 1.01
paternal_loss1015 0.9905 0.9628 1.018
paternal_loss1520 0.9669 0.943 0.9921
paternal_loss2025 0.9882 0.967 1.012
paternal_loss2530 0.9877 0.966 1.009
paternal_loss3035 0.9988 0.9784 1.02
paternal_loss3540 1.01 0.9898 1.031
paternal_loss4045 1.019 0.9972 1.042
maternal_loss01 1.066 0.9782 1.161
maternal_loss15 0.9925 0.9502 1.037
maternal_loss510 1.024 0.9884 1.061
maternal_loss1015 0.9906 0.9579 1.024
maternal_loss1520 1.002 0.9725 1.033
maternal_loss2025 0.9848 0.9595 1.011
maternal_loss2530 1.005 0.9831 1.029
maternal_loss3035 1.012 0.9921 1.033
maternal_loss3540 1.014 0.9947 1.034
maternal_loss4045 0.9993 0.9798 1.019
older_siblings1 0.999 0.9795 1.017
older_siblings2 0.9984 0.9747 1.023
older_siblings3 0.996 0.9678 1.027
older_siblings4 0.9749 0.9397 1.011
older_siblings5P 0.9931 0.9482 1.041
nr.siblings 1.012 1.009 1.016
last_born1 0.9998 0.9827 1.017
hu_Intercept 0.2178 1.337e-05 2588
hu_paternalage 0.01384 3.222e-06 51.17
hu_age_at_1st_child 0.02896 3.074e-06 177.3
hu_age_at_last_child 0.008619 2.418e-06 22.1
hu_birth_cohort1750M1755 1.052 8.016e-05 18210
hu_birth_cohort1755M1760 1.186 7.572e-05 24901
hu_birth_cohort1760M1765 1.062 5.561e-05 23387
hu_birth_cohort1765M1770 0.9512 0.0001039 11934
hu_birth_cohort1770M1775 0.9352 3.264e-05 23561
hu_birth_cohort1775M1780 0.7789 4.42e-05 13160
hu_birth_cohort1780M1785 1.126 6.878e-05 17946
hu_birth_cohort1785M1790 0.9484 4.935e-05 24523
hu_birth_cohort1790M1795 0.9246 3.299e-05 15194
hu_birth_cohort1795M1800 0.9543 7.498e-05 15182
hu_birth_cohort1800M1805 0.9797 3.871e-05 19088
hu_birth_cohort1805M1810 0.831 7.733e-05 11133
hu_birth_cohort1810M1815 0.7961 3.608e-05 16621
hu_birth_cohort1815M1820 0.9131 5.513e-05 12356
hu_birth_cohort1820M1825 0.9522 4.474e-05 17823
hu_birth_cohort1825M1830 0.8678 5.596e-05 8566
hu_birth_cohort1830M1835 0.8909 6.163e-05 9760
hu_birth_cohort1835M1840 0.9006 5.595e-05 8928
hu_birth_cohort1840M1845 0.7884 7.652e-05 5030
hu_birth_cohort1845M1850 0.8176 3.632e-05 17360
hu_male1 0.5647 4.784e-05 8874
hu_maternalage.factor1020 0.8345 6.004e-05 7190
hu_maternalage.factor3559 0.714 4.297e-05 10251
hu_paternalage.mean 0.0139 3.275e-06 77.9
hu_paternal_loss01 0.9699 4.517e-05 14655
hu_paternal_loss15 0.8383 9.927e-05 8223
hu_paternal_loss510 0.8484 7.562e-05 9940
hu_paternal_loss1015 0.8553 3.597e-05 14673
hu_paternal_loss1520 1.099 5.871e-05 19921
hu_paternal_loss2025 0.7717 5.154e-05 7009
hu_paternal_loss2530 1.111 5.319e-05 10338
hu_paternal_loss3035 0.8235 4.793e-05 9421
hu_paternal_loss3540 0.8003 5.134e-05 10447
hu_paternal_loss4045 0.7598 5.716e-05 9930
hu_maternal_loss01 0.8528 7.144e-05 8190
hu_maternal_loss15 0.8672 5.973e-05 13427
hu_maternal_loss510 0.7842 4.035e-05 14876
hu_maternal_loss1015 0.9662 7.76e-05 10139
hu_maternal_loss1520 0.9233 4.061e-05 15543
hu_maternal_loss2025 0.8691 7.043e-05 10902
hu_maternal_loss2530 0.8844 8.563e-05 8964
hu_maternal_loss3035 0.8367 5.456e-05 9790
hu_maternal_loss3540 0.8159 4.977e-05 11291
hu_maternal_loss4045 0.7847 3.904e-05 14356
hu_older_siblings1 0.7703 4.216e-05 14982
hu_older_siblings2 0.8869 4.881e-05 14062
hu_older_siblings3 0.9792 4.755e-05 21517
hu_older_siblings4 0.8681 3.5e-05 16845
hu_older_siblings5P 0.9865 5.199e-05 14208
hu_nr.siblings 0.03407 1.744e-05 6.397
hu_last_born1 0.7019 3.449e-05 11268

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 4.6 [4.13;5.08] [4.29;4.93]
estimate father 35y 4.56 [4.08;5.05] [4.26;4.89]
percentage change -0.8 [-3.7;2.2] [-2.72;1.12]
OR/IRR 0.99 [0.96;1.02] [0.97;1.01]
OR hurdle 0.01 [0;51.17] [0;2.94]

Marginal effect plots

In these marginal effect plots, we set all predictors except the one shown on the X axis to their mean and in the case of factors to their reference level. We then plot the estimated association between the X axis predictor and the outcome on the response scale (e.g. probability of survival/marriage or number of children).

plot.brmsMarginalEffects_shades(
    x = marginal_effects(model, re_formula = NA, probs = c(0.025,0.975)),
    y = marginal_effects(model, re_formula = NA, probs = c(0.1,0.9)), 
    ask = FALSE)

Coefficient plot

Here, we plotted the 95% posterior densities for the unexponentiated model coefficients (b_). The darkly shaded area represents the 50% credibility interval, the dark line represent the posterior mean estimate.

mcmc_areas(as.matrix(model$fit), regex_pars = "b_[^I]", point_est = "mean", prob = 0.50, prob_outer = 0.95) + ggtitle("Posterior densities with means and 50% intervals") + analysis_theme + theme(axis.text = element_text(size = 12), panel.grid = element_blank()) + xlab("Coefficient size")

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

In posterior predictive checks, we test whether we can approximately reproduce the real data distribution from our model.

brms::pp_check(model, re_formula = NA, type = "dens_overlay")

brms::pp_check(model, re_formula = NA, type = "hist")

Rhat

Did the 6 chains converge?

stanplot(model, pars = "^b_[^I]", type = 'rhat')

Effective sample size over average sample size

stanplot(model, pars = "^b", type = 'neff_hist')

Trace plots

Trace plots are only shown in the case of nonconvergence.

if(any( summary(model)$fixed[,"Rhat"] > 1.1)) { # only do traceplots if not converged
    plot(model, N = 3, ask = FALSE)
}

File/cluster script name

This model was stored in the file: coefs/ddb/s2_reproductive_timing.rds.

Click the following link to see the script used to generate this model:

opts_chunk$set(echo = FALSE)
clusterscript = str_replace(basename(model_filename), "\\.rds",".html")
cat("[Cluster script](" , clusterscript, ")", sep = "")

Cluster script