Québec 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, "rpqa")
} 
# options for each chunk calling knit_child
opts_chunk$set(warning=FALSE, message = FALSE, echo = FALSE)

Analysis description

Data subset

The rpqa.1 dataset contains only those participants where paternal age is known and the birthdate is between 1630 and 1750.

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: 68724) 
## 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: 12205) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.23      0.00     0.23     0.24       1098 1.00
## sd(hu_Intercept)     0.69      0.02     0.65     0.74        899 1.01
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     1.94      0.03     1.89     1.99       1475
## paternalage                   0.01      0.01    -0.01     0.03       1899
## age50112                      0.35      0.01     0.34     0.37       3000
## age025                       -1.52      0.03    -1.59    -1.46       3000
## ageunknown                    0.03      0.01     0.02     0.05       3000
## birth_cohort1675M1680         0.02      0.02    -0.01     0.05       1298
## birth_cohort1680M1685         0.03      0.02     0.00     0.06       1262
## birth_cohort1685M1690         0.01      0.02    -0.02     0.04       1108
## birth_cohort1690M1695         0.01      0.02    -0.02     0.04        955
## birth_cohort1695M1700         0.01      0.02    -0.02     0.04        932
## birth_cohort1700M1705         0.00      0.02    -0.03     0.03        905
## birth_cohort1705M1710        -0.02      0.02    -0.05     0.01        850
## birth_cohort1710M1715        -0.02      0.02    -0.05     0.01        828
## birth_cohort1715M1720        -0.05      0.02    -0.08    -0.02        835
## birth_cohort1720M1725        -0.05      0.01    -0.08    -0.02        826
## birth_cohort1725M1730        -0.09      0.01    -0.12    -0.06        841
## birth_cohort1730M1735        -0.07      0.01    -0.10    -0.04        820
## birth_cohort1735M1740        -0.08      0.01    -0.11    -0.05        815
## male1                         0.06      0.00     0.05     0.07       3000
## maternalage.factor1420       -0.01      0.01    -0.03     0.01       3000
## maternalage.factor3550        0.00      0.01    -0.02     0.02       3000
## paternalage.mean             -0.03      0.01    -0.05    -0.01       1970
## paternal_loss01              -0.02      0.02    -0.06     0.02       3000
## paternal_loss15              -0.01      0.02    -0.04     0.02       1797
## paternal_loss510              0.01      0.01    -0.01     0.04       1506
## paternal_loss1015             0.00      0.01    -0.02     0.02       1714
## paternal_loss1520             0.00      0.01    -0.02     0.02       1557
## paternal_loss2025             0.00      0.01    -0.02     0.02       1710
## paternal_loss2530             0.00      0.01    -0.02     0.02       1623
## paternal_loss3035            -0.01      0.01    -0.03     0.00       1860
## paternal_loss3540            -0.02      0.01    -0.04     0.00       2257
## paternal_loss4045             0.00      0.01    -0.02     0.02       3000
## paternal_lossunclear         -0.04      0.01    -0.06    -0.02       1495
## maternal_loss01              -0.02      0.02    -0.07     0.02       3000
## maternal_loss15               0.00      0.01    -0.03     0.03       2350
## maternal_loss510              0.01      0.01    -0.01     0.04       2484
## maternal_loss1015             0.00      0.01    -0.02     0.03       2289
## maternal_loss1520             0.02      0.01     0.00     0.04       2218
## maternal_loss2025             0.00      0.01    -0.02     0.02       2668
## maternal_loss2530             0.00      0.01    -0.02     0.02       2274
## maternal_loss3035             0.00      0.01    -0.01     0.02       2563
## maternal_loss3540             0.00      0.01    -0.01     0.02       3000
## maternal_loss4045             0.01      0.01    -0.01     0.03       3000
## maternal_lossunclear         -0.01      0.01    -0.03     0.01       1796
## older_siblings1              -0.03      0.01    -0.04    -0.01       3000
## older_siblings2              -0.03      0.01    -0.05    -0.01       2650
## older_siblings3              -0.04      0.01    -0.06    -0.02       2369
## older_siblings4              -0.03      0.01    -0.05     0.00       2268
## older_siblings5P             -0.04      0.01    -0.07    -0.02       2053
## nr.siblings                   0.01      0.00     0.00     0.01       2189
## last_born1                    0.01      0.01    -0.01     0.02       3000
## hu_Intercept                 -2.04      0.12    -2.27    -1.80       1230
## hu_paternalage                0.04      0.06    -0.08     0.15       1404
## hu_age50112                  -0.73      0.03    -0.80    -0.67       3000
## hu_age025                     4.84      0.05     4.74     4.94       3000
## hu_ageunknown                 2.12      0.04     2.05     2.19       3000
## hu_birth_cohort1675M1680     -0.01      0.09    -0.19     0.18       1173
## hu_birth_cohort1680M1685      0.07      0.10    -0.12     0.25       1036
## hu_birth_cohort1685M1690      0.15      0.10    -0.05     0.33       1181
## hu_birth_cohort1690M1695      0.08      0.09    -0.10     0.25        974
## hu_birth_cohort1695M1700      0.00      0.09    -0.18     0.17        939
## hu_birth_cohort1700M1705      0.03      0.09    -0.14     0.20        931
## hu_birth_cohort1705M1710     -0.01      0.09    -0.18     0.15        876
## hu_birth_cohort1710M1715      0.08      0.09    -0.09     0.24        946
## hu_birth_cohort1715M1720      0.15      0.09    -0.01     0.32        870
## hu_birth_cohort1720M1725      0.12      0.08    -0.03     0.28        862
## hu_birth_cohort1725M1730      0.27      0.08     0.11     0.43        815
## hu_birth_cohort1730M1735      0.33      0.08     0.17     0.48        825
## hu_birth_cohort1735M1740      0.27      0.08     0.11     0.42        808
## hu_male1                      0.50      0.02     0.45     0.55       3000
## hu_maternalage.factor1420    -0.06      0.06    -0.18     0.04       3000
## hu_maternalage.factor3550     0.00      0.04    -0.09     0.08       3000
## hu_paternalage.mean           0.01      0.06    -0.11     0.13       1762
## hu_paternal_loss01            0.20      0.11     0.00     0.41       3000
## hu_paternal_loss15            0.14      0.08    -0.02     0.30       3000
## hu_paternal_loss510           0.07      0.07    -0.08     0.20       2175
## hu_paternal_loss1015          0.01      0.07    -0.12     0.14       1919
## hu_paternal_loss1520          0.11      0.06     0.00     0.23       1749
## hu_paternal_loss2025          0.05      0.06    -0.06     0.16       1545
## hu_paternal_loss2530          0.11      0.06     0.00     0.22       1600
## hu_paternal_loss3035          0.12      0.05     0.01     0.22       1679
## hu_paternal_loss3540          0.09      0.05    -0.02     0.20       1903
## hu_paternal_loss4045          0.08      0.06    -0.03     0.20       3000
## hu_paternal_lossunclear       0.24      0.06     0.14     0.35       1565
## hu_maternal_loss01            0.31      0.11     0.10     0.52       3000
## hu_maternal_loss15            0.00      0.07    -0.13     0.14       3000
## hu_maternal_loss510           0.12      0.06     0.00     0.25       3000
## hu_maternal_loss1015          0.11      0.06     0.00     0.23       3000
## hu_maternal_loss1520         -0.02      0.06    -0.14     0.11       3000
## hu_maternal_loss2025          0.06      0.06    -0.06     0.16       3000
## hu_maternal_loss2530         -0.06      0.06    -0.17     0.04       3000
## hu_maternal_loss3035          0.00      0.05    -0.09     0.10       3000
## hu_maternal_loss3540          0.06      0.05    -0.03     0.15       3000
## hu_maternal_loss4045         -0.04      0.05    -0.13     0.06       3000
## hu_maternal_lossunclear       0.10      0.05     0.00     0.20       3000
## hu_older_siblings1            0.10      0.05     0.00     0.19       3000
## hu_older_siblings2            0.07      0.05    -0.03     0.17       2201
## hu_older_siblings3            0.07      0.06    -0.05     0.18       1919
## hu_older_siblings4            0.07      0.06    -0.06     0.19       1759
## hu_older_siblings5P           0.04      0.08    -0.11     0.20       1541
## hu_nr.siblings                0.00      0.01    -0.01     0.01       2426
## hu_last_born1                -0.03      0.04    -0.11     0.06       3000
##                           Rhat
## Intercept                    1
## paternalage                  1
## age50112                     1
## age025                       1
## ageunknown                   1
## birth_cohort1675M1680        1
## birth_cohort1680M1685        1
## birth_cohort1685M1690        1
## birth_cohort1690M1695        1
## birth_cohort1695M1700        1
## birth_cohort1700M1705        1
## birth_cohort1705M1710        1
## birth_cohort1710M1715        1
## birth_cohort1715M1720        1
## birth_cohort1720M1725        1
## birth_cohort1725M1730        1
## birth_cohort1730M1735        1
## birth_cohort1735M1740        1
## male1                        1
## maternalage.factor1420       1
## maternalage.factor3550       1
## paternalage.mean             1
## paternal_loss01              1
## paternal_loss15              1
## paternal_loss510             1
## paternal_loss1015            1
## paternal_loss1520            1
## paternal_loss2025            1
## paternal_loss2530            1
## paternal_loss3035            1
## paternal_loss3540            1
## paternal_loss4045            1
## paternal_lossunclear         1
## maternal_loss01              1
## maternal_loss15              1
## maternal_loss510             1
## maternal_loss1015            1
## maternal_loss1520            1
## maternal_loss2025            1
## maternal_loss2530            1
## maternal_loss3035            1
## maternal_loss3540            1
## maternal_loss4045            1
## maternal_lossunclear         1
## older_siblings1              1
## older_siblings2              1
## older_siblings3              1
## older_siblings4              1
## older_siblings5P             1
## nr.siblings                  1
## last_born1                   1
## hu_Intercept                 1
## hu_paternalage               1
## hu_age50112                  1
## hu_age025                    1
## hu_ageunknown                1
## hu_birth_cohort1675M1680     1
## hu_birth_cohort1680M1685     1
## hu_birth_cohort1685M1690     1
## hu_birth_cohort1690M1695     1
## hu_birth_cohort1695M1700     1
## hu_birth_cohort1700M1705     1
## hu_birth_cohort1705M1710     1
## hu_birth_cohort1710M1715     1
## hu_birth_cohort1715M1720     1
## hu_birth_cohort1720M1725     1
## hu_birth_cohort1725M1730     1
## hu_birth_cohort1730M1735     1
## hu_birth_cohort1735M1740     1
## hu_male1                     1
## hu_maternalage.factor1420    1
## hu_maternalage.factor3550    1
## hu_paternalage.mean          1
## hu_paternal_loss01           1
## hu_paternal_loss15           1
## hu_paternal_loss510          1
## hu_paternal_loss1015         1
## hu_paternal_loss1520         1
## hu_paternal_loss2025         1
## hu_paternal_loss2530         1
## hu_paternal_loss3035         1
## hu_paternal_loss3540         1
## hu_paternal_loss4045         1
## hu_paternal_lossunclear      1
## hu_maternal_loss01           1
## hu_maternal_loss15           1
## hu_maternal_loss510          1
## hu_maternal_loss1015         1
## hu_maternal_loss1520         1
## hu_maternal_loss2025         1
## hu_maternal_loss2530         1
## hu_maternal_loss3035         1
## hu_maternal_loss3540         1
## hu_maternal_loss4045         1
## hu_maternal_lossunclear      1
## hu_older_siblings1           1
## hu_older_siblings2           1
## hu_older_siblings3           1
## hu_older_siblings4           1
## hu_older_siblings5P          1
## hu_nr.siblings               1
## hu_last_born1                1
## 
## 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

