Krummhörn (1720-1850) main models

Loading details

source("0__helpers.R")
opts_chunk$set(warning=TRUE, cache = FALSE,tidy=FALSE,dev=c('png'),fig.width=20,fig.height=12.5)

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

Analysis description

Data subset

The krmh.1 dataset contains only those participants where paternal age is known, the birthdate is between 1720 and 1850 and the marriage is known (meaning we know when it started and how it ended by spousal death). In known marriages we can assume that missing death dates for the kids mean that they migrated out.

Model description

All of the following models have the following in common:

Estimation

We fit all models using brms v. 1.2.0, a Bayesian regression analysis statistical package. brms uses Stan, a probabilistic programming langugage to fit models using Hamiltonian Monte Carlo.

Covariates

In our main models we adjust for average paternal age in the family, birth cohort (birth years in five equally large bins), for male sex, for age at paternal and maternal loss (0-1, 2-5, 6-10, …, 41-45, 45+, unknown), for maternal age (bins of 14-20, 20-35 and 35-50), for the number of siblings, for the number of older siblings (0-5, 5+) and for being last born.

Model stratification

We added random intercepts for each family (father-mother dyad). We then controlled for the average paternal age in the family. Hence, the paternal age effects in the plot are split into those between families and those within families or between siblings. We are interested in the effect of paternal age between siblings, as this effect cannot be explained by e.g. genetic propensities of the father to reproduce late.

m1: No sibling comparison

Here, we ignore the pedigree structure of the data to see whether it matters for the estimation of the paternal age effect.

Model summary

Full summary

model_summary = summary(model, use_cache = FALSE, priors = TRUE)
print(model_summary)
##  Family: hurdle_poisson (log) 
## Formula: children ~ paternalage + birth_cohort + male + maternalage.factor + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born 
##          hu ~ paternalage + birth_cohort + male + maternalage.factor + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born
##    Data: model_data (Number of observations: 9447) 
## Samples: 6 chains, each with iter = 800; warmup = 300; thin = 1; 
##          total post-warmup samples = 3000
##    WAIC: Not computed
##  
## Priors: 
## b ~ normal(0,5)
## b_hu ~ normal(0,5)
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     1.67      0.06     1.56     1.80       1197
## paternalage                   0.00      0.01    -0.03     0.03       3000
## birth_cohort1760M1765         0.00      0.06    -0.11     0.12       1254
## birth_cohort1765M1770        -0.13      0.05    -0.23    -0.03        940
## birth_cohort1770M1775        -0.10      0.05    -0.20    -0.01        831
## birth_cohort1775M1780        -0.02      0.05    -0.11     0.07        841
## birth_cohort1780M1785        -0.13      0.05    -0.23    -0.03        983
## birth_cohort1785M1790        -0.09      0.05    -0.18     0.00        756
## birth_cohort1790M1795        -0.07      0.04    -0.16     0.02        726
## birth_cohort1795M1800        -0.11      0.04    -0.19    -0.03        665
## birth_cohort1800M1805        -0.12      0.04    -0.19    -0.04        641
## birth_cohort1805M1810        -0.14      0.04    -0.22    -0.05        684
## birth_cohort1810M1815        -0.10      0.04    -0.18    -0.02        606
## birth_cohort1815M1820        -0.15      0.04    -0.22    -0.08        533
## birth_cohort1820M1825        -0.18      0.04    -0.26    -0.11        568
## birth_cohort1825M1830        -0.20      0.04    -0.27    -0.12        589
## birth_cohort1830M1835        -0.18      0.04    -0.25    -0.10        597
## male1                         0.08      0.02     0.05     0.11       3000
## maternalage.factor1420       -0.08      0.08    -0.25     0.08       3000
## maternalage.factor3550        0.01      0.02    -0.04     0.06       2035
## paternal_loss01              -0.15      0.07    -0.28    -0.02       3000
## paternal_loss15              -0.03      0.04    -0.11     0.06       1507
## paternal_loss510             -0.07      0.04    -0.14     0.00       1558
## paternal_loss1015             0.00      0.03    -0.06     0.07       1342
## paternal_loss1520            -0.10      0.03    -0.17    -0.04       1637
## paternal_loss2025            -0.13      0.03    -0.19    -0.06       1470
## paternal_loss2530            -0.01      0.03    -0.07     0.05       1427
## paternal_loss3035            -0.04      0.03    -0.10     0.01       1509
## paternal_loss3540            -0.03      0.03    -0.08     0.03       1386
## paternal_loss4045            -0.01      0.03    -0.08     0.05       1666
## maternal_loss01               0.10      0.07    -0.03     0.23       2605
## maternal_loss15               0.00      0.04    -0.08     0.08       3000
## maternal_loss510              0.07      0.04     0.00     0.13       2044
## maternal_loss1015             0.04      0.04    -0.03     0.11       3000
## maternal_loss1520             0.00      0.04    -0.07     0.07       3000
## maternal_loss2025             0.01      0.03    -0.05     0.08       3000
## maternal_loss2530            -0.01      0.03    -0.06     0.05       1861
## maternal_loss3035            -0.04      0.03    -0.09     0.02       2288
## maternal_loss3540            -0.02      0.03    -0.08     0.03       1945
## maternal_loss4045            -0.03      0.03    -0.08     0.03       3000
## older_siblings1               0.03      0.02    -0.01     0.08       1942
## older_siblings2              -0.02      0.03    -0.07     0.03       1664
## older_siblings3              -0.03      0.03    -0.09     0.03       1564
## older_siblings4              -0.04      0.04    -0.11     0.03       1494
## older_siblings5P             -0.01      0.04    -0.09     0.06       1176
## nr.siblings                   0.00      0.00    -0.01     0.01       1999
## last_born1                   -0.05      0.02    -0.10    -0.01       3000
## hu_Intercept                 -0.37      0.17    -0.70    -0.04        867
## hu_paternalage                0.08      0.04     0.01     0.16       1749
## hu_birth_cohort1760M1765     -0.03      0.16    -0.33     0.28       1148
## hu_birth_cohort1765M1770     -0.28      0.14    -0.55    -0.01        822
## hu_birth_cohort1770M1775     -0.06      0.13    -0.31     0.21        915
## hu_birth_cohort1775M1780     -0.19      0.13    -0.45     0.07        648
## hu_birth_cohort1780M1785     -0.25      0.13    -0.52     0.00        764
## hu_birth_cohort1785M1790     -0.39      0.13    -0.64    -0.13        901
## hu_birth_cohort1790M1795     -0.28      0.12    -0.52    -0.05        638
## hu_birth_cohort1795M1800     -0.42      0.11    -0.65    -0.19        503
## hu_birth_cohort1800M1805     -0.51      0.11    -0.72    -0.28        652
## hu_birth_cohort1805M1810     -0.26      0.11    -0.48    -0.03        503
## hu_birth_cohort1810M1815     -0.42      0.11    -0.62    -0.20        457
## hu_birth_cohort1815M1820     -0.66      0.10    -0.86    -0.45        634
## hu_birth_cohort1820M1825     -0.49      0.11    -0.70    -0.28        454
## hu_birth_cohort1825M1830     -0.50      0.10    -0.70    -0.29        442
## hu_birth_cohort1830M1835     -0.51      0.11    -0.71    -0.30        649
## hu_male1                      0.26      0.04     0.17     0.34       3000
## hu_maternalage.factor1420     0.26      0.22    -0.18     0.71       2831
## hu_maternalage.factor3550     0.14      0.06     0.02     0.27       2257
## hu_paternal_loss01            0.56      0.17     0.25     0.89       3000
## hu_paternal_loss15            0.51      0.12     0.29     0.75       1590
## hu_paternal_loss510           0.19      0.10     0.00     0.40       1281
## hu_paternal_loss1015          0.15      0.09    -0.05     0.33       1423
## hu_paternal_loss1520          0.09      0.09    -0.09     0.27       1337
## hu_paternal_loss2025          0.14      0.09    -0.04     0.31       1209
## hu_paternal_loss2530          0.05      0.09    -0.11     0.22       1253
## hu_paternal_loss3035         -0.02      0.08    -0.18     0.15       1241
## hu_paternal_loss3540         -0.02      0.08    -0.18     0.14       1312
## hu_paternal_loss4045          0.14      0.10    -0.05     0.32       1375
## hu_maternal_loss01            1.51      0.18     1.16     1.88       2281
## hu_maternal_loss15            0.57      0.11     0.37     0.78       1949
## hu_maternal_loss510           0.47      0.10     0.27     0.66       2142
## hu_maternal_loss1015          0.46      0.10     0.28     0.66       3000
## hu_maternal_loss1520          0.29      0.10     0.10     0.49       2299
## hu_maternal_loss2025          0.26      0.09     0.09     0.44       1599
## hu_maternal_loss2530          0.18      0.08     0.02     0.35       1970
## hu_maternal_loss3035          0.20      0.08     0.05     0.36       1827
## hu_maternal_loss3540          0.07      0.07    -0.08     0.21       1327
## hu_maternal_loss4045          0.26      0.08     0.10     0.42       1710
## hu_older_siblings1            0.03      0.06    -0.10     0.15       1682
## hu_older_siblings2           -0.07      0.07    -0.22     0.07       1743
## hu_older_siblings3           -0.07      0.08    -0.23     0.09       1248
## hu_older_siblings4           -0.06      0.10    -0.25     0.12       1326
## hu_older_siblings5P          -0.32      0.11    -0.54    -0.11       1026
## hu_nr.siblings                0.08      0.01     0.06     0.11       1435
## hu_last_born1                 0.08      0.06    -0.04     0.20       3000
##                           Rhat
## Intercept                 1.00
## paternalage               1.00
## birth_cohort1760M1765     1.01
## birth_cohort1765M1770     1.01
## birth_cohort1770M1775     1.01
## birth_cohort1775M1780     1.01
## birth_cohort1780M1785     1.01
## birth_cohort1785M1790     1.01
## birth_cohort1790M1795     1.01
## birth_cohort1795M1800     1.01
## birth_cohort1800M1805     1.01
## birth_cohort1805M1810     1.01
## birth_cohort1810M1815     1.01
## birth_cohort1815M1820     1.01
## birth_cohort1820M1825     1.01
## birth_cohort1825M1830     1.01
## birth_cohort1830M1835     1.01
## male1                     1.00
## maternalage.factor1420    1.00
## maternalage.factor3550    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.01
## hu_paternalage            1.00
## hu_birth_cohort1760M1765  1.00
## hu_birth_cohort1765M1770  1.01
## hu_birth_cohort1770M1775  1.00
## hu_birth_cohort1775M1780  1.00
## hu_birth_cohort1780M1785  1.01
## hu_birth_cohort1785M1790  1.01
## hu_birth_cohort1790M1795  1.01
## hu_birth_cohort1795M1800  1.01
## hu_birth_cohort1800M1805  1.01
## hu_birth_cohort1805M1810  1.01
## hu_birth_cohort1810M1815  1.01
## hu_birth_cohort1815M1820  1.01
## hu_birth_cohort1820M1825  1.01
## hu_birth_cohort1825M1830  1.01
## hu_birth_cohort1830M1835  1.01
## hu_male1                  1.00
## hu_maternalage.factor1420 1.00
## hu_maternalage.factor3550 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.01
## hu_maternal_loss15        1.01
## 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

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.675 1.56 1.797 5.337 4.757 6.032
paternalage -0.001276 -0.02939 0.02612 0.9987 0.971 1.026
birth_cohort1760M1765 0.003592 -0.1065 0.1164 1.004 0.899 1.123
birth_cohort1765M1770 -0.1326 -0.2292 -0.03042 0.8758 0.7952 0.97
birth_cohort1770M1775 -0.1038 -0.2045 -0.008622 0.9014 0.8151 0.9914
birth_cohort1775M1780 -0.02287 -0.1116 0.06986 0.9774 0.8944 1.072
birth_cohort1780M1785 -0.1259 -0.2286 -0.02639 0.8817 0.7956 0.974
birth_cohort1785M1790 -0.09062 -0.1813 0.001314 0.9134 0.8342 1.001
birth_cohort1790M1795 -0.06535 -0.1554 0.02001 0.9367 0.856 1.02
birth_cohort1795M1800 -0.1089 -0.1886 -0.02782 0.8968 0.8281 0.9726
birth_cohort1800M1805 -0.1155 -0.1939 -0.03859 0.8909 0.8237 0.9621
birth_cohort1805M1810 -0.1381 -0.2178 -0.055 0.8711 0.8043 0.9465
birth_cohort1810M1815 -0.09895 -0.1765 -0.02227 0.9058 0.8382 0.978
birth_cohort1815M1820 -0.1471 -0.2199 -0.0763 0.8632 0.8026 0.9265
birth_cohort1820M1825 -0.1821 -0.2596 -0.1058 0.8335 0.7713 0.8996
birth_cohort1825M1830 -0.1952 -0.2737 -0.1205 0.8227 0.7605 0.8865
birth_cohort1830M1835 -0.1757 -0.2548 -0.09937 0.8389 0.7751 0.9054
male1 0.07898 0.04814 0.1091 1.082 1.049 1.115
maternalage.factor1420 -0.07573 -0.2505 0.08477 0.9271 0.7784 1.088
maternalage.factor3550 0.01037 -0.03662 0.05681 1.01 0.964 1.058
paternal_loss01 -0.1458 -0.2783 -0.01789 0.8643 0.7571 0.9823
paternal_loss15 -0.02686 -0.1135 0.06035 0.9735 0.8927 1.062
paternal_loss510 -0.07099 -0.1442 0.0001079 0.9315 0.8657 1
paternal_loss1015 -0.0004153 -0.06276 0.06779 0.9996 0.9392 1.07
paternal_loss1520 -0.1012 -0.1664 -0.03657 0.9037 0.8467 0.9641
paternal_loss2025 -0.1318 -0.1944 -0.06322 0.8765 0.8234 0.9387
paternal_loss2530 -0.01195 -0.06979 0.04739 0.9881 0.9326 1.049
paternal_loss3035 -0.04474 -0.101 0.01217 0.9562 0.9039 1.012
paternal_loss3540 -0.02569 -0.08457 0.02973 0.9746 0.9189 1.03
paternal_loss4045 -0.01438 -0.07826 0.05111 0.9857 0.9247 1.052
maternal_loss01 0.1049 -0.03248 0.2344 1.111 0.968 1.264
maternal_loss15 -0.0002326 -0.07976 0.07993 0.9998 0.9233 1.083
maternal_loss510 0.06815 -0.002826 0.1349 1.071 0.9972 1.144
maternal_loss1015 0.03512 -0.03419 0.1052 1.036 0.9664 1.111
maternal_loss1520 0.00386 -0.0652 0.07308 1.004 0.9369 1.076
maternal_loss2025 0.01337 -0.05283 0.0791 1.013 0.9485 1.082
maternal_loss2530 -0.008031 -0.06483 0.05187 0.992 0.9372 1.053
maternal_loss3035 -0.03675 -0.09162 0.01879 0.9639 0.9125 1.019
maternal_loss3540 -0.02496 -0.07844 0.02506 0.9753 0.9246 1.025
maternal_loss4045 -0.02665 -0.08479 0.03133 0.9737 0.9187 1.032
older_siblings1 0.03375 -0.01107 0.07827 1.034 0.989 1.081
older_siblings2 -0.01834 -0.06833 0.03188 0.9818 0.934 1.032
older_siblings3 -0.03117 -0.08759 0.02711 0.9693 0.9161 1.027
older_siblings4 -0.03692 -0.1067 0.03208 0.9638 0.8988 1.033
older_siblings5P -0.01334 -0.08856 0.06177 0.9867 0.9152 1.064
nr.siblings 0.002852 -0.005535 0.01118 1.003 0.9945 1.011
last_born1 -0.05321 -0.09585 -0.009617 0.9482 0.9086 0.9904
hu_Intercept -0.3701 -0.7012 -0.03957 0.6907 0.496 0.9612
hu_paternalage 0.08468 0.007975 0.1603 1.088 1.008 1.174
hu_birth_cohort1760M1765 -0.03134 -0.3333 0.2827 0.9691 0.7165 1.327
hu_birth_cohort1765M1770 -0.2791 -0.5494 -0.01418 0.7565 0.5773 0.9859
hu_birth_cohort1770M1775 -0.05834 -0.3105 0.2078 0.9433 0.7331 1.231
hu_birth_cohort1775M1780 -0.1886 -0.4451 0.06716 0.8281 0.6408 1.069
hu_birth_cohort1780M1785 -0.2536 -0.5158 -0.004764 0.776 0.597 0.9952
hu_birth_cohort1785M1790 -0.3928 -0.6409 -0.1324 0.6752 0.5268 0.876
hu_birth_cohort1790M1795 -0.2818 -0.5186 -0.04595 0.7544 0.5954 0.9551
hu_birth_cohort1795M1800 -0.422 -0.6453 -0.1918 0.6558 0.5245 0.8255
hu_birth_cohort1800M1805 -0.5066 -0.7216 -0.2848 0.6026 0.486 0.7521
hu_birth_cohort1805M1810 -0.2593 -0.476 -0.03125 0.7716 0.6212 0.9692
hu_birth_cohort1810M1815 -0.4159 -0.6172 -0.1964 0.6597 0.5395 0.8216
hu_birth_cohort1815M1820 -0.6592 -0.862 -0.4476 0.5173 0.4223 0.6391
hu_birth_cohort1820M1825 -0.4913 -0.6959 -0.2762 0.6119 0.4986 0.7587
hu_birth_cohort1825M1830 -0.5003 -0.7011 -0.2938 0.6063 0.4961 0.7455
hu_birth_cohort1830M1835 -0.5061 -0.7133 -0.3043 0.6028 0.49 0.7376
hu_male1 0.2595 0.1743 0.3446 1.296 1.19 1.411
hu_maternalage.factor1420 0.2621 -0.1806 0.7123 1.3 0.8348 2.039
hu_maternalage.factor3550 0.1449 0.01843 0.269 1.156 1.019 1.309
hu_paternal_loss01 0.5626 0.2499 0.8875 1.755 1.284 2.429
hu_paternal_loss15 0.5141 0.2856 0.7453 1.672 1.331 2.107
hu_paternal_loss510 0.1905 -0.002904 0.3957 1.21 0.9971 1.485
hu_paternal_loss1015 0.1461 -0.04582 0.3251 1.157 0.9552 1.384
hu_paternal_loss1520 0.08836 -0.08789 0.2674 1.092 0.9159 1.307
hu_paternal_loss2025 0.1376 -0.03654 0.3073 1.147 0.9641 1.36
hu_paternal_loss2530 0.05254 -0.1124 0.2201 1.054 0.8937 1.246
hu_paternal_loss3035 -0.01924 -0.1782 0.1475 0.9809 0.8367 1.159
hu_paternal_loss3540 -0.01611 -0.1773 0.1435 0.984 0.8375 1.154
hu_paternal_loss4045 0.1365 -0.04916 0.3215 1.146 0.952 1.379
hu_maternal_loss01 1.507 1.157 1.879 4.512 3.18 6.547
hu_maternal_loss15 0.5701 0.3656 0.7833 1.768 1.441 2.189
hu_maternal_loss510 0.4657 0.2738 0.6567 1.593 1.315 1.929
hu_maternal_loss1015 0.4627 0.2797 0.6639 1.588 1.323 1.942
hu_maternal_loss1520 0.2916 0.09764 0.4872 1.339 1.103 1.628
hu_maternal_loss2025 0.2641 0.08539 0.4436 1.302 1.089 1.558
hu_maternal_loss2530 0.1832 0.01899 0.3456 1.201 1.019 1.413
hu_maternal_loss3035 0.2013 0.05406 0.3603 1.223 1.056 1.434
hu_maternal_loss3540 0.06807 -0.07525 0.2059 1.07 0.9275 1.229
hu_maternal_loss4045 0.2569 0.09951 0.4163 1.293 1.105 1.516
hu_older_siblings1 0.02685 -0.09854 0.151 1.027 0.9062 1.163
hu_older_siblings2 -0.07302 -0.2176 0.0682 0.9296 0.8045 1.071
hu_older_siblings3 -0.07201 -0.2315 0.09214 0.9305 0.7933 1.097
hu_older_siblings4 -0.06461 -0.2512 0.1238 0.9374 0.7779 1.132
hu_older_siblings5P -0.3241 -0.5359 -0.112 0.7232 0.5852 0.8941
hu_nr.siblings 0.08384 0.06116 0.1069 1.087 1.063 1.113
hu_last_born1 0.08016 -0.04352 0.2006 1.083 0.9574 1.222

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 2.36 [2.07;2.7] [2.16;2.57]
estimate father 35y 2.24 [1.95;2.59] [2.04;2.46]
percentage change -4.87 [-9.82;0.17] [-8.12;-1.57]
OR/IRR 1 [0.97;1.03] [0.98;1.02]
OR hurdle 1.09 [1.01;1.17] [1.03;1.15]

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)

plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11plot of chunk unnamed-chunk-11

Coefficient plot

Coefficient estimates (95% and 80% credibility).

mcmc_intervals(as.matrix(model$fit), regex_pars = "b_[^I]")
plot of chunk unnamed-chunk-12

plot of chunk unnamed-chunk-12

mcmc_areas(as.matrix(model$fit), regex_pars = "b")
plot of chunk unnamed-chunk-12

plot of chunk unnamed-chunk-12

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

brms::pp_check(model, re_formula = NA, type = "dens_overlay")
plot of chunk unnamed-chunk-13

plot of chunk unnamed-chunk-13