fixed_eff = data.frame(model_summary$fixed, check.names = F)
fixed_eff$Est.Error = fixed_eff$Eff.Sample = fixed_eff$Rhat = NULL
fixed_eff$OR = exp(fixed_eff$Estimate)
fixed_eff$OR_low = exp(fixed_eff$`l-95% CI`)
fixed_eff$OR_high = exp(fixed_eff$`u-95% CI`)
pander::pander(fixed_eff)
  Estimate l-95% CI u-95% CI OR OR_low OR_high
Intercept 1.942 1.892 1.991 6.971 6.635 7.32
paternalage 0.007545 -0.0126 0.02771 1.008 0.9875 1.028
age50112 0.3545 0.3436 0.3656 1.425 1.41 1.441
age025 -1.52 -1.588 -1.455 0.2187 0.2044 0.2334
ageunknown 0.03231 0.01555 0.04915 1.033 1.016 1.05
birth_cohort1675M1680 0.01723 -0.01353 0.0479 1.017 0.9866 1.049
birth_cohort1680M1685 0.02699 -0.004416 0.05728 1.027 0.9956 1.059
birth_cohort1685M1690 0.01181 -0.02145 0.0437 1.012 0.9788 1.045
birth_cohort1690M1695 0.01196 -0.01915 0.04279 1.012 0.981 1.044
birth_cohort1695M1700 0.005525 -0.02467 0.03686 1.006 0.9756 1.038
birth_cohort1700M1705 -0.0001908 -0.03043 0.03025 0.9998 0.97 1.031
birth_cohort1705M1710 -0.01745 -0.04747 0.01281 0.9827 0.9536 1.013
birth_cohort1710M1715 -0.02039 -0.05051 0.01004 0.9798 0.9507 1.01
birth_cohort1715M1720 -0.04828 -0.07796 -0.01806 0.9529 0.925 0.9821
birth_cohort1720M1725 -0.05363 -0.08297 -0.0245 0.9478 0.9204 0.9758
birth_cohort1725M1730 -0.08629 -0.1155 -0.05715 0.9173 0.8909 0.9444
birth_cohort1730M1735 -0.06649 -0.09529 -0.03788 0.9357 0.9091 0.9628
birth_cohort1735M1740 -0.07963 -0.1078 -0.05027 0.9235 0.8978 0.951
male1 0.06182 0.05347 0.07011 1.064 1.055 1.073
maternalage.factor1420 -0.01198 -0.03013 0.006508 0.9881 0.9703 1.007
maternalage.factor3550 -0.0007445 -0.01651 0.01541 0.9993 0.9836 1.016
paternalage.mean -0.03016 -0.0521 -0.007204 0.9703 0.9492 0.9928
paternal_loss01 -0.0215 -0.06227 0.01913 0.9787 0.9396 1.019
paternal_loss15 -0.006591 -0.03589 0.02267 0.9934 0.9647 1.023
paternal_loss510 0.01193 -0.01448 0.03853 1.012 0.9856 1.039
paternal_loss1015 -0.0009186 -0.02478 0.02182 0.9991 0.9755 1.022
paternal_loss1520 0.0007968 -0.02258 0.02332 1.001 0.9777 1.024
paternal_loss2025 -0.002941 -0.02482 0.0179 0.9971 0.9755 1.018
paternal_loss2530 0.0006281 -0.01896 0.02055 1.001 0.9812 1.021
paternal_loss3035 -0.01496 -0.03388 0.004155 0.9851 0.9667 1.004
paternal_loss3540 -0.0205 -0.03865 -0.002262 0.9797 0.9621 0.9977
paternal_loss4045 0.002494 -0.0168 0.02101 1.002 0.9833 1.021
paternal_lossunclear -0.04025 -0.06366 -0.01709 0.9605 0.9383 0.9831
maternal_loss01 -0.02254 -0.06553 0.02264 0.9777 0.9366 1.023
maternal_loss15 -0.001367 -0.02944 0.02738 0.9986 0.971 1.028
maternal_loss510 0.01344 -0.01098 0.03977 1.014 0.9891 1.041
maternal_loss1015 0.003497 -0.01915 0.02666 1.004 0.981 1.027
maternal_loss1520 0.01997 -0.001756 0.04178 1.02 0.9982 1.043
maternal_loss2025 0.0001662 -0.02123 0.02174 1 0.979 1.022
maternal_loss2530 -0.001989 -0.02297 0.01789 0.998 0.9773 1.018
maternal_loss3035 0.002595 -0.01491 0.02072 1.003 0.9852 1.021
maternal_loss3540 0.001658 -0.01464 0.01789 1.002 0.9855 1.018
maternal_loss4045 0.008582 -0.007661 0.02526 1.009 0.9924 1.026
maternal_lossunclear -0.0118 -0.03448 0.01196 0.9883 0.9661 1.012
older_siblings1 -0.02906 -0.04439 -0.01407 0.9714 0.9566 0.986
older_siblings2 -0.03187 -0.04868 -0.01435 0.9686 0.9525 0.9858
older_siblings3 -0.03741 -0.0566 -0.01751 0.9633 0.945 0.9826
older_siblings4 -0.02551 -0.04706 -0.003329 0.9748 0.954 0.9967
older_siblings5P -0.04167 -0.06888 -0.01581 0.9592 0.9334 0.9843
nr.siblings 0.006694 0.004354 0.009015 1.007 1.004 1.009
last_born1 0.007301 -0.007369 0.0222 1.007 0.9927 1.022
hu_Intercept -2.035 -2.271 -1.799 0.1306 0.1032 0.1655
hu_paternalage 0.03848 -0.07828 0.1506 1.039 0.9247 1.162
hu_age50112 -0.7335 -0.7985 -0.6666 0.4802 0.45 0.5134
hu_age025 4.842 4.742 4.939 126.8 114.6 139.6
hu_ageunknown 2.117 2.047 2.188 8.31 7.746 8.914
hu_birth_cohort1675M1680 -0.006261 -0.1859 0.177 0.9938 0.8303 1.194
hu_birth_cohort1680M1685 0.06552 -0.1219 0.2524 1.068 0.8852 1.287
hu_birth_cohort1685M1690 0.1464 -0.05025 0.3327 1.158 0.951 1.395
hu_birth_cohort1690M1695 0.07615 -0.1022 0.2522 1.079 0.9028 1.287
hu_birth_cohort1695M1700 -0.004722 -0.1805 0.1715 0.9953 0.8349 1.187
hu_birth_cohort1700M1705 0.03213 -0.1379 0.2028 1.033 0.8712 1.225
hu_birth_cohort1705M1710 -0.01408 -0.1829 0.1546 0.986 0.8328 1.167
hu_birth_cohort1710M1715 0.07567 -0.09227 0.2408 1.079 0.9119 1.272
hu_birth_cohort1715M1720 0.1518 -0.01155 0.3202 1.164 0.9885 1.377
hu_birth_cohort1720M1725 0.1233 -0.03361 0.2832 1.131 0.9669 1.327
hu_birth_cohort1725M1730 0.2683 0.1056 0.4295 1.308 1.111 1.536
hu_birth_cohort1730M1735 0.3293 0.1701 0.4823 1.39 1.185 1.62
hu_birth_cohort1735M1740 0.2678 0.1111 0.4211 1.307 1.117 1.524
hu_male1 0.4996 0.4506 0.5476 1.648 1.569 1.729
hu_maternalage.factor1420 -0.06365 -0.1752 0.04111 0.9383 0.8393 1.042
hu_maternalage.factor3550 -0.003812 -0.08574 0.08163 0.9962 0.9178 1.085
hu_paternalage.mean 0.009224 -0.1103 0.129 1.009 0.8956 1.138
hu_paternal_loss01 0.2037 -0.001404 0.4069 1.226 0.9986 1.502
hu_paternal_loss15 0.1361 -0.01679 0.2979 1.146 0.9834 1.347
hu_paternal_loss510 0.06553 -0.07775 0.1992 1.068 0.9252 1.22
hu_paternal_loss1015 0.01235 -0.1181 0.14 1.012 0.8886 1.15
hu_paternal_loss1520 0.1121 -0.002966 0.2298 1.119 0.997 1.258
hu_paternal_loss2025 0.0475 -0.0625 0.1605 1.049 0.9394 1.174
hu_paternal_loss2530 0.1146 0.002544 0.2224 1.121 1.003 1.249
hu_paternal_loss3035 0.1166 0.01432 0.2198 1.124 1.014 1.246
hu_paternal_loss3540 0.09111 -0.01547 0.198 1.095 0.9847 1.219
hu_paternal_loss4045 0.08169 -0.03464 0.1998 1.085 0.966 1.221
hu_paternal_lossunclear 0.2437 0.1354 0.3537 1.276 1.145 1.424
hu_maternal_loss01 0.3125 0.1043 0.5215 1.367 1.11 1.685
hu_maternal_loss15 0.00495 -0.1309 0.1352 1.005 0.8773 1.145
hu_maternal_loss510 0.122 0.003794 0.2455 1.13 1.004 1.278
hu_maternal_loss1015 0.1141 -0.004075 0.2326 1.121 0.9959 1.262
hu_maternal_loss1520 -0.01648 -0.1382 0.1054 0.9837 0.871 1.111
hu_maternal_loss2025 0.05549 -0.058 0.1648 1.057 0.9437 1.179
hu_maternal_loss2530 -0.061 -0.1698 0.04449 0.9408 0.8439 1.045
hu_maternal_loss3035 0.003389 -0.09059 0.1009 1.003 0.9134 1.106
hu_maternal_loss3540 0.05584 -0.03361 0.1524 1.057 0.9669 1.165
hu_maternal_loss4045 -0.03516 -0.1324 0.06015 0.9654 0.876 1.062
hu_maternal_lossunclear 0.1 0.0004178 0.1968 1.105 1 1.217
hu_older_siblings1 0.09623 0.004527 0.1896 1.101 1.005 1.209
hu_older_siblings2 0.07132 -0.02678 0.1702 1.074 0.9736 1.186
hu_older_siblings3 0.06643 -0.04641 0.1804 1.069 0.9547 1.198
hu_older_siblings4 0.06509 -0.05687 0.1901 1.067 0.9447 1.209
hu_older_siblings5P 0.04233 -0.1088 0.1969 1.043 0.8969 1.218
hu_nr.siblings -0.002082 -0.01338 0.009103 0.9979 0.9867 1.009
hu_last_born1 -0.02558 -0.1123 0.06176 0.9747 0.8938 1.064

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 5.89 [5.66;6.12] [5.74;6.05]
estimate father 35y 5.91 [5.65;6.16] [5.74;6.08]
percentage change 0.22 [-2.27;2.76] [-1.43;1.94]
OR/IRR 0.01 [-0.01;0.03] [-0.01;0.02]
OR hurdle 0.04 [-0.08;0.15] [-0.03;0.11]