brms::pp_check(model, re_formula = NA, type = "hist")
plot of chunk unnamed-chunk-13

plot of chunk unnamed-chunk-13

Rhat

Did the 6 chains converge?

stanplot(model, pars = "^b_[^I]", type = 'rhat')
plot of chunk unnamed-chunk-14

plot of chunk unnamed-chunk-14

Effective sample size by average sample size

stanplot(model, pars = "^b", type = 'ess')
plot of chunk unnamed-chunk-15

plot of chunk unnamed-chunk-15

Monte Carlo SE

stanplot(model, pars = "^b", type = 'mcse')
plot of chunk unnamed-chunk-16

plot of chunk unnamed-chunk-16

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')
plot of chunk unnamed-chunk-18

plot of chunk unnamed-chunk-18

File name

coefs/krmh/m1_children_linear_noranef.rds

Cluster script

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

Cluster script

m2: Sibling comparison, no paternal age effect

Here, we compared siblings by including a random intercept for the family, but we modelled no effect for paternal age differences among siblings.

Model summary

Full summary

model_summary = summary(model, use_cache = FALSE, priors = TRUE)
print(model_summary)
##  Family: hurdle_poisson (log) 
## Formula: children ~ birth_cohort + male + maternalage.factor + paternalage.mean + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born + (1 | idParents) 
##          hu ~ 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: 9447) 
## Samples: 6 chains, each with iter = 1500; warmup = 1000; 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: 2186) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.23      0.01     0.20     0.25        989 1.00
## sd(hu_Intercept)     0.48      0.05     0.39     0.56        793 1.01
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     1.64      0.08     1.48     1.79       1187
## birth_cohort1760M1765         0.00      0.06    -0.12     0.12       1392
## birth_cohort1765M1770        -0.11      0.06    -0.23     0.00       1002
## birth_cohort1770M1775        -0.11      0.06    -0.22     0.00       1034
## birth_cohort1775M1780        -0.02      0.05    -0.12     0.09        952
## birth_cohort1780M1785        -0.10      0.06    -0.21     0.01        977
## birth_cohort1785M1790        -0.09      0.05    -0.20     0.01        901
## birth_cohort1790M1795        -0.07      0.05    -0.17     0.03        824
## birth_cohort1795M1800        -0.10      0.05    -0.19     0.00        599
## birth_cohort1800M1805        -0.11      0.05    -0.20    -0.01        701
## birth_cohort1805M1810        -0.13      0.05    -0.22    -0.03        782
## birth_cohort1810M1815        -0.09      0.05    -0.18     0.00        730
## birth_cohort1815M1820        -0.14      0.04    -0.22    -0.05        647
## birth_cohort1820M1825        -0.18      0.05    -0.27    -0.09        720
## birth_cohort1825M1830        -0.20      0.05    -0.29    -0.12        744
## birth_cohort1830M1835        -0.17      0.05    -0.27    -0.08        665
## male1                         0.08      0.02     0.04     0.11       3000
## maternalage.factor1420       -0.06      0.09    -0.24     0.12       3000
## maternalage.factor3550        0.01      0.03    -0.04     0.06       2246
## paternalage.mean              0.00      0.02    -0.04     0.03       1904
## paternal_loss01              -0.15      0.07    -0.28     0.00       3000
## paternal_loss15              -0.03      0.05    -0.13     0.07       1502
## paternal_loss510             -0.06      0.04    -0.15     0.02       1424
## paternal_loss1015             0.01      0.04    -0.06     0.09       1182
## paternal_loss1520            -0.09      0.04    -0.16    -0.02       1390
## paternal_loss2025            -0.12      0.04    -0.19    -0.04       1248
## paternal_loss2530            -0.01      0.03    -0.08     0.06       1133
## paternal_loss3035            -0.03      0.03    -0.10     0.04       1137
## paternal_loss3540            -0.01      0.03    -0.07     0.05       1249
## paternal_loss4045            -0.01      0.04    -0.08     0.06       1402
## maternal_loss01               0.11      0.08    -0.04     0.26       3000
## maternal_loss15              -0.01      0.05    -0.11     0.08       3000
## maternal_loss510              0.07      0.04     0.00     0.15       2124
## maternal_loss1015             0.03      0.04    -0.05     0.11       2313
## maternal_loss1520             0.01      0.04    -0.07     0.09       3000
## maternal_loss2025             0.01      0.04    -0.07     0.08       3000
## maternal_loss2530            -0.02      0.03    -0.08     0.05       1850
## maternal_loss3035            -0.05      0.03    -0.12     0.01       1764
## maternal_loss3540            -0.03      0.03    -0.09     0.02       2033
## maternal_loss4045            -0.03      0.03    -0.09     0.04       3000
## older_siblings1               0.04      0.02    -0.01     0.09       3000
## older_siblings2              -0.02      0.03    -0.07     0.04       1964
## older_siblings3              -0.03      0.03    -0.09     0.03       1478
## older_siblings4              -0.03      0.04    -0.11     0.04       1636
## older_siblings5P             -0.01      0.04    -0.09     0.07       1238
## nr.siblings                   0.00      0.01    -0.01     0.01       1543
## last_born1                   -0.04      0.02    -0.09     0.00       3000
## hu_Intercept                 -0.37      0.20    -0.76     0.03       1021
## hu_birth_cohort1760M1765     -0.05      0.17    -0.39     0.28       3000
## hu_birth_cohort1765M1770     -0.31      0.15    -0.60    -0.03        903
## hu_birth_cohort1770M1775     -0.06      0.15    -0.34     0.22        910
## hu_birth_cohort1775M1780     -0.20      0.14    -0.49     0.08        924
## hu_birth_cohort1780M1785     -0.28      0.15    -0.56     0.02       1098
## hu_birth_cohort1785M1790     -0.42      0.14    -0.70    -0.15        885
## hu_birth_cohort1790M1795     -0.31      0.14    -0.59    -0.04        842
## hu_birth_cohort1795M1800     -0.46      0.13    -0.72    -0.22        755
## hu_birth_cohort1800M1805     -0.54      0.12    -0.79    -0.30        708
## hu_birth_cohort1805M1810     -0.27      0.13    -0.52    -0.03        777
## hu_birth_cohort1810M1815     -0.44      0.12    -0.68    -0.20        667
## hu_birth_cohort1815M1820     -0.70      0.12    -0.93    -0.48        667
## hu_birth_cohort1820M1825     -0.52      0.12    -0.75    -0.30        648
## hu_birth_cohort1825M1830     -0.54      0.12    -0.78    -0.33        648
## hu_birth_cohort1830M1835     -0.55      0.12    -0.78    -0.32        662
## hu_male1                      0.27      0.04     0.19     0.36       3000
## hu_maternalage.factor1420     0.23      0.23    -0.21     0.68       3000
## hu_maternalage.factor3550     0.18      0.07     0.05     0.31       3000
## hu_paternalage.mean           0.08      0.04    -0.01     0.16       1729
## hu_paternal_loss01            0.61      0.18     0.27     0.96       3000
## hu_paternal_loss15            0.56      0.13     0.31     0.81       1907
## hu_paternal_loss510           0.22      0.11     0.00     0.44       1478
## hu_paternal_loss1015          0.17      0.11    -0.04     0.38       1428
## hu_paternal_loss1520          0.12      0.10    -0.08     0.32       1457
## hu_paternal_loss2025          0.17      0.10    -0.03     0.36       1272
## hu_paternal_loss2530          0.07      0.09    -0.12     0.25       1508
## hu_paternal_loss3035         -0.01      0.09    -0.19     0.17       1438
## hu_paternal_loss3540         -0.01      0.09    -0.19     0.16       1666
## hu_paternal_loss4045          0.15      0.10    -0.05     0.34       1873
## hu_maternal_loss01            1.61      0.18     1.25     1.97       3000
## hu_maternal_loss15            0.61      0.12     0.38     0.84       3000
## hu_maternal_loss510           0.50      0.10     0.29     0.70       1776
## hu_maternal_loss1015          0.48      0.11     0.27     0.70       3000
## hu_maternal_loss1520          0.32      0.11     0.11     0.53       3000
## hu_maternal_loss2025          0.27      0.10     0.07     0.47       3000
## hu_maternal_loss2530          0.20      0.09     0.02     0.38       3000
## hu_maternal_loss3035          0.22      0.09     0.05     0.39       1584
## hu_maternal_loss3540          0.07      0.08    -0.09     0.23       1843
## hu_maternal_loss4045          0.28      0.09     0.11     0.45       3000
## hu_older_siblings1            0.05      0.07    -0.09     0.18       3000
## hu_older_siblings2           -0.04      0.07    -0.18     0.10       2278
## hu_older_siblings3           -0.02      0.08    -0.18     0.14       1866
## hu_older_siblings4            0.00      0.10    -0.18     0.19       1861
## hu_older_siblings5P          -0.25      0.11    -0.46    -0.04       1612
## hu_nr.siblings                0.08      0.01     0.05     0.11       1753
## hu_last_born1                 0.08      0.06    -0.05     0.21       3000
##                           Rhat
## Intercept                 1.00
## birth_cohort1760M1765     1.00
## birth_cohort1765M1770     1.01
## birth_cohort1770M1775     1.00
## birth_cohort1775M1780     1.00
## birth_cohort1780M1785     1.00
## birth_cohort1785M1790     1.01
## birth_cohort1790M1795     1.01
## birth_cohort1795M1800     1.01
## birth_cohort1800M1805     1.01
## birth_cohort1805M1810     1.01
## birth_cohort1810M1815     1.01
## birth_cohort1815M1820     1.01
## birth_cohort1820M1825     1.01
## birth_cohort1825M1830     1.01
## birth_cohort1830M1835     1.01
## 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
## 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_birth_cohort1760M1765  1.00
## hu_birth_cohort1765M1770  1.01
## hu_birth_cohort1770M1775  1.00
## hu_birth_cohort1775M1780  1.01
## hu_birth_cohort1780M1785  1.01
## hu_birth_cohort1785M1790  1.01
## hu_birth_cohort1790M1795  1.01
## hu_birth_cohort1795M1800  1.01
## hu_birth_cohort1800M1805  1.01
## hu_birth_cohort1805M1810  1.01
## hu_birth_cohort1810M1815  1.01
## hu_birth_cohort1815M1820  1.01
## hu_birth_cohort1820M1825  1.01
## hu_birth_cohort1825M1830  1.01
## hu_birth_cohort1830M1835  1.01
## 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.01
## 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

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.64 1.484 1.791 5.154 4.412 5.995
birth_cohort1760M1765 0.002957 -0.121 0.1248 1.003 0.886 1.133
birth_cohort1765M1770 -0.1124 -0.2272 -0.001452 0.8937 0.7968 0.9985
birth_cohort1770M1775 -0.1084 -0.2181 -0.001055 0.8973 0.804 0.9989
birth_cohort1775M1780 -0.01791 -0.122 0.08556 0.9822 0.8852 1.089
birth_cohort1780M1785 -0.1042 -0.2132 0.008854 0.9011 0.808 1.009
birth_cohort1785M1790 -0.08926 -0.199 0.01018 0.9146 0.8196 1.01
birth_cohort1790M1795 -0.07042 -0.1731 0.02925 0.932 0.841 1.03
birth_cohort1795M1800 -0.1001 -0.1926 -0.002873 0.9047 0.8248 0.9971
birth_cohort1800M1805 -0.1074 -0.1994 -0.01487 0.8981 0.8192 0.9852
birth_cohort1805M1810 -0.1302 -0.2244 -0.02864 0.8779 0.799 0.9718
birth_cohort1810M1815 -0.09204 -0.1837 -0.00157 0.9121 0.8321 0.9984
birth_cohort1815M1820 -0.1365 -0.2196 -0.05389 0.8724 0.8029 0.9475
birth_cohort1820M1825 -0.1788 -0.267 -0.09076 0.8362 0.7656 0.9132
birth_cohort1825M1830 -0.2039 -0.2934 -0.1157 0.8155 0.7457 0.8908
birth_cohort1830M1835 -0.1749 -0.2684 -0.0834 0.8395 0.7646 0.92
male1 0.0769 0.04364 0.1097 1.08 1.045 1.116
maternalage.factor1420 -0.06186 -0.2405 0.1226 0.94 0.7862 1.13
maternalage.factor3550 0.009406 -0.03941 0.06154 1.009 0.9614 1.063
paternalage.mean -0.003783 -0.03947 0.03171 0.9962 0.9613 1.032
paternal_loss01 -0.1472 -0.285 -0.003704 0.8631 0.752 0.9963
paternal_loss15 -0.02893 -0.1282 0.07103 0.9715 0.8797 1.074
paternal_loss510 -0.06249 -0.1469 0.01929 0.9394 0.8634 1.019
paternal_loss1015 0.01084 -0.06491 0.09015 1.011 0.9372 1.094
paternal_loss1520 -0.09029 -0.1633 -0.01611 0.9137 0.8493 0.984
paternal_loss2025 -0.1169 -0.1913 -0.04043 0.8897 0.8259 0.9604
paternal_loss2530 -0.007089 -0.07562 0.05904 0.9929 0.9272 1.061
paternal_loss3035 -0.02618 -0.09538 0.03969 0.9742 0.909 1.04
paternal_loss3540 -0.007858 -0.07131 0.05383 0.9922 0.9312 1.055
paternal_loss4045 -0.009 -0.07762 0.06273 0.991 0.9253 1.065
maternal_loss01 0.1095 -0.04348 0.2609 1.116 0.9575 1.298
maternal_loss15 -0.01349 -0.1093 0.07789 0.9866 0.8965 1.081
maternal_loss510 0.0748 -0.00473 0.1546 1.078 0.9953 1.167
maternal_loss1015 0.03187 -0.05127 0.1142 1.032 0.95 1.121
maternal_loss1520 0.007226 -0.07491 0.08645 1.007 0.9278 1.09
maternal_loss2025 0.009611 -0.06602 0.08467 1.01 0.9361 1.088
maternal_loss2530 -0.01809 -0.084 0.04688 0.9821 0.9194 1.048
maternal_loss3035 -0.04896 -0.1157 0.0131 0.9522 0.8907 1.013
maternal_loss3540 -0.03084 -0.08776 0.02393 0.9696 0.916 1.024
maternal_loss4045 -0.02834 -0.0924 0.03658 0.9721 0.9117 1.037
older_siblings1 0.04041 -0.007468 0.08931 1.041 0.9926 1.093
older_siblings2 -0.01705 -0.07196 0.0355 0.9831 0.9306 1.036
older_siblings3 -0.02885 -0.09004 0.0315 0.9716 0.9139 1.032
older_siblings4 -0.0338 -0.1063 0.03949 0.9668 0.8992 1.04
older_siblings5P -0.01251 -0.09243 0.06961 0.9876 0.9117 1.072
nr.siblings 0.003444 -0.007042 0.01342 1.003 0.993 1.014
last_born1 -0.04366 -0.09034 0.002228 0.9573 0.9136 1.002
hu_Intercept -0.3652 -0.7605 0.03381 0.6941 0.4674 1.034
hu_birth_cohort1760M1765 -0.04873 -0.388 0.2764 0.9524 0.6784 1.318
hu_birth_cohort1765M1770 -0.3125 -0.5994 -0.0343 0.7316 0.5492 0.9663
hu_birth_cohort1770M1775 -0.06063 -0.3444 0.2205 0.9412 0.7086 1.247
hu_birth_cohort1775M1780 -0.1981 -0.4891 0.07655 0.8203 0.6132 1.08
hu_birth_cohort1780M1785 -0.277 -0.5645 0.0194 0.758 0.5686 1.02
hu_birth_cohort1785M1790 -0.4248 -0.7037 -0.151 0.6539 0.4948 0.8599
hu_birth_cohort1790M1795 -0.3125 -0.5863 -0.04496 0.7316 0.5564 0.956
hu_birth_cohort1795M1800 -0.4625 -0.7169 -0.2197 0.6297 0.4883 0.8028
hu_birth_cohort1800M1805 -0.539 -0.7877 -0.2956 0.5834 0.4549 0.7441
hu_birth_cohort1805M1810 -0.269 -0.5189 -0.03203 0.7641 0.5952 0.9685
hu_birth_cohort1810M1815 -0.436 -0.6786 -0.2031 0.6466 0.5073 0.8162
hu_birth_cohort1815M1820 -0.7012 -0.9327 -0.4761 0.496 0.3935 0.6212
hu_birth_cohort1820M1825 -0.5235 -0.7514 -0.299 0.5925 0.4717 0.7416
hu_birth_cohort1825M1830 -0.5446 -0.7818 -0.3291 0.5801 0.4576 0.7196
hu_birth_cohort1830M1835 -0.5492 -0.7822 -0.3153 0.5774 0.4574 0.7296
hu_male1 0.2734 0.1863 0.3608 1.314 1.205 1.435
hu_maternalage.factor1420 0.2252 -0.2123 0.6833 1.253 0.8087 1.98
hu_maternalage.factor3550 0.1797 0.04562 0.3074 1.197 1.047 1.36
hu_paternalage.mean 0.0761 -0.007585 0.1642 1.079 0.9924 1.178
hu_paternal_loss01 0.6099 0.2749 0.956 1.84 1.316 2.601
hu_paternal_loss15 0.5622 0.3063 0.8108 1.755 1.358 2.25
hu_paternal_loss510 0.2177 0.00318 0.4363 1.243 1.003 1.547
hu_paternal_loss1015 0.174 -0.0369 0.3823 1.19 0.9638 1.466
hu_paternal_loss1520 0.1176 -0.08061 0.3232 1.125 0.9226 1.382
hu_paternal_loss2025 0.1661 -0.03137 0.3579 1.181 0.9691 1.43
hu_paternal_loss2530 0.06898 -0.1157 0.2497 1.071 0.8908 1.284
hu_paternal_loss3035 -0.01499 -0.1934 0.1717 0.9851 0.8242 1.187
hu_paternal_loss3540 -0.009141 -0.1854 0.1649 0.9909 0.8308 1.179
hu_paternal_loss4045 0.1472 -0.04543 0.3444 1.159 0.9556 1.411
hu_maternal_loss01 1.606 1.249 1.97 4.98 3.486 7.174
hu_maternal_loss15 0.6092 0.3767 0.8441 1.839 1.457 2.326
hu_maternal_loss510 0.4961 0.2949 0.6992 1.642 1.343 2.012
hu_maternal_loss1015 0.4826 0.2654 0.6958 1.62 1.304 2.005
hu_maternal_loss1520 0.3209 0.1129 0.5288 1.378 1.12 1.697
hu_maternal_loss2025 0.273 0.07281 0.4708 1.314 1.076 1.601
hu_maternal_loss2530 0.1985 0.02475 0.384 1.22 1.025 1.468
hu_maternal_loss3035 0.2213 0.05218 0.3913 1.248 1.054 1.479
hu_maternal_loss3540 0.07305 -0.08608 0.2345 1.076 0.9175 1.264
hu_maternal_loss4045 0.2771 0.1073 0.4486 1.319 1.113 1.566
hu_older_siblings1 0.04649 -0.08742 0.1785 1.048 0.9163 1.195
hu_older_siblings2 -0.03798 -0.1778 0.1039 0.9627 0.8371 1.11
hu_older_siblings3 -0.01924 -0.183 0.144 0.9809 0.8328 1.155
hu_older_siblings4 -0.002544 -0.1846 0.1932 0.9975 0.8315 1.213
hu_older_siblings5P -0.2476 -0.4607 -0.03635 0.7807 0.6308 0.9643
hu_nr.siblings 0.08078 0.05322 0.1081 1.084 1.055 1.114
hu_last_born1 0.08136 -0.04558 0.2072 1.085 0.9554 1.23

Paternal age effect

pander::pander(paternal_age_10y_effect(model))

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)

plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24plot of chunk unnamed-chunk-24

Coefficient plot

Coefficient estimates (95% and 80% credibility).

mcmc_intervals(as.matrix(model$fit), regex_pars = "b_[^I]")
plot of chunk unnamed-chunk-25

plot of chunk unnamed-chunk-25

mcmc_areas(as.matrix(model$fit), regex_pars = "b")
plot of chunk unnamed-chunk-25

plot of chunk unnamed-chunk-25

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

brms::pp_check(model, re_formula = NA, type = "dens_overlay")
plot of chunk unnamed-chunk-26

plot of chunk unnamed-chunk-26

brms::pp_check(model, re_formula = NA, type = "hist")
plot of chunk unnamed-chunk-26

plot of chunk unnamed-chunk-26

Rhat

Did the 6 chains converge?

stanplot(model, pars = "^b_[^I]", type = 'rhat')
plot of chunk unnamed-chunk-27

plot of chunk unnamed-chunk-27

Effective sample size by average sample size

stanplot(model, pars = "^b", type = 'ess')
plot of chunk unnamed-chunk-28

plot of chunk unnamed-chunk-28

Monte Carlo SE

stanplot(model, pars = "^b", type = 'mcse')
plot of chunk unnamed-chunk-29

plot of chunk unnamed-chunk-29

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')
plot of chunk unnamed-chunk-31

plot of chunk unnamed-chunk-31

File name

coefs/krmh/m2_children_linear_no_diff.rds

Cluster script

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

Cluster script

m3: Sibling comparison, linear paternal age effect

Here, we compared siblings by including a random intercept for the family, and we modelled a linear effect for paternal age differences among siblings.

Model summary

Full summary