Marginal effect plots

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

Coefficient estimates (95% and 80% credibility).

mcmc_intervals(as.matrix(model$fit), regex_pars = "b_[^I]")

mcmc_areas(as.matrix(model$fit), regex_pars = "b")

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

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 by average sample size

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

Monte Carlo SE

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

Trace plots

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

Further plots

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

File name

coefs/rpqa/s1_control_age.rds

Cluster script

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: 32562) 
## 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: 10222) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.04      0.01     0.03     0.05        421 1.03
## sd(hu_Intercept)     4.92      3.94     0.23    14.84       2530 1.00
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     1.28      0.02     1.24     1.32       1139
## paternalage                   0.02      0.01     0.00     0.04       1933
## age_at_1st_child             -0.60      0.00    -0.61    -0.59       3000
## age_at_last_child             0.56      0.00     0.55     0.56       2474
## birth_cohort1675M1680         0.02      0.01     0.00     0.05        587
## birth_cohort1680M1685         0.06      0.01     0.03     0.09        564
## birth_cohort1685M1690         0.08      0.01     0.05     0.11        561
## birth_cohort1690M1695         0.07      0.01     0.04     0.10        537
## birth_cohort1695M1700         0.10      0.01     0.07     0.12        512
## birth_cohort1700M1705         0.08      0.01     0.05     0.10        497
## birth_cohort1705M1710         0.08      0.01     0.05     0.10        465
## birth_cohort1710M1715         0.07      0.01     0.05     0.10        471
## birth_cohort1715M1720         0.08      0.01     0.05     0.10        472
## birth_cohort1720M1725         0.06      0.01     0.04     0.09        442
## birth_cohort1725M1730         0.04      0.01     0.01     0.06        445
## birth_cohort1730M1735         0.06      0.01     0.03     0.08        440
## birth_cohort1735M1740         0.07      0.01     0.04     0.09        434
## male1                        -0.03      0.00    -0.04    -0.02       3000
## maternalage.factor1420       -0.01      0.01    -0.03     0.00       3000
## maternalage.factor3550       -0.01      0.01    -0.02     0.01       3000
## paternalage.mean             -0.03      0.01    -0.05    -0.01       2054
## paternal_loss01               0.01      0.02    -0.03     0.04       3000
## paternal_loss15              -0.01      0.01    -0.03     0.01       3000
## paternal_loss510             -0.02      0.01    -0.04     0.00       2579
## paternal_loss1015            -0.01      0.01    -0.03     0.01       2416
## paternal_loss1520            -0.02      0.01    -0.03     0.00       2368
## paternal_loss2025            -0.02      0.01    -0.04     0.00       2258
## paternal_loss2530             0.00      0.01    -0.02     0.01       2187
## paternal_loss3035             0.00      0.01    -0.02     0.01       2337
## paternal_loss3540            -0.01      0.01    -0.02     0.01       2300
## paternal_loss4045             0.00      0.01    -0.01     0.02       3000
## paternal_lossunclear         -0.03      0.01    -0.05    -0.02       2084
## maternal_loss01               0.03      0.02    -0.01     0.07       3000
## maternal_loss15               0.02      0.01    -0.01     0.04       3000
## maternal_loss510              0.00      0.01    -0.02     0.02       3000
## maternal_loss1015            -0.01      0.01    -0.02     0.01       3000
## maternal_loss1520             0.00      0.01    -0.02     0.02       3000
## maternal_loss2025             0.00      0.01    -0.02     0.02       3000
## maternal_loss2530             0.00      0.01    -0.02     0.02       3000
## maternal_loss3035            -0.01      0.01    -0.02     0.01       3000
## maternal_loss3540             0.00      0.01    -0.02     0.01       3000
## maternal_loss4045             0.01      0.01    -0.01     0.02       3000
## maternal_lossunclear         -0.02      0.01    -0.04    -0.01       3000
## older_siblings1              -0.02      0.01    -0.03    -0.01       3000
## older_siblings2              -0.02      0.01    -0.03     0.00       2438
## older_siblings3              -0.02      0.01    -0.04     0.00       2103
## older_siblings4              -0.03      0.01    -0.05    -0.01       1978
## older_siblings5P             -0.04      0.01    -0.06    -0.01       1819
## nr.siblings                   0.01      0.00     0.01     0.01       2288
## last_born1                    0.00      0.01    -0.01     0.02       3000
## hu_Intercept                 -1.51      4.88   -10.95     8.13       3000
## hu_paternalage               -4.27      4.44   -13.09     4.24       3000
## hu_age_at_1st_child          -3.34      4.58   -12.38     5.38       3000
## hu_age_at_last_child         -4.58      4.12   -13.28     2.90       3000
## hu_birth_cohort1675M1680      0.03      5.02    -9.95     9.90       3000
## hu_birth_cohort1680M1685     -0.21      4.92    -9.89     9.21       3000
## hu_birth_cohort1685M1690     -0.12      4.89    -9.77     9.56       3000
## hu_birth_cohort1690M1695     -0.13      4.95    -9.70     9.51       3000
## hu_birth_cohort1695M1700     -0.09      4.93    -9.77     9.56       3000
## hu_birth_cohort1700M1705     -0.11      5.00    -9.86     9.50       3000
## hu_birth_cohort1705M1710     -0.17      4.93    -9.61     9.75       3000
## hu_birth_cohort1710M1715     -0.21      5.14    -9.79     9.53       3000
## hu_birth_cohort1715M1720     -0.10      4.77    -9.37     9.11       3000
## hu_birth_cohort1720M1725     -0.14      4.97   -10.07     9.55       3000
## hu_birth_cohort1725M1730     -0.18      4.87    -9.79     9.13       3000
## hu_birth_cohort1730M1735     -0.28      4.80    -9.67     9.04       3000
## hu_birth_cohort1735M1740     -0.13      5.04    -9.94     9.82       3000
## hu_male1                     -0.45      4.82    -9.99     8.85       3000
## hu_maternalage.factor1420    -0.31      4.68    -9.54     8.86       3000
## hu_maternalage.factor3550    -0.20      4.95    -9.85     9.44       3000
## hu_paternalage.mean          -4.29      4.40   -13.23     4.43       3000
## hu_paternal_loss01           -0.28      4.86    -9.81     9.06       3000
## hu_paternal_loss15           -0.11      4.91    -9.77     9.19       3000
## hu_paternal_loss510          -0.06      4.88    -9.66     9.34       3000
## hu_paternal_loss1015         -0.02      4.91    -9.59     9.20       3000
## hu_paternal_loss1520         -0.14      4.83    -9.24     9.60       3000
## hu_paternal_loss2025         -0.03      5.06   -10.14     9.94       3000
## hu_paternal_loss2530          0.06      4.83    -9.32     9.45       3000
## hu_paternal_loss3035         -0.30      5.04   -10.12     9.48       3000
## hu_paternal_loss3540         -0.32      4.89    -9.99     9.08       3000
## hu_paternal_loss4045         -0.05      4.92    -9.92     9.55       3000
## hu_paternal_lossunclear      -0.38      4.86    -9.85     8.93       3000
## hu_maternal_loss01           -0.08      4.79    -9.76     9.06       3000
## hu_maternal_loss15           -0.24      5.04    -9.91     9.77       3000
## hu_maternal_loss510           0.02      5.12    -9.76    10.02       3000
## hu_maternal_loss1015         -0.05      4.92    -9.42     9.52       3000
## hu_maternal_loss1520         -0.07      4.90    -9.51     9.64       3000
## hu_maternal_loss2025          0.01      4.85    -9.61     9.13       3000
## hu_maternal_loss2530         -0.20      4.89    -9.94     9.55       3000
## hu_maternal_loss3035         -0.13      4.98    -9.84     9.45       3000
## hu_maternal_loss3540          0.07      5.06   -10.21    10.07       3000
## hu_maternal_loss4045         -0.06      4.92    -9.47     9.72       3000
## hu_maternal_lossunclear      -0.15      4.82    -9.79     9.03       3000
## hu_older_siblings1           -0.41      5.04   -10.26     9.22       3000
## hu_older_siblings2           -0.11      4.89    -9.84     9.44       3000
## hu_older_siblings3           -0.10      5.10   -10.05     9.89       3000
## hu_older_siblings4           -0.10      4.87    -9.89     9.21       3000
## hu_older_siblings5P           0.01      5.01   -10.09     9.84       3000
## hu_nr.siblings               -3.92      3.30   -11.21     1.23       2316
## hu_last_born1                -0.29      4.88    -9.91     9.24       3000
##                           Rhat
## Intercept                 1.00
## paternalage               1.00
## age_at_1st_child          1.00
## age_at_last_child         1.00
## birth_cohort1675M1680     1.01
## birth_cohort1680M1685     1.01
## birth_cohort1685M1690     1.01
## birth_cohort1690M1695     1.01
## birth_cohort1695M1700     1.01
## birth_cohort1700M1705     1.01
## birth_cohort1705M1710     1.02
## birth_cohort1710M1715     1.02
## birth_cohort1715M1720     1.02
## birth_cohort1720M1725     1.02
## birth_cohort1725M1730     1.02
## birth_cohort1730M1735     1.02
## birth_cohort1735M1740     1.02
## male1                     1.00
## maternalage.factor1420    1.00
## maternalage.factor3550    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
## paternal_lossunclear      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
## maternal_lossunclear      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_cohort1675M1680  1.00
## hu_birth_cohort1680M1685  1.00
## hu_birth_cohort1685M1690  1.00
## hu_birth_cohort1690M1695  1.00
## hu_birth_cohort1695M1700  1.00
## hu_birth_cohort1700M1705  1.00
## hu_birth_cohort1705M1710  1.00
## hu_birth_cohort1710M1715  1.00
## hu_birth_cohort1715M1720  1.00
## hu_birth_cohort1720M1725  1.00
## hu_birth_cohort1725M1730  1.00
## hu_birth_cohort1730M1735  1.00
## hu_birth_cohort1735M1740  1.00
## hu_male1                  1.00
## hu_maternalage.factor1420 1.00
## hu_maternalage.factor3550 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_paternal_lossunclear   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_maternal_lossunclear   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