model_summary = summary(model, use_cache = FALSE, priors = TRUE)
print(model_summary)
##  Family: hurdle_poisson (log) 
## Formula: children ~ paternalage + birth_cohort + male + maternalage.factor + paternalage.mean + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born + (1 | idParents) 
##          hu ~ paternalage + 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: 9447) 
## 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: 2186) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.22      0.01     0.20     0.25       1120 1.00
## sd(hu_Intercept)     0.47      0.04     0.39     0.56        966 1.01
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     1.65      0.08     1.50     1.80       1158
## paternalage                   0.07      0.05    -0.03     0.18        798
## birth_cohort1760M1765         0.00      0.06    -0.13     0.12       1050
## birth_cohort1765M1770        -0.12      0.06    -0.23    -0.01        687
## birth_cohort1770M1775        -0.11      0.06    -0.23     0.00        675
## birth_cohort1775M1780        -0.02      0.06    -0.14     0.08        642
## birth_cohort1780M1785        -0.11      0.06    -0.22     0.01        713
## birth_cohort1785M1790        -0.09      0.06    -0.20     0.02        604
## birth_cohort1790M1795        -0.07      0.05    -0.17     0.03        616
## birth_cohort1795M1800        -0.10      0.05    -0.21     0.00        538
## birth_cohort1800M1805        -0.11      0.05    -0.21    -0.01        519
## birth_cohort1805M1810        -0.13      0.05    -0.23    -0.03        576
## birth_cohort1810M1815        -0.10      0.05    -0.19     0.00        531
## birth_cohort1815M1820        -0.14      0.05    -0.23    -0.04        491
## birth_cohort1820M1825        -0.18      0.05    -0.27    -0.09        517
## birth_cohort1825M1830        -0.21      0.05    -0.30    -0.11        520
## birth_cohort1830M1835        -0.18      0.05    -0.28    -0.08        535
## male1                         0.08      0.02     0.05     0.11       3000
## maternalage.factor1420       -0.06      0.09    -0.24     0.12       3000
## maternalage.factor3550        0.00      0.03    -0.06     0.05       3000
## paternalage.mean             -0.07      0.05    -0.18     0.04        844
## paternal_loss01              -0.16      0.07    -0.30    -0.01       3000
## paternal_loss15              -0.04      0.05    -0.14     0.06       1761
## paternal_loss510             -0.07      0.04    -0.16     0.02       1692
## paternal_loss1015             0.01      0.04    -0.07     0.09       1566
## paternal_loss1520            -0.10      0.04    -0.17    -0.02       1397
## paternal_loss2025            -0.12      0.04    -0.20    -0.04       1652
## paternal_loss2530            -0.01      0.03    -0.08     0.06       1424
## paternal_loss3035            -0.03      0.03    -0.10     0.04       1355
## paternal_loss3540            -0.01      0.03    -0.07     0.05       1553
## paternal_loss4045            -0.01      0.04    -0.08     0.06       3000
## maternal_loss01               0.10      0.08    -0.06     0.25       3000
## maternal_loss15              -0.02      0.05    -0.11     0.07       3000
## maternal_loss510              0.07      0.04    -0.01     0.15       3000
## maternal_loss1015             0.03      0.04    -0.05     0.10       3000
## maternal_loss1520             0.00      0.04    -0.07     0.08       3000
## maternal_loss2025             0.00      0.04    -0.07     0.08       3000
## maternal_loss2530            -0.02      0.03    -0.09     0.05       3000
## maternal_loss3035            -0.05      0.03    -0.11     0.01       3000
## maternal_loss3540            -0.03      0.03    -0.09     0.02       3000
## maternal_loss4045            -0.03      0.03    -0.09     0.03       3000
## older_siblings1               0.03      0.03    -0.03     0.08       1699
## older_siblings2              -0.05      0.04    -0.12     0.02       1030
## older_siblings3              -0.07      0.05    -0.17     0.02        881
## older_siblings4              -0.09      0.06    -0.21     0.02        842
## older_siblings5P             -0.10      0.08    -0.25     0.05        770
## nr.siblings                   0.01      0.01     0.00     0.02        951
## last_born1                   -0.04      0.02    -0.09     0.00       3000
## hu_Intercept                 -0.33      0.19    -0.71     0.05        985
## hu_paternalage                0.26      0.14    -0.01     0.53        857
## hu_birth_cohort1760M1765     -0.05      0.17    -0.39     0.29       3000
## hu_birth_cohort1765M1770     -0.31      0.15    -0.61    -0.01        844
## hu_birth_cohort1770M1775     -0.07      0.15    -0.37     0.23        798
## hu_birth_cohort1775M1780     -0.20      0.15    -0.49     0.09        786
## hu_birth_cohort1780M1785     -0.28      0.15    -0.57     0.01        682
## hu_birth_cohort1785M1790     -0.42      0.14    -0.71    -0.15        728
## hu_birth_cohort1790M1795     -0.31      0.13    -0.57    -0.05        736
## hu_birth_cohort1795M1800     -0.46      0.13    -0.70    -0.21        674
## hu_birth_cohort1800M1805     -0.54      0.12    -0.79    -0.29        599
## hu_birth_cohort1805M1810     -0.27      0.13    -0.52    -0.03        575
## hu_birth_cohort1810M1815     -0.44      0.12    -0.67    -0.19        592
## hu_birth_cohort1815M1820     -0.70      0.12    -0.93    -0.47        538
## hu_birth_cohort1820M1825     -0.53      0.12    -0.75    -0.29        551
## hu_birth_cohort1825M1830     -0.55      0.12    -0.78    -0.31        547
## hu_birth_cohort1830M1835     -0.56      0.12    -0.79    -0.32        620
## hu_male1                      0.27      0.05     0.18     0.36       3000
## hu_maternalage.factor1420     0.24      0.23    -0.23     0.70       3000
## hu_maternalage.factor3550     0.13      0.07    -0.01     0.27       3000
## hu_paternalage.mean          -0.18      0.14    -0.45     0.10        862
## hu_paternal_loss01            0.58      0.18     0.23     0.94       3000
## hu_paternal_loss15            0.53      0.13     0.28     0.79       3000
## hu_paternal_loss510           0.19      0.11    -0.03     0.41       1747
## hu_paternal_loss1015          0.16      0.11    -0.05     0.37       1768
## hu_paternal_loss1520          0.10      0.10    -0.09     0.30       1695
## hu_paternal_loss2025          0.15      0.10    -0.04     0.34       1409
## hu_paternal_loss2530          0.06      0.09    -0.12     0.24       1424
## hu_paternal_loss3035         -0.02      0.09    -0.20     0.16       1316
## hu_paternal_loss3540         -0.02      0.09    -0.19     0.17       1489
## hu_paternal_loss4045          0.14      0.10    -0.06     0.33       3000
## hu_maternal_loss01            1.58      0.18     1.24     1.94       3000
## hu_maternal_loss15            0.59      0.12     0.36     0.82       3000
## hu_maternal_loss510           0.48      0.10     0.28     0.69       3000
## hu_maternal_loss1015          0.47      0.11     0.27     0.69       3000
## hu_maternal_loss1520          0.31      0.11     0.10     0.52       3000
## hu_maternal_loss2025          0.26      0.11     0.05     0.47       3000
## hu_maternal_loss2530          0.19      0.09     0.01     0.37       3000
## hu_maternal_loss3035          0.22      0.08     0.05     0.38       3000
## hu_maternal_loss3540          0.07      0.08    -0.08     0.23       3000
## hu_maternal_loss4045          0.28      0.08     0.11     0.45       3000
## hu_older_siblings1           -0.01      0.08    -0.16     0.14       1517
## hu_older_siblings2           -0.15      0.10    -0.34     0.03        830
## hu_older_siblings3           -0.19      0.12    -0.42     0.06        815
## hu_older_siblings4           -0.23      0.16    -0.54     0.08        814
## hu_older_siblings5P          -0.57      0.21    -0.97    -0.16        757
## hu_nr.siblings                0.10      0.02     0.07     0.14        938
## hu_last_born1                 0.08      0.06    -0.04     0.21       3000
##                           Rhat
## Intercept                 1.00
## paternalage               1.00
## birth_cohort1760M1765     1.01
## birth_cohort1765M1770     1.02
## birth_cohort1770M1775     1.01
## birth_cohort1775M1780     1.01
## birth_cohort1780M1785     1.01
## birth_cohort1785M1790     1.02
## birth_cohort1790M1795     1.01
## birth_cohort1795M1800     1.02
## birth_cohort1800M1805     1.02
## birth_cohort1805M1810     1.02
## birth_cohort1810M1815     1.02
## birth_cohort1815M1820     1.02
## birth_cohort1820M1825     1.02
## birth_cohort1825M1830     1.02
## birth_cohort1830M1835     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.01
## paternal_loss1520         1.01
## paternal_loss2025         1.01
## paternal_loss2530         1.01
## paternal_loss3035         1.01
## 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_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.01
## hu_birth_cohort1805M1810  1.00
## hu_birth_cohort1810M1815  1.00
## hu_birth_cohort1815M1820  1.01
## hu_birth_cohort1820M1825  1.01
## hu_birth_cohort1825M1830  1.01
## hu_birth_cohort1830M1835  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.01
## hu_paternal_loss2530      1.01
## hu_paternal_loss3035      1.00
## hu_paternal_loss3540      1.01
## hu_paternal_loss4045      1.01
## 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.01
## 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.654 1.502 1.803 5.227 4.489 6.07
paternalage 0.06724 -0.03409 0.176 1.07 0.9665 1.192
birth_cohort1760M1765 -0.002348 -0.1285 0.1242 0.9977 0.8794 1.132
birth_cohort1765M1770 -0.1181 -0.2345 -0.00747 0.8886 0.7909 0.9926
birth_cohort1770M1775 -0.1134 -0.228 0.003039 0.8928 0.7961 1.003
birth_cohort1775M1780 -0.02452 -0.1379 0.08498 0.9758 0.8712 1.089
birth_cohort1780M1785 -0.1075 -0.2191 0.005723 0.8981 0.8033 1.006
birth_cohort1785M1790 -0.09318 -0.2039 0.01857 0.911 0.8155 1.019
birth_cohort1790M1795 -0.07364 -0.1739 0.03437 0.929 0.8404 1.035
birth_cohort1795M1800 -0.1038 -0.2066 -0.0007699 0.9014 0.8134 0.9992
birth_cohort1800M1805 -0.1117 -0.2077 -0.01257 0.8943 0.8125 0.9875
birth_cohort1805M1810 -0.1332 -0.2349 -0.03115 0.8753 0.7907 0.9693
birth_cohort1810M1815 -0.09601 -0.19 0.0007245 0.9085 0.827 1.001
birth_cohort1815M1820 -0.1395 -0.2293 -0.04436 0.8698 0.7951 0.9566
birth_cohort1820M1825 -0.1828 -0.272 -0.09133 0.8329 0.7619 0.9127
birth_cohort1825M1830 -0.2073 -0.2965 -0.1127 0.8128 0.7434 0.8934
birth_cohort1830M1835 -0.1805 -0.275 -0.0821 0.8349 0.7596 0.9212
male1 0.07807 0.04502 0.1101 1.081 1.046 1.116
maternalage.factor1420 -0.05595 -0.2383 0.1218 0.9456 0.788 1.13
maternalage.factor3550 -0.003577 -0.05638 0.05072 0.9964 0.9452 1.052
paternalage.mean -0.06993 -0.1805 0.03519 0.9325 0.8349 1.036
paternal_loss01 -0.1556 -0.3032 -0.01284 0.8559 0.7384 0.9872
paternal_loss15 -0.03767 -0.1404 0.06264 0.963 0.869 1.065
paternal_loss510 -0.06943 -0.1555 0.01789 0.9329 0.856 1.018
paternal_loss1015 0.006428 -0.07257 0.08509 1.006 0.93 1.089
paternal_loss1520 -0.09502 -0.1717 -0.01918 0.9094 0.8422 0.981
paternal_loss2025 -0.1209 -0.1961 -0.04478 0.8861 0.8219 0.9562
paternal_loss2530 -0.01038 -0.07915 0.05825 0.9897 0.9239 1.06
paternal_loss3035 -0.02945 -0.09724 0.0363 0.971 0.9073 1.037
paternal_loss3540 -0.009839 -0.07286 0.05249 0.9902 0.9297 1.054
paternal_loss4045 -0.01019 -0.08459 0.05941 0.9899 0.9189 1.061
maternal_loss01 0.0984 -0.06045 0.2492 1.103 0.9413 1.283
maternal_loss15 -0.02058 -0.1146 0.06838 0.9796 0.8917 1.071
maternal_loss510 0.06998 -0.00904 0.1484 1.072 0.991 1.16
maternal_loss1015 0.02774 -0.04925 0.1048 1.028 0.9519 1.111
maternal_loss1520 0.004045 -0.07384 0.08257 1.004 0.9288 1.086
maternal_loss2025 0.00373 -0.07097 0.07851 1.004 0.9315 1.082
maternal_loss2530 -0.02111 -0.08738 0.04519 0.9791 0.9163 1.046
maternal_loss3035 -0.05069 -0.114 0.01163 0.9506 0.8923 1.012
maternal_loss3540 -0.03308 -0.08965 0.02249 0.9675 0.9142 1.023
maternal_loss4045 -0.02903 -0.09188 0.03197 0.9714 0.9122 1.032
older_siblings1 0.02555 -0.02666 0.08058 1.026 0.9737 1.084
older_siblings2 -0.04796 -0.1204 0.02257 0.9532 0.8866 1.023
older_siblings3 -0.07335 -0.1687 0.01873 0.9293 0.8448 1.019
older_siblings4 -0.093 -0.2097 0.01853 0.9112 0.8108 1.019
older_siblings5P -0.09534 -0.2515 0.0534 0.9091 0.7777 1.055
nr.siblings 0.009628 -0.004591 0.02388 1.01 0.9954 1.024
last_born1 -0.04338 -0.0907 0.002538 0.9575 0.9133 1.003
hu_Intercept -0.3256 -0.7117 0.05237 0.7221 0.4908 1.054
hu_paternalage 0.2611 -0.01262 0.5256 1.298 0.9875 1.691
hu_birth_cohort1760M1765 -0.04923 -0.3863 0.2895 0.952 0.6795 1.336
hu_birth_cohort1765M1770 -0.3117 -0.6063 -0.011 0.7322 0.5454 0.9891
hu_birth_cohort1770M1775 -0.06603 -0.366 0.2293 0.9361 0.6935 1.258
hu_birth_cohort1775M1780 -0.2007 -0.4885 0.08688 0.8182 0.6135 1.091
hu_birth_cohort1780M1785 -0.2793 -0.5666 0.01057 0.7563 0.5674 1.011
hu_birth_cohort1785M1790 -0.4213 -0.7109 -0.1513 0.6562 0.4912 0.8596
hu_birth_cohort1790M1795 -0.3144 -0.5704 -0.05215 0.7302 0.5653 0.9492
hu_birth_cohort1795M1800 -0.4586 -0.6982 -0.2141 0.6322 0.4975 0.8072
hu_birth_cohort1800M1805 -0.5376 -0.7859 -0.2931 0.5841 0.4557 0.7459
hu_birth_cohort1805M1810 -0.269 -0.5229 -0.02782 0.7641 0.5928 0.9726
hu_birth_cohort1810M1815 -0.4382 -0.6686 -0.1928 0.6452 0.5124 0.8247
hu_birth_cohort1815M1820 -0.7035 -0.9313 -0.469 0.4948 0.394 0.6257
hu_birth_cohort1820M1825 -0.5258 -0.748 -0.2946 0.5911 0.4733 0.7448
hu_birth_cohort1825M1830 -0.546 -0.7792 -0.3081 0.5793 0.4588 0.7348
hu_birth_cohort1830M1835 -0.5559 -0.7927 -0.3157 0.5736 0.4526 0.7293
hu_male1 0.2739 0.184 0.3644 1.315 1.202 1.44
hu_maternalage.factor1420 0.2403 -0.2259 0.6953 1.272 0.7978 2.004
hu_maternalage.factor3550 0.1306 -0.008477 0.2736 1.139 0.9916 1.315
hu_paternalage.mean -0.1799 -0.4496 0.1013 0.8353 0.6379 1.107
hu_paternal_loss01 0.5755 0.2274 0.9358 1.778 1.255 2.549
hu_paternal_loss15 0.5312 0.2762 0.7912 1.701 1.318 2.206
hu_paternal_loss510 0.1924 -0.02573 0.4107 1.212 0.9746 1.508
hu_paternal_loss1015 0.1556 -0.05473 0.3693 1.168 0.9467 1.447
hu_paternal_loss1520 0.1025 -0.08786 0.3011 1.108 0.9159 1.351
hu_paternal_loss2025 0.1529 -0.03655 0.3434 1.165 0.9641 1.41
hu_paternal_loss2530 0.06081 -0.1249 0.2373 1.063 0.8826 1.268
hu_paternal_loss3035 -0.0216 -0.2014 0.1593 0.9786 0.8176 1.173
hu_paternal_loss3540 -0.01555 -0.1854 0.1671 0.9846 0.8308 1.182
hu_paternal_loss4045 0.1424 -0.05612 0.3309 1.153 0.9454 1.392
hu_maternal_loss01 1.58 1.241 1.942 4.854 3.458 6.975
hu_maternal_loss15 0.5875 0.3616 0.8202 1.8 1.436 2.271
hu_maternal_loss510 0.4839 0.2791 0.6881 1.622 1.322 1.99
hu_maternal_loss1015 0.4699 0.2657 0.6863 1.6 1.304 1.986
hu_maternal_loss1520 0.3128 0.1024 0.5211 1.367 1.108 1.684
hu_maternal_loss2025 0.2626 0.05155 0.4662 1.3 1.053 1.594
hu_maternal_loss2530 0.1899 0.01313 0.3732 1.209 1.013 1.452
hu_maternal_loss3035 0.215 0.0501 0.3833 1.24 1.051 1.467
hu_maternal_loss3540 0.06671 -0.08411 0.2301 1.069 0.9193 1.259
hu_maternal_loss4045 0.2776 0.1128 0.4456 1.32 1.119 1.561
hu_older_siblings1 -0.009957 -0.1586 0.1376 0.9901 0.8534 1.147
hu_older_siblings2 -0.1535 -0.3445 0.03443 0.8577 0.7086 1.035
hu_older_siblings3 -0.1909 -0.4243 0.05747 0.8262 0.6542 1.059
hu_older_siblings4 -0.2265 -0.5407 0.07623 0.7973 0.5823 1.079
hu_older_siblings5P -0.5675 -0.9728 -0.1629 0.567 0.378 0.8497
hu_nr.siblings 0.1036 0.06807 0.14 1.109 1.07 1.15
hu_last_born1 0.08119 -0.04292 0.2077 1.085 0.958 1.231

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 2.28 [1.9;2.69] [2.04;2.53]
estimate father 35y 2.08 [1.65;2.59] [1.79;2.4]
percentage change -8.41 [-24.83;12.03] [-19.5;3.89]
OR/IRR 1.07 [0.97;1.19] [1;1.14]
OR hurdle 1.3 [0.99;1.69] [1.08;1.55]

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)

plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37plot of chunk unnamed-chunk-37

Coefficient plot

Coefficient estimates (95% and 80% credibility).

mcmc_intervals(as.matrix(model$fit), regex_pars = "b_[^I]")
plot of chunk unnamed-chunk-38

plot of chunk unnamed-chunk-38

mcmc_areas(as.matrix(model$fit), regex_pars = "b")
plot of chunk unnamed-chunk-38

plot of chunk unnamed-chunk-38

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

brms::pp_check(model, re_formula = NA, type = "dens_overlay")
plot of chunk unnamed-chunk-39

plot of chunk unnamed-chunk-39

brms::pp_check(model, re_formula = NA, type = "hist")
plot of chunk unnamed-chunk-39

plot of chunk unnamed-chunk-39

Rhat

Did the 6 chains converge?

stanplot(model, pars = "^b_[^I]", type = 'rhat')
plot of chunk unnamed-chunk-40

plot of chunk unnamed-chunk-40

Effective sample size by average sample size

stanplot(model, pars = "^b", type = 'ess')
plot of chunk unnamed-chunk-41

plot of chunk unnamed-chunk-41

Monte Carlo SE

stanplot(model, pars = "^b", type = 'mcse')
plot of chunk unnamed-chunk-42

plot of chunk unnamed-chunk-42

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')
plot of chunk unnamed-chunk-44

plot of chunk unnamed-chunk-44

File name

coefs/krmh/m3_children_linear.rds

Cluster script

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

Cluster script

m4: Sibling comparison, nonlinear paternal age effect

Here, we compared siblings by including a random intercept for the family, and we modelled a possibly nonlinear effect for paternal age differences among siblings.

Model summary

Full summary