fixed_eff = data.frame(model_summary$fixed, check.names = F)
fixed_eff$Est.Error = fixed_eff$Eff.Sample = fixed_eff$Rhat = NULL
fixed_eff$OR = exp(fixed_eff$Estimate)
fixed_eff$OR_low = exp(fixed_eff$`l-95% CI`)
fixed_eff$OR_high = exp(fixed_eff$`u-95% CI`)
pander::pander(fixed_eff)
  Estimate l-95% CI u-95% CI OR OR_low OR_high
Intercept 1.278 1.235 1.321 3.589 3.439 3.746
paternalage 0.02203 0.004399 0.03987 1.022 1.004 1.041
age_at_1st_child -0.5967 -0.6053 -0.5881 0.5506 0.5459 0.5554
age_at_last_child 0.5554 0.5498 0.5608 1.743 1.733 1.752
birth_cohort1675M1680 0.02399 -0.003858 0.05308 1.024 0.9961 1.055
birth_cohort1680M1685 0.06047 0.03216 0.08876 1.062 1.033 1.093
birth_cohort1685M1690 0.07632 0.04706 0.1052 1.079 1.048 1.111
birth_cohort1690M1695 0.06825 0.04158 0.09556 1.071 1.042 1.1
birth_cohort1695M1700 0.09613 0.07092 0.1227 1.101 1.073 1.131
birth_cohort1700M1705 0.07819 0.05285 0.1042 1.081 1.054 1.11
birth_cohort1705M1710 0.07606 0.05167 0.1018 1.079 1.053 1.107
birth_cohort1710M1715 0.07426 0.04971 0.09935 1.077 1.051 1.104
birth_cohort1715M1720 0.0757 0.05085 0.1 1.079 1.052 1.105
birth_cohort1720M1725 0.06434 0.03993 0.08864 1.066 1.041 1.093
birth_cohort1725M1730 0.03719 0.01315 0.06107 1.038 1.013 1.063
birth_cohort1730M1735 0.05646 0.03176 0.08032 1.058 1.032 1.084
birth_cohort1735M1740 0.06836 0.04395 0.0935 1.071 1.045 1.098
male1 -0.02639 -0.03549 -0.01762 0.974 0.9651 0.9825
maternalage.factor1420 -0.01223 -0.02803 0.004642 0.9878 0.9724 1.005
maternalage.factor3550 -0.006041 -0.01972 0.008222 0.994 0.9805 1.008
paternalage.mean -0.02898 -0.04738 -0.009772 0.9714 0.9537 0.9903
paternal_loss01 0.005464 -0.02788 0.03859 1.005 0.9725 1.039
paternal_loss15 -0.008685 -0.03194 0.01464 0.9914 0.9686 1.015
paternal_loss510 -0.01855 -0.03837 0.001102 0.9816 0.9624 1.001
paternal_loss1015 -0.006981 -0.02509 0.01174 0.993 0.9752 1.012
paternal_loss1520 -0.01664 -0.03462 0.0002009 0.9835 0.966 1
paternal_loss2025 -0.01844 -0.03514 -0.002106 0.9817 0.9655 0.9979
paternal_loss2530 -0.00263 -0.01927 0.014 0.9974 0.9809 1.014
paternal_loss3035 -0.003868 -0.01881 0.01207 0.9961 0.9814 1.012
paternal_loss3540 -0.007965 -0.02314 0.006959 0.9921 0.9771 1.007
paternal_loss4045 0.003335 -0.01364 0.02081 1.003 0.9865 1.021
paternal_lossunclear -0.03489 -0.05088 -0.01971 0.9657 0.9504 0.9805
maternal_loss01 0.02934 -0.009444 0.0679 1.03 0.9906 1.07
maternal_loss15 0.01635 -0.006621 0.03826 1.016 0.9934 1.039
maternal_loss510 -0.001285 -0.02066 0.01726 0.9987 0.9795 1.017
maternal_loss1015 -0.006171 -0.02464 0.01201 0.9938 0.9757 1.012
maternal_loss1520 0.001821 -0.01593 0.01986 1.002 0.9842 1.02
maternal_loss2025 -0.002602 -0.02075 0.01519 0.9974 0.9795 1.015
maternal_loss2530 2.113e-05 -0.01555 0.01629 1 0.9846 1.016
maternal_loss3035 -0.005365 -0.02027 0.00906 0.9946 0.9799 1.009
maternal_loss3540 -0.003329 -0.01805 0.01053 0.9967 0.9821 1.011
maternal_loss4045 0.007358 -0.006637 0.02192 1.007 0.9934 1.022
maternal_lossunclear -0.02189 -0.03646 -0.007167 0.9783 0.9642 0.9929
older_siblings1 -0.01973 -0.03378 -0.005771 0.9805 0.9668 0.9942
older_siblings2 -0.0182 -0.03372 -0.002237 0.982 0.9668 0.9978
older_siblings3 -0.01975 -0.03766 -0.001771 0.9804 0.963 0.9982
older_siblings4 -0.02701 -0.04634 -0.006829 0.9734 0.9547 0.9932
older_siblings5P -0.03806 -0.0616 -0.01369 0.9627 0.9403 0.9864
nr.siblings 0.007007 0.005368 0.00864 1.007 1.005 1.009
last_born1 0.003391 -0.01089 0.01732 1.003 0.9892 1.017
hu_Intercept -1.512 -10.95 8.132 0.2205 1.764e-05 3402
hu_paternalage -4.269 -13.09 4.245 0.01399 2.066e-06 69.74
hu_age_at_1st_child -3.342 -12.38 5.375 0.03538 4.189e-06 216
hu_age_at_last_child -4.584 -13.28 2.899 0.01021 1.714e-06 18.16
hu_birth_cohort1675M1680 0.031 -9.949 9.903 1.031 4.776e-05 19992
hu_birth_cohort1680M1685 -0.2126 -9.888 9.206 0.8085 5.077e-05 9952
hu_birth_cohort1685M1690 -0.1167 -9.773 9.555 0.8898 5.699e-05 14117
hu_birth_cohort1690M1695 -0.126 -9.699 9.511 0.8816 6.133e-05 13505
hu_birth_cohort1695M1700 -0.08567 -9.767 9.562 0.9179 5.733e-05 14216
hu_birth_cohort1700M1705 -0.1092 -9.857 9.504 0.8966 5.236e-05 13416
hu_birth_cohort1705M1710 -0.1717 -9.608 9.75 0.8423 6.722e-05 17154
hu_birth_cohort1710M1715 -0.2087 -9.786 9.533 0.8116 5.623e-05 13802
hu_birth_cohort1715M1720 -0.1046 -9.373 9.112 0.9007 8.497e-05 9064
hu_birth_cohort1720M1725 -0.1392 -10.07 9.551 0.8701 4.218e-05 14053
hu_birth_cohort1725M1730 -0.1779 -9.793 9.131 0.837 5.584e-05 9233
hu_birth_cohort1730M1735 -0.278 -9.67 9.041 0.7573 6.315e-05 8441
hu_birth_cohort1735M1740 -0.1348 -9.945 9.819 0.8739 4.798e-05 18375
hu_male1 -0.4525 -9.987 8.852 0.6361 4.6e-05 6986
hu_maternalage.factor1420 -0.308 -9.544 8.857 0.7349 7.166e-05 7025
hu_maternalage.factor3550 -0.2048 -9.848 9.435 0.8148 5.287e-05 12520
hu_paternalage.mean -4.294 -13.23 4.434 0.01364 1.802e-06 84.28
hu_paternal_loss01 -0.2785 -9.815 9.059 0.7569 5.464e-05 8593
hu_paternal_loss15 -0.1077 -9.77 9.193 0.8979 5.713e-05 9829
hu_paternal_loss510 -0.05851 -9.657 9.337 0.9432 6.396e-05 11349
hu_paternal_loss1015 -0.01795 -9.589 9.2 0.9822 6.847e-05 9900
hu_paternal_loss1520 -0.1367 -9.244 9.595 0.8722 9.669e-05 14693
hu_paternal_loss2025 -0.03407 -10.14 9.94 0.9665 3.944e-05 20751
hu_paternal_loss2530 0.05735 -9.319 9.454 1.059 8.97e-05 12757
hu_paternal_loss3035 -0.3026 -10.12 9.479 0.7389 4.036e-05 13076
hu_paternal_loss3540 -0.3237 -9.991 9.081 0.7235 4.579e-05 8789
hu_paternal_loss4045 -0.04537 -9.916 9.545 0.9556 4.937e-05 13978
hu_paternal_lossunclear -0.3823 -9.851 8.934 0.6823 5.267e-05 7587
hu_maternal_loss01 -0.07966 -9.755 9.065 0.9234 5.798e-05 8647
hu_maternal_loss15 -0.2369 -9.912 9.766 0.7891 4.959e-05 17436
hu_maternal_loss510 0.02197 -9.755 10.02 1.022 5.799e-05 22397
hu_maternal_loss1015 -0.0504 -9.421 9.518 0.9509 8.103e-05 13600
hu_maternal_loss1520 -0.07343 -9.515 9.636 0.9292 7.374e-05 15303
hu_maternal_loss2025 0.009957 -9.607 9.127 1.01 6.726e-05 9198
hu_maternal_loss2530 -0.1951 -9.937 9.55 0.8228 4.837e-05 14048
hu_maternal_loss3035 -0.129 -9.841 9.452 0.879 5.324e-05 12732
hu_maternal_loss3540 0.07062 -10.21 10.07 1.073 3.691e-05 23669
hu_maternal_loss4045 -0.0646 -9.469 9.716 0.9374 7.718e-05 16589
hu_maternal_lossunclear -0.1473 -9.787 9.035 0.8631 5.615e-05 8390
hu_older_siblings1 -0.4053 -10.26 9.222 0.6668 3.5e-05 10115
hu_older_siblings2 -0.1099 -9.844 9.435 0.8959 5.304e-05 12519
hu_older_siblings3 -0.09686 -10.05 9.889 0.9077 4.317e-05 19704
hu_older_siblings4 -0.103 -9.893 9.21 0.9022 5.054e-05 9995
hu_older_siblings5P 0.00728 -10.09 9.836 1.007 4.165e-05 18702
hu_nr.siblings -3.918 -11.21 1.225 0.01988 1.352e-05 3.405
hu_last_born1 -0.2915 -9.911 9.241 0.7471 4.964e-05 10311

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 8.05 [7.84;8.26] [7.92;8.19]
estimate father 35y 8.23 [8;8.47] [8.08;8.39]
percentage change 2.24 [0.44;4.07] [1.02;3.43]
OR/IRR 0.02 [0;0.04] [0.01;0.03]
OR hurdle -4.17 [-13.09;4.24] [-9.98;1.43]

Marginal effect plots

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

Coefficient estimates (95% and 80% credibility).

mcmc_intervals(as.matrix(model$fit), regex_pars = "b_[^I]")

mcmc_areas(as.matrix(model$fit), regex_pars = "b")

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

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 by average sample size

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

Monte Carlo SE

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

Trace plots

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

Further plots

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

File name

coefs/rpqa/s2_reproductive_timing.rds

Cluster script

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

Cluster script