model_summary = summary(model, use_cache = FALSE, priors = TRUE)
print(model_summary)
##  Family: hurdle_poisson (log) 
## Formula: children ~ s(paternalage) + birth_cohort + male + maternalage.factor + paternalage.mean + paternal_loss + maternal_loss + older_siblings + nr.siblings + last_born + (1 | idParents) 
##          hu ~ s(paternalage) + 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: 9447) 
## 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)
## sds ~ student_t(3, 0, 10)
## b_hu ~ normal(0,5)
## sd_hu ~ student_t(3, 0, 10)
## sds_hu ~ student_t(3, 0, 10)
## 
## Spline Effects: 
##                        Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## sds(spaternalage_1)        0.26      0.25     0.01     0.93       1276
## sds(hu_spaternalage_1)     0.65      0.63     0.02     2.32       1201
##                        Rhat
## sds(spaternalage_1)    1.01
## sds(hu_spaternalage_1) 1.01
## 
## Group-Level Effects: 
## ~idParents (Number of levels: 2186) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.22      0.01     0.20     0.25       1057    1
## sd(hu_Intercept)     0.47      0.05     0.38     0.56        796    1
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     1.86      0.20     1.47     2.25       1010
## birth_cohort1760M1765         0.00      0.06    -0.13     0.11       1408
## birth_cohort1765M1770        -0.12      0.06    -0.23    -0.01        976
## birth_cohort1770M1775        -0.11      0.06    -0.23     0.00        927
## birth_cohort1775M1780        -0.03      0.06    -0.13     0.08        814
## birth_cohort1780M1785        -0.11      0.06    -0.22     0.00       1027
## birth_cohort1785M1790        -0.10      0.05    -0.20     0.01        898
## birth_cohort1790M1795        -0.08      0.05    -0.18     0.03        707
## birth_cohort1795M1800        -0.11      0.05    -0.20    -0.01        677
## birth_cohort1800M1805        -0.11      0.05    -0.21    -0.02        711
## birth_cohort1805M1810        -0.14      0.05    -0.24    -0.04        767
## birth_cohort1810M1815        -0.10      0.05    -0.19    -0.01        643
## birth_cohort1815M1820        -0.14      0.04    -0.23    -0.06        608
## birth_cohort1820M1825        -0.19      0.05    -0.28    -0.10        604
## birth_cohort1825M1830        -0.21      0.05    -0.30    -0.12        654
## birth_cohort1830M1835        -0.18      0.05    -0.27    -0.09        712
## male1                         0.08      0.02     0.05     0.11       3000
## maternalage.factor1420       -0.05      0.09    -0.24     0.12       3000
## maternalage.factor3550        0.00      0.03    -0.06     0.05       3000
## paternalage.mean             -0.06      0.05    -0.16     0.04       1124
## paternal_loss01              -0.15      0.08    -0.30     0.00       3000
## paternal_loss15              -0.04      0.05    -0.14     0.06       1470
## paternal_loss510             -0.07      0.04    -0.15     0.01       1299
## paternal_loss1015             0.01      0.04    -0.07     0.08       1362
## paternal_loss1520            -0.10      0.04    -0.17    -0.02       1407
## paternal_loss2025            -0.12      0.04    -0.19    -0.05       1527
## paternal_loss2530            -0.01      0.03    -0.08     0.06       1207
## paternal_loss3035            -0.03      0.03    -0.09     0.04       1176
## paternal_loss3540            -0.01      0.03    -0.07     0.05       1301
## paternal_loss4045            -0.01      0.04    -0.08     0.06       3000
## maternal_loss01               0.10      0.08    -0.06     0.25       3000
## maternal_loss15              -0.02      0.05    -0.11     0.07       3000
## maternal_loss510              0.07      0.04    -0.01     0.15       3000
## maternal_loss1015             0.03      0.04    -0.05     0.11       3000
## maternal_loss1520             0.00      0.04    -0.08     0.08       3000
## maternal_loss2025             0.00      0.04    -0.07     0.08       3000
## maternal_loss2530            -0.02      0.03    -0.09     0.05       3000
## maternal_loss3035            -0.05      0.03    -0.11     0.01       2039
## maternal_loss3540            -0.03      0.03    -0.09     0.02       3000
## maternal_loss4045            -0.03      0.03    -0.09     0.03       3000
## older_siblings1               0.03      0.03    -0.02     0.08       1824
## older_siblings2              -0.04      0.04    -0.11     0.03       1073
## older_siblings3              -0.06      0.05    -0.16     0.03        964
## older_siblings4              -0.08      0.06    -0.20     0.03       1015
## older_siblings5P             -0.09      0.08    -0.23     0.07        961
## nr.siblings                   0.01      0.01    -0.01     0.02       1151
## last_born1                   -0.04      0.02    -0.09     0.00       3000
## spaternalage_1                0.02      0.07    -0.12     0.13       1184
## hu_Intercept                  0.55      0.55    -0.55     1.61        719
## hu_birth_cohort1760M1765     -0.06      0.17    -0.40     0.28       3000
## hu_birth_cohort1765M1770     -0.31      0.15    -0.60    -0.02       1054
## hu_birth_cohort1770M1775     -0.07      0.15    -0.36     0.23       1005
## hu_birth_cohort1775M1780     -0.20      0.15    -0.49     0.08        998
## hu_birth_cohort1780M1785     -0.28      0.15    -0.56     0.02        943
## hu_birth_cohort1785M1790     -0.42      0.15    -0.72    -0.14        926
## hu_birth_cohort1790M1795     -0.31      0.14    -0.60    -0.04        914
## hu_birth_cohort1795M1800     -0.46      0.13    -0.71    -0.22        704
## hu_birth_cohort1800M1805     -0.54      0.13    -0.80    -0.30        812
## hu_birth_cohort1805M1810     -0.27      0.13    -0.51    -0.02        780
## hu_birth_cohort1810M1815     -0.44      0.13    -0.69    -0.19        774
## hu_birth_cohort1815M1820     -0.71      0.12    -0.94    -0.48        683
## hu_birth_cohort1820M1825     -0.53      0.12    -0.77    -0.30        721
## hu_birth_cohort1825M1830     -0.55      0.12    -0.79    -0.32        695
## hu_birth_cohort1830M1835     -0.55      0.13    -0.80    -0.31        706
## hu_male1                      0.27      0.05     0.19     0.36       3000
## hu_maternalage.factor1420     0.23      0.23    -0.22     0.68       3000
## hu_maternalage.factor3550     0.13      0.07    -0.01     0.27       3000
## hu_paternalage.mean          -0.17      0.14    -0.44     0.11        590
## hu_paternal_loss01            0.57      0.18     0.22     0.93       3000
## hu_paternal_loss15            0.53      0.13     0.27     0.78       3000
## hu_paternal_loss510           0.19      0.11    -0.03     0.40       1563
## hu_paternal_loss1015          0.15      0.11    -0.05     0.37       1364
## hu_paternal_loss1520          0.10      0.10    -0.11     0.30       1424
## hu_paternal_loss2025          0.15      0.10    -0.04     0.34       1266
## hu_paternal_loss2530          0.06      0.09    -0.12     0.24       1286
## hu_paternal_loss3035         -0.02      0.09    -0.20     0.15       1393
## hu_paternal_loss3540         -0.01      0.09    -0.19     0.16       1492
## hu_paternal_loss4045          0.14      0.10    -0.06     0.33       1614
## hu_maternal_loss01            1.57      0.19     1.22     1.95       3000
## hu_maternal_loss15            0.58      0.12     0.35     0.82       3000
## hu_maternal_loss510           0.48      0.10     0.27     0.68       3000
## hu_maternal_loss1015          0.46      0.11     0.26     0.67       3000
## hu_maternal_loss1520          0.30      0.11     0.10     0.51       3000
## hu_maternal_loss2025          0.26      0.10     0.05     0.46       3000
## hu_maternal_loss2530          0.19      0.09     0.00     0.36       3000
## hu_maternal_loss3035          0.21      0.09     0.05     0.39       3000
## hu_maternal_loss3540          0.06      0.08    -0.09     0.22       3000
## hu_maternal_loss4045          0.27      0.08     0.11     0.43       3000
## hu_older_siblings1            0.00      0.08    -0.15     0.15       1145
## hu_older_siblings2           -0.13      0.10    -0.33     0.06        724
## hu_older_siblings3           -0.16      0.13    -0.40     0.08        559
## hu_older_siblings4           -0.20      0.16    -0.51     0.10        506
## hu_older_siblings5P          -0.54      0.21    -0.95    -0.15        514
## hu_nr.siblings                0.10      0.02     0.07     0.14        594
## hu_last_born1                 0.08      0.06    -0.03     0.20       3000
## hu_spaternalage_1             0.18      0.16    -0.14     0.50        960
##                           Rhat
## Intercept                 1.01
## birth_cohort1760M1765     1.00
## birth_cohort1765M1770     1.01
## birth_cohort1770M1775     1.00
## birth_cohort1775M1780     1.01
## birth_cohort1780M1785     1.01
## birth_cohort1785M1790     1.01
## birth_cohort1790M1795     1.01
## birth_cohort1795M1800     1.01
## birth_cohort1800M1805     1.01
## birth_cohort1805M1810     1.01
## birth_cohort1810M1815     1.01
## birth_cohort1815M1820     1.01
## birth_cohort1820M1825     1.01
## birth_cohort1825M1830     1.01
## birth_cohort1830M1835     1.01
## male1                     1.00
## maternalage.factor1420    1.00
## maternalage.factor3550    1.00
## paternalage.mean          1.01
## 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.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
## spaternalage_1            1.01
## hu_Intercept              1.01
## 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_male1                  1.00
## hu_maternalage.factor1420 1.00
## hu_maternalage.factor3550 1.00
## hu_paternalage.mean       1.01
## 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.01
## 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.01
## hu_older_siblings2        1.01
## hu_older_siblings3        1.01
## hu_older_siblings4        1.01
## hu_older_siblings5P       1.01
## hu_nr.siblings            1.01
## hu_last_born1             1.00
## hu_spaternalage_1         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.864 1.474 2.254 6.453 4.369 9.53
birth_cohort1760M1765 -0.004345 -0.1269 0.1146 0.9957 0.8808 1.121
birth_cohort1765M1770 -0.119 -0.2305 -0.006398 0.8878 0.7942 0.9936
birth_cohort1770M1775 -0.1147 -0.2286 -0.002748 0.8917 0.7957 0.9973
birth_cohort1775M1780 -0.02571 -0.1316 0.08257 0.9746 0.8767 1.086
birth_cohort1780M1785 -0.1112 -0.2206 0.003384 0.8948 0.802 1.003
birth_cohort1785M1790 -0.09507 -0.1977 0.007042 0.9093 0.8206 1.007
birth_cohort1790M1795 -0.07522 -0.1769 0.02625 0.9275 0.8379 1.027
birth_cohort1795M1800 -0.1053 -0.2017 -0.01256 0.9 0.8173 0.9875
birth_cohort1800M1805 -0.1129 -0.2102 -0.01884 0.8932 0.8104 0.9813
birth_cohort1805M1810 -0.1365 -0.2368 -0.04264 0.8724 0.7892 0.9583
birth_cohort1810M1815 -0.09701 -0.1875 -0.008382 0.9075 0.829 0.9917
birth_cohort1815M1820 -0.1423 -0.2304 -0.05687 0.8674 0.7942 0.9447
birth_cohort1820M1825 -0.1858 -0.2786 -0.09845 0.8304 0.7568 0.9062
birth_cohort1825M1830 -0.2104 -0.3021 -0.1236 0.8103 0.7393 0.8837
birth_cohort1830M1835 -0.181 -0.2742 -0.09288 0.8344 0.7602 0.9113
male1 0.07799 0.04642 0.11 1.081 1.048 1.116
maternalage.factor1420 -0.05262 -0.239 0.1247 0.9487 0.7874 1.133
maternalage.factor3550 -0.003667 -0.0583 0.05149 0.9963 0.9434 1.053
paternalage.mean -0.06315 -0.1645 0.04132 0.9388 0.8483 1.042
paternal_loss01 -0.1533 -0.3017 -0.004839 0.8578 0.7396 0.9952
paternal_loss15 -0.03808 -0.1363 0.05735 0.9626 0.8725 1.059
paternal_loss510 -0.06899 -0.1506 0.01381 0.9333 0.8602 1.014
paternal_loss1015 0.005896 -0.07019 0.0815 1.006 0.9322 1.085
paternal_loss1520 -0.09527 -0.171 -0.0198 0.9091 0.8428 0.9804
paternal_loss2025 -0.1208 -0.1942 -0.04837 0.8862 0.8235 0.9528
paternal_loss2530 -0.01022 -0.07725 0.05828 0.9898 0.9257 1.06
paternal_loss3035 -0.02772 -0.09393 0.03939 0.9727 0.9104 1.04
paternal_loss3540 -0.009833 -0.07251 0.0542 0.9902 0.9301 1.056
paternal_loss4045 -0.009479 -0.08052 0.05797 0.9906 0.9226 1.06
maternal_loss01 0.09806 -0.05568 0.2527 1.103 0.9458 1.288
maternal_loss15 -0.02034 -0.111 0.06989 0.9799 0.895 1.072
maternal_loss510 0.07023 -0.007019 0.1515 1.073 0.993 1.164
maternal_loss1015 0.02605 -0.05453 0.1062 1.026 0.9469 1.112
maternal_loss1520 0.002203 -0.07896 0.07976 1.002 0.9241 1.083
maternal_loss2025 0.004337 -0.06939 0.07571 1.004 0.933 1.079
maternal_loss2530 -0.02285 -0.09051 0.04613 0.9774 0.9135 1.047
maternal_loss3035 -0.05119 -0.1141 0.008363 0.9501 0.8922 1.008
maternal_loss3540 -0.03421 -0.09042 0.02388 0.9664 0.9135 1.024
maternal_loss4045 -0.0299 -0.09102 0.03053 0.9705 0.913 1.031
older_siblings1 0.03038 -0.02041 0.08089 1.031 0.9798 1.084
older_siblings2 -0.03995 -0.112 0.02929 0.9608 0.8941 1.03
older_siblings3 -0.06378 -0.1562 0.02822 0.9382 0.8553 1.029
older_siblings4 -0.08236 -0.2005 0.03269 0.9209 0.8184 1.033
older_siblings5P -0.08526 -0.2297 0.06703 0.9183 0.7948 1.069
nr.siblings 0.008951 -0.005113 0.02289 1.009 0.9949 1.023
last_born1 -0.04312 -0.08848 0.002153 0.9578 0.9153 1.002
spaternalage_1 0.01957 -0.1234 0.1326 1.02 0.8839 1.142
hu_Intercept 0.5519 -0.5467 1.608 1.737 0.5789 4.994
hu_birth_cohort1760M1765 -0.05578 -0.3978 0.2849 0.9458 0.6718 1.33
hu_birth_cohort1765M1770 -0.3102 -0.6038 -0.02455 0.7333 0.5467 0.9757
hu_birth_cohort1770M1775 -0.06613 -0.3594 0.2264 0.936 0.6981 1.254
hu_birth_cohort1775M1780 -0.2018 -0.4918 0.07758 0.8172 0.6115 1.081
hu_birth_cohort1780M1785 -0.2787 -0.5636 0.02096 0.7568 0.5691 1.021
hu_birth_cohort1785M1790 -0.4219 -0.7153 -0.1428 0.6558 0.489 0.8669
hu_birth_cohort1790M1795 -0.3138 -0.5971 -0.04158 0.7306 0.5504 0.9593
hu_birth_cohort1795M1800 -0.4608 -0.7146 -0.2159 0.6308 0.4894 0.8058
hu_birth_cohort1800M1805 -0.5385 -0.7995 -0.2983 0.5836 0.4495 0.7421
hu_birth_cohort1805M1810 -0.2714 -0.5149 -0.02001 0.7623 0.5976 0.9802
hu_birth_cohort1810M1815 -0.4426 -0.6912 -0.1942 0.6424 0.501 0.8235
hu_birth_cohort1815M1820 -0.7076 -0.9403 -0.4783 0.4928 0.3905 0.6198
hu_birth_cohort1820M1825 -0.5295 -0.7671 -0.2977 0.5889 0.4643 0.7425
hu_birth_cohort1825M1830 -0.5479 -0.7864 -0.3216 0.5782 0.4555 0.725
hu_birth_cohort1830M1835 -0.5532 -0.7996 -0.309 0.5751 0.4495 0.7342
hu_male1 0.2749 0.1851 0.3632 1.316 1.203 1.438
hu_maternalage.factor1420 0.2274 -0.2204 0.6796 1.255 0.8022 1.973
hu_maternalage.factor3550 0.1279 -0.01468 0.2699 1.136 0.9854 1.31
hu_paternalage.mean -0.1711 -0.4447 0.1133 0.8427 0.641 1.12
hu_paternal_loss01 0.566 0.2166 0.9326 1.761 1.242 2.541
hu_paternal_loss15 0.5265 0.2706 0.7818 1.693 1.311 2.185
hu_paternal_loss510 0.1889 -0.02615 0.4037 1.208 0.9742 1.497
hu_paternal_loss1015 0.1529 -0.04799 0.366 1.165 0.9531 1.442
hu_paternal_loss1520 0.09918 -0.105 0.3026 1.104 0.9003 1.353
hu_paternal_loss2025 0.1514 -0.04 0.3422 1.164 0.9608 1.408
hu_paternal_loss2530 0.06028 -0.1231 0.2395 1.062 0.8842 1.271
hu_paternal_loss3035 -0.02109 -0.2028 0.155 0.9791 0.8164 1.168
hu_paternal_loss3540 -0.0117 -0.1874 0.1644 0.9884 0.8291 1.179
hu_paternal_loss4045 0.145 -0.05615 0.3348 1.156 0.9454 1.398
hu_maternal_loss01 1.574 1.218 1.951 4.827 3.381 7.032
hu_maternal_loss15 0.582 0.3494 0.8196 1.79 1.418 2.27
hu_maternal_loss510 0.4792 0.2731 0.685 1.615 1.314 1.984
hu_maternal_loss1015 0.4649 0.258 0.6734 1.592 1.294 1.961
hu_maternal_loss1520 0.3038 0.09767 0.5054 1.355 1.103 1.658
hu_maternal_loss2025 0.2568 0.05105 0.4564 1.293 1.052 1.578
hu_maternal_loss2530 0.1861 9.48e-05 0.3597 1.205 1 1.433
hu_maternal_loss3035 0.2123 0.04628 0.3892 1.236 1.047 1.476
hu_maternal_loss3540 0.06229 -0.09063 0.2223 1.064 0.9134 1.249
hu_maternal_loss4045 0.2715 0.1105 0.434 1.312 1.117 1.543
hu_older_siblings1 0.003644 -0.1536 0.1522 1.004 0.8577 1.164
hu_older_siblings2 -0.1308 -0.3304 0.05867 0.8774 0.7186 1.06
hu_older_siblings3 -0.1623 -0.4036 0.08184 0.8502 0.6679 1.085
hu_older_siblings4 -0.1959 -0.5078 0.1007 0.8221 0.6018 1.106
hu_older_siblings5P -0.539 -0.9525 -0.1505 0.5833 0.3858 0.8603
hu_nr.siblings 0.1016 0.06559 0.1385 1.107 1.068 1.149
hu_last_born1 0.08149 -0.03489 0.1982 1.085 0.9657 1.219
hu_spaternalage_1 0.1812 -0.1436 0.5045 1.199 0.8663 1.656

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 2.26 [1.9;2.64] [2.01;2.51]
estimate father 35y 2.1 [1.66;2.6] [1.8;2.42]
percentage change -6.74 [-25.17;14.85] [-19.34;6.8]
OR/IRR 1.03 [0.88;1.14] [0.94;1.1]
OR hurdle 1.2 [0.87;1.66] [0.99;1.45]

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)

plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50plot of chunk unnamed-chunk-50

Coefficient plot

Coefficient estimates (95% and 80% credibility).

mcmc_intervals(as.matrix(model$fit), regex_pars = "b_[^I]")
plot of chunk unnamed-chunk-51

plot of chunk unnamed-chunk-51

mcmc_areas(as.matrix(model$fit), regex_pars = "b")
plot of chunk unnamed-chunk-51

plot of chunk unnamed-chunk-51

Diagnostics

These plots were made to diagnose misfit and nonconvergence.

Posterior predictive checks

brms::pp_check(model, re_formula = NA, type = "dens_overlay")
plot of chunk unnamed-chunk-52

plot of chunk unnamed-chunk-52

brms::pp_check(model, re_formula = NA, type = "hist")
plot of chunk unnamed-chunk-52

plot of chunk unnamed-chunk-52

Rhat

Did the 6 chains converge?

stanplot(model, pars = "^b_[^I]", type = 'rhat')
plot of chunk unnamed-chunk-53

plot of chunk unnamed-chunk-53

Effective sample size by average sample size

stanplot(model, pars = "^b", type = 'ess')
plot of chunk unnamed-chunk-54

plot of chunk unnamed-chunk-54

Monte Carlo SE

stanplot(model, pars = "^b", type = 'mcse')
plot of chunk unnamed-chunk-55

plot of chunk unnamed-chunk-55

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')
plot of chunk unnamed-chunk-57

plot of chunk unnamed-chunk-57

File name

coefs/krmh/m4_children_nonlinear.rds

Cluster script

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

Cluster script

Model comparison

We compare the four models using an approximative leave-one-out cross-validation information criterion as implemented in brms and loo and the Watanabe-Akaike information criterion.

##            LOOIC     SE
## m1      30344.04 288.27
## m2      30239.93 285.01
## m3      30236.90 285.09
## m4      30242.81 285.07
## m1 - m2   104.11  40.85
## m1 - m3   107.14  40.81
## m1 - m4   101.22  40.90
## m2 - m3     3.03   5.65
## m2 - m4    -2.88   6.18
## m3 - m4    -5.91   3.86

plot of chunk unnamed-chunk-6plot of chunk unnamed-chunk-6plot of chunk unnamed-chunk-6plot of chunk unnamed-chunk-6

##             WAIC     SE
## m1      30344.04 288.27
## m2      30200.87 284.18
## m3      30198.15 284.24
## m4      30203.72 284.23
## m1 - m2   143.17  41.13
## m1 - m3   145.88  41.11
## m1 - m4   140.32  41.21
## m2 - m3     2.72   5.32
## m2 - m4    -2.85   5.86
## m3 - m4    -5.57   3.47