Québec (Registre de la Population du Québec Ancien 1630-1750), main effects

Loading details

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

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 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: 68724) 
## 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                     2.14      0.02     2.10     2.17        874
## paternalage                  -0.02      0.00    -0.02    -0.01       3000
## birth_cohort1675M1680         0.01      0.01    -0.02     0.04        690
## birth_cohort1680M1685         0.03      0.01     0.01     0.06        679
## birth_cohort1685M1690         0.04      0.01     0.01     0.07        650
## birth_cohort1690M1695         0.03      0.01     0.01     0.06        595
## birth_cohort1695M1700         0.03      0.01     0.00     0.05        589
## birth_cohort1700M1705         0.01      0.01    -0.01     0.03        562
## birth_cohort1705M1710        -0.01      0.01    -0.03     0.02        557
## birth_cohort1710M1715        -0.01      0.01    -0.04     0.01        542
## birth_cohort1715M1720        -0.04      0.01    -0.07    -0.02        535
## birth_cohort1720M1725        -0.04      0.01    -0.06    -0.02        510
## birth_cohort1725M1730        -0.07      0.01    -0.09    -0.04        528
## birth_cohort1730M1735        -0.05      0.01    -0.07    -0.02        531
## birth_cohort1735M1740        -0.06      0.01    -0.08    -0.03        513
## male1                         0.11      0.00     0.10     0.12       3000
## maternalage.factor1420       -0.01      0.01    -0.02     0.01       3000
## maternalage.factor3550        0.01      0.01     0.00     0.02       3000
## paternal_loss01              -0.01      0.02    -0.04     0.03       2154
## paternal_loss15               0.00      0.01    -0.02     0.02       1736
## paternal_loss510              0.00      0.01    -0.02     0.02       1931
## paternal_loss1015            -0.01      0.01    -0.03     0.00       1663
## paternal_loss1520            -0.02      0.01    -0.04    -0.01       1913
## paternal_loss2025            -0.02      0.01    -0.04    -0.01       1685
## paternal_loss2530            -0.01      0.01    -0.03     0.00       1732
## paternal_loss3035            -0.02      0.01    -0.04    -0.01       1608
## paternal_loss3540            -0.02      0.01    -0.04    -0.01       1696
## paternal_loss4045             0.00      0.01    -0.02     0.01       1926
## paternal_lossunclear         -0.04      0.01    -0.05    -0.03       1557
## maternal_loss01              -0.03      0.02    -0.07     0.01       2724
## maternal_loss15              -0.02      0.01    -0.04     0.01       3000
## maternal_loss510              0.01      0.01    -0.01     0.02       3000
## maternal_loss1015            -0.01      0.01    -0.03     0.01       3000
## maternal_loss1520             0.00      0.01    -0.02     0.02       3000
## maternal_loss2025            -0.03      0.01    -0.04    -0.01       3000
## maternal_loss2530            -0.02      0.01    -0.04    -0.01       3000
## maternal_loss3035            -0.02      0.01    -0.03     0.00       3000
## maternal_loss3540            -0.01      0.01    -0.02     0.00       3000
## maternal_loss4045             0.00      0.01    -0.02     0.01       3000
## maternal_lossunclear         -0.02      0.01    -0.04    -0.01       3000
## older_siblings1              -0.02      0.01    -0.03     0.00       3000
## older_siblings2              -0.01      0.01    -0.03     0.00       2020
## older_siblings3              -0.02      0.01    -0.04    -0.01       2067
## older_siblings4               0.00      0.01    -0.02     0.01       1965
## older_siblings5P             -0.01      0.01    -0.03     0.00       1731
## nr.siblings                   0.01      0.00     0.01     0.01       2459
## last_born1                    0.01      0.01    -0.01     0.02       3000
## hu_Intercept                 -0.87      0.07    -1.00    -0.73        431
## hu_paternalage                0.00      0.01    -0.03     0.02       1759
## hu_birth_cohort1675M1680      0.06      0.06    -0.06     0.19        561
## hu_birth_cohort1680M1685      0.20      0.06     0.08     0.32        540
## hu_birth_cohort1685M1690      0.30      0.06     0.17     0.43        573
## hu_birth_cohort1690M1695      0.08      0.06    -0.04     0.19        481
## hu_birth_cohort1695M1700      0.10      0.06    -0.02     0.21        465
## hu_birth_cohort1700M1705      0.23      0.06     0.12     0.33        461
## hu_birth_cohort1705M1710      0.14      0.06     0.03     0.25        427
## hu_birth_cohort1710M1715      0.39      0.05     0.28     0.50        367
## hu_birth_cohort1715M1720      0.28      0.05     0.18     0.38        437
## hu_birth_cohort1720M1725      0.30      0.05     0.20     0.40        420
## hu_birth_cohort1725M1730      0.63      0.05     0.53     0.74        326
## hu_birth_cohort1730M1735      0.68      0.05     0.59     0.78        332
## hu_birth_cohort1735M1740      0.53      0.05     0.43     0.62        397
## hu_male1                      0.40      0.02     0.37     0.43       2748
## hu_maternalage.factor1420     0.00      0.03    -0.07     0.06       1348
## hu_maternalage.factor3550     0.07      0.02     0.02     0.11       1745
## hu_paternal_loss01            0.59      0.07     0.47     0.72       1651
## hu_paternal_loss15            0.33      0.05     0.24     0.43       1211
## hu_paternal_loss510           0.32      0.04     0.24     0.40       1147
## hu_paternal_loss1015          0.19      0.04     0.12     0.27       1164
## hu_paternal_loss1520          0.28      0.04     0.21     0.35       1080
## hu_paternal_loss2025          0.18      0.03     0.12     0.25       1120
## hu_paternal_loss2530          0.18      0.03     0.12     0.25       1137
## hu_paternal_loss3035          0.14      0.03     0.08     0.20       1128
## hu_paternal_loss3540          0.10      0.03     0.04     0.16       1143
## hu_paternal_loss4045          0.06      0.04    -0.01     0.13       1273
## hu_paternal_lossunclear       0.35      0.03     0.29     0.41        919
## hu_maternal_loss01            1.04      0.07     0.91     1.18       2375
## hu_maternal_loss15            0.42      0.04     0.34     0.50       1830
## hu_maternal_loss510           0.29      0.04     0.22     0.36       2149
## hu_maternal_loss1015          0.26      0.04     0.19     0.34       1952
## hu_maternal_loss1520          0.20      0.04     0.12     0.27       1960
## hu_maternal_loss2025          0.16      0.03     0.10     0.23       1892
## hu_maternal_loss2530          0.07      0.03     0.00     0.13       1760
## hu_maternal_loss3035          0.09      0.03     0.03     0.14       1797
## hu_maternal_loss3540          0.08      0.03     0.02     0.14       2160
## hu_maternal_loss4045          0.00      0.03    -0.05     0.06       1979
## hu_maternal_lossunclear       0.19      0.03     0.14     0.25       1672
## hu_older_siblings1           -0.05      0.03    -0.10     0.01       1246
## hu_older_siblings2           -0.08      0.03    -0.13    -0.01       1212
## hu_older_siblings3           -0.11      0.03    -0.18    -0.05       1200
## hu_older_siblings4           -0.12      0.03    -0.18    -0.05       1196
## hu_older_siblings5P          -0.15      0.03    -0.21    -0.09       1014
## hu_nr.siblings                0.02      0.00     0.01     0.02       2021
## hu_last_born1                 0.02      0.03    -0.03     0.08       2115
##                           Rhat
## Intercept                 1.00
## paternalage               1.00
## birth_cohort1675M1680     1.00
## birth_cohort1680M1685     1.00
## birth_cohort1685M1690     1.00
## birth_cohort1690M1695     1.01
## birth_cohort1695M1700     1.00
## birth_cohort1700M1705     1.00
## birth_cohort1705M1710     1.01
## birth_cohort1710M1715     1.01
## birth_cohort1715M1720     1.00
## birth_cohort1720M1725     1.00
## birth_cohort1725M1730     1.01
## birth_cohort1730M1735     1.00
## birth_cohort1735M1740     1.00
## 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
## 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.01
## hu_paternalage            1.00
## hu_birth_cohort1675M1680  1.01
## hu_birth_cohort1680M1685  1.02
## hu_birth_cohort1685M1690  1.01
## hu_birth_cohort1690M1695  1.02
## hu_birth_cohort1695M1700  1.01
## hu_birth_cohort1700M1705  1.01
## hu_birth_cohort1705M1710  1.02
## hu_birth_cohort1710M1715  1.02
## hu_birth_cohort1715M1720  1.02
## hu_birth_cohort1720M1725  1.02
## hu_birth_cohort1725M1730  1.02
## hu_birth_cohort1730M1735  1.02
## hu_birth_cohort1735M1740  1.02
## 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.01
## 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.01
## 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 2.136 2.104 2.169 8.468 8.199 8.748
paternalage -0.01602 -0.0218 -0.009887 0.9841 0.9784 0.9902
birth_cohort1675M1680 0.01318 -0.01549 0.04068 1.013 0.9846 1.042
birth_cohort1680M1685 0.0342 0.005945 0.06149 1.035 1.006 1.063
birth_cohort1685M1690 0.04063 0.01171 0.06801 1.041 1.012 1.07
birth_cohort1690M1695 0.03367 0.006744 0.05949 1.034 1.007 1.061
birth_cohort1695M1700 0.02527 -0.001318 0.05049 1.026 0.9987 1.052
birth_cohort1700M1705 0.01048 -0.01426 0.03486 1.011 0.9858 1.035
birth_cohort1705M1710 -0.006445 -0.03161 0.01792 0.9936 0.9689 1.018
birth_cohort1710M1715 -0.01011 -0.03588 0.01408 0.9899 0.9648 1.014
birth_cohort1715M1720 -0.04244 -0.06734 -0.01785 0.9584 0.9349 0.9823
birth_cohort1720M1725 -0.03976 -0.06435 -0.01646 0.961 0.9377 0.9837
birth_cohort1725M1730 -0.06696 -0.09072 -0.04419 0.9352 0.9133 0.9568
birth_cohort1730M1735 -0.0458 -0.06978 -0.02251 0.9552 0.9326 0.9777
birth_cohort1735M1740 -0.0556 -0.0788 -0.03249 0.9459 0.9242 0.968
male1 0.111 0.1034 0.1185 1.117 1.109 1.126
maternalage.factor1420 -0.005028 -0.02107 0.01094 0.995 0.9792 1.011
maternalage.factor3550 0.01281 0.001402 0.0245 1.013 1.001 1.025
paternal_loss01 -0.005813 -0.0402 0.02757 0.9942 0.9606 1.028
paternal_loss15 0.0001954 -0.02301 0.02305 1 0.9772 1.023
paternal_loss510 -0.002646 -0.02277 0.01619 0.9974 0.9775 1.016
paternal_loss1015 -0.0134 -0.03067 0.004457 0.9867 0.9698 1.004
paternal_loss1520 -0.02395 -0.04154 -0.007114 0.9763 0.9593 0.9929
paternal_loss2025 -0.02176 -0.03816 -0.006013 0.9785 0.9626 0.994
paternal_loss2530 -0.01216 -0.02785 0.002947 0.9879 0.9725 1.003
paternal_loss3035 -0.02389 -0.03856 -0.008317 0.9764 0.9622 0.9917
paternal_loss3540 -0.02184 -0.03701 -0.007071 0.9784 0.9637 0.993
paternal_loss4045 -0.00269 -0.01899 0.01417 0.9973 0.9812 1.014
paternal_lossunclear -0.03986 -0.05438 -0.02516 0.9609 0.9471 0.9751
maternal_loss01 -0.03097 -0.06809 0.006788 0.9695 0.9342 1.007
maternal_loss15 -0.01707 -0.03896 0.005426 0.9831 0.9618 1.005
maternal_loss510 0.005709 -0.01282 0.02401 1.006 0.9873 1.024
maternal_loss1015 -0.01013 -0.02877 0.007793 0.9899 0.9716 1.008
maternal_loss1520 -0.001767 -0.01926 0.01623 0.9982 0.9809 1.016
maternal_loss2025 -0.02812 -0.04474 -0.0114 0.9723 0.9563 0.9887
maternal_loss2530 -0.02444 -0.04005 -0.008966 0.9759 0.9607 0.9911
maternal_loss3035 -0.0176 -0.03269 -0.002958 0.9826 0.9678 0.997
maternal_loss3540 -0.01086 -0.0239 0.002905 0.9892 0.9764 1.003
maternal_loss4045 -0.001256 -0.01585 0.01342 0.9987 0.9843 1.014
maternal_lossunclear -0.02446 -0.03819 -0.0107 0.9758 0.9625 0.9894
older_siblings1 -0.01737 -0.03068 -0.003835 0.9828 0.9698 0.9962
older_siblings2 -0.01456 -0.02962 -0.0004604 0.9855 0.9708 0.9995
older_siblings3 -0.02064 -0.03645 -0.006256 0.9796 0.9642 0.9938
older_siblings4 -0.003626 -0.02009 0.01277 0.9964 0.9801 1.013
older_siblings5P -0.01146 -0.02652 0.003939 0.9886 0.9738 1.004
nr.siblings 0.006816 0.00545 0.008139 1.007 1.005 1.008
last_born1 0.007019 -0.00673 0.02037 1.007 0.9933 1.021
hu_Intercept -0.8687 -1.002 -0.7302 0.4195 0.3673 0.4818
hu_paternalage -0.000955 -0.02638 0.02338 0.999 0.974 1.024
hu_birth_cohort1675M1680 0.06486 -0.06168 0.1908 1.067 0.9402 1.21
hu_birth_cohort1680M1685 0.202 0.08122 0.3228 1.224 1.085 1.381
hu_birth_cohort1685M1690 0.2993 0.1732 0.426 1.349 1.189 1.531
hu_birth_cohort1690M1695 0.0796 -0.04216 0.1921 1.083 0.9587 1.212
hu_birth_cohort1695M1700 0.09686 -0.01548 0.2076 1.102 0.9846 1.231
hu_birth_cohort1700M1705 0.2279 0.1214 0.3346 1.256 1.129 1.397
hu_birth_cohort1705M1710 0.1423 0.0334 0.2484 1.153 1.034 1.282
hu_birth_cohort1710M1715 0.3909 0.2847 0.4967 1.478 1.329 1.643
hu_birth_cohort1715M1720 0.2809 0.1764 0.3839 1.324 1.193 1.468
hu_birth_cohort1720M1725 0.3018 0.2008 0.4027 1.352 1.222 1.496
hu_birth_cohort1725M1730 0.6345 0.5328 0.7375 1.886 1.704 2.091
hu_birth_cohort1730M1735 0.6828 0.5865 0.7808 1.979 1.798 2.183
hu_birth_cohort1735M1740 0.5278 0.4303 0.6234 1.695 1.538 1.865
hu_male1 0.4016 0.372 0.431 1.494 1.451 1.539
hu_maternalage.factor1420 -0.001745 -0.06762 0.06226 0.9983 0.9346 1.064
hu_maternalage.factor3550 0.06785 0.02261 0.1118 1.07 1.023 1.118
hu_paternal_loss01 0.5934 0.4657 0.7204 1.81 1.593 2.055
hu_paternal_loss15 0.3338 0.2402 0.4267 1.396 1.271 1.532
hu_paternal_loss510 0.318 0.2423 0.3983 1.374 1.274 1.489
hu_paternal_loss1015 0.1911 0.1177 0.2674 1.211 1.125 1.307
hu_paternal_loss1520 0.2755 0.2094 0.3472 1.317 1.233 1.415
hu_paternal_loss2025 0.1818 0.1171 0.247 1.199 1.124 1.28
hu_paternal_loss2530 0.1833 0.1187 0.2465 1.201 1.126 1.28
hu_paternal_loss3035 0.1386 0.07774 0.2021 1.149 1.081 1.224
hu_paternal_loss3540 0.1029 0.04187 0.1633 1.108 1.043 1.177
hu_paternal_loss4045 0.06294 -0.006212 0.1345 1.065 0.9938 1.144
hu_paternal_lossunclear 0.351 0.2903 0.4146 1.42 1.337 1.514
hu_maternal_loss01 1.045 0.9145 1.176 2.842 2.496 3.242
hu_maternal_loss15 0.4194 0.3421 0.4993 1.521 1.408 1.648
hu_maternal_loss510 0.2922 0.2211 0.3648 1.339 1.247 1.44
hu_maternal_loss1015 0.2647 0.1927 0.3386 1.303 1.213 1.403
hu_maternal_loss1520 0.1969 0.1243 0.2659 1.218 1.132 1.305
hu_maternal_loss2025 0.1637 0.09848 0.2276 1.178 1.103 1.256
hu_maternal_loss2530 0.06591 0.001602 0.1302 1.068 1.002 1.139
hu_maternal_loss3035 0.08527 0.02912 0.1434 1.089 1.03 1.154
hu_maternal_loss3540 0.08148 0.02329 0.1361 1.085 1.024 1.146
hu_maternal_loss4045 0.004028 -0.05466 0.06228 1.004 0.9468 1.064
hu_maternal_lossunclear 0.1946 0.1383 0.2488 1.215 1.148 1.282
hu_older_siblings1 -0.04623 -0.1026 0.009395 0.9548 0.9025 1.009
hu_older_siblings2 -0.07525 -0.1338 -0.0145 0.9275 0.8747 0.9856
hu_older_siblings3 -0.1126 -0.1756 -0.05157 0.8935 0.839 0.9497
hu_older_siblings4 -0.1165 -0.1812 -0.04702 0.89 0.8342 0.9541
hu_older_siblings5P -0.1476 -0.2102 -0.08527 0.8628 0.8104 0.9183
hu_nr.siblings 0.01671 0.01129 0.02186 1.017 1.011 1.022
hu_last_born1 0.02434 -0.02967 0.08114 1.025 0.9708 1.085

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 5.82 [5.57;6.06] [5.65;5.98]
estimate father 35y 5.73 [5.48;5.97] [5.56;5.89]
percentage change -1.57 [-2.51;-0.59] [-2.17;-0.9]
OR/IRR 0.98 [0.98;0.99] [0.98;0.99]
OR hurdle 1 [0.97;1.02] [0.98;1.01]

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/rpqa/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: 68724) 
## 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: 12205) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.27      0.00     0.27     0.28       1172    1
## sd(hu_Intercept)     0.63      0.01     0.60     0.66       1530    1
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     2.11      0.03     2.06     2.16       1126
## birth_cohort1675M1680         0.02      0.02    -0.01     0.05       1141
## birth_cohort1680M1685         0.05      0.02     0.02     0.08       1010
## birth_cohort1685M1690         0.05      0.02     0.02     0.08       1046
## birth_cohort1690M1695         0.05      0.02     0.02     0.08        700
## birth_cohort1695M1700         0.04      0.02     0.00     0.07        677
## birth_cohort1700M1705         0.02      0.02    -0.01     0.05        717
## birth_cohort1705M1710         0.00      0.02    -0.03     0.03        583
## birth_cohort1710M1715        -0.01      0.02    -0.04     0.02        667
## birth_cohort1715M1720        -0.04      0.02    -0.07     0.00        682
## birth_cohort1720M1725        -0.04      0.02    -0.07    -0.01        655
## birth_cohort1725M1730        -0.06      0.02    -0.10    -0.03        660
## birth_cohort1730M1735        -0.05      0.02    -0.08    -0.02        561
## birth_cohort1735M1740        -0.06      0.02    -0.09    -0.03        646
## male1                         0.11      0.00     0.10     0.12       3000
## maternalage.factor1420       -0.01      0.01    -0.03     0.01       3000
## maternalage.factor3550        0.01      0.01    -0.01     0.02       3000
## paternalage.mean             -0.02      0.01    -0.03    -0.01       1783
## paternal_loss01              -0.03      0.02    -0.07     0.01       1767
## paternal_loss15              -0.01      0.02    -0.04     0.02       1359
## paternal_loss510             -0.01      0.01    -0.03     0.02       1115
## paternal_loss1015            -0.01      0.01    -0.04     0.01       1116
## paternal_loss1520            -0.02      0.01    -0.04     0.00       1088
## paternal_loss2025            -0.02      0.01    -0.04     0.00        955
## paternal_loss2530            -0.01      0.01    -0.03     0.01       1085
## paternal_loss3035            -0.02      0.01    -0.04     0.00       1163
## paternal_loss3540            -0.02      0.01    -0.04     0.00       1374
## paternal_loss4045             0.00      0.01    -0.02     0.02       3000
## paternal_lossunclear         -0.05      0.01    -0.08    -0.03       1260
## maternal_loss01              -0.05      0.02    -0.10     0.00       3000
## maternal_loss15              -0.03      0.01    -0.05     0.00       1866
## maternal_loss510              0.01      0.01    -0.01     0.04       1666
## maternal_loss1015            -0.01      0.01    -0.03     0.02       2000
## maternal_loss1520             0.01      0.01    -0.02     0.03       2001
## maternal_loss2025            -0.02      0.01    -0.04     0.00       2038
## maternal_loss2530            -0.01      0.01    -0.03     0.01       1983
## maternal_loss3035            -0.01      0.01    -0.03     0.01       2140
## maternal_loss3540             0.00      0.01    -0.02     0.02       3000
## maternal_loss4045             0.00      0.01    -0.01     0.02       3000
## maternal_lossunclear         -0.02      0.01    -0.04     0.01       1415
## older_siblings1              -0.02      0.01    -0.04    -0.01       3000
## older_siblings2              -0.02      0.01    -0.04    -0.01       2357
## older_siblings3              -0.03      0.01    -0.05    -0.01       2221
## older_siblings4              -0.02      0.01    -0.03     0.00       2218
## older_siblings5P             -0.03      0.01    -0.04    -0.01       1580
## nr.siblings                   0.01      0.00     0.00     0.01       1876
## last_born1                    0.00      0.01    -0.01     0.02       3000
## hu_Intercept                 -0.85      0.09    -1.03    -0.68        805
## hu_birth_cohort1675M1680      0.08      0.07    -0.06     0.23        860
## hu_birth_cohort1680M1685      0.23      0.07     0.10     0.37        870
## hu_birth_cohort1685M1690      0.34      0.07     0.21     0.48        805
## hu_birth_cohort1690M1695      0.09      0.07    -0.04     0.23        766
## hu_birth_cohort1695M1700      0.11      0.07    -0.02     0.24        672
## hu_birth_cohort1700M1705      0.26      0.07     0.13     0.39        654
## hu_birth_cohort1705M1710      0.16      0.06     0.03     0.29        615
## hu_birth_cohort1710M1715      0.44      0.06     0.32     0.57        628
## hu_birth_cohort1715M1720      0.29      0.06     0.17     0.42        600
## hu_birth_cohort1720M1725      0.32      0.06     0.19     0.44        599
## hu_birth_cohort1725M1730      0.68      0.06     0.56     0.80        566
## hu_birth_cohort1730M1735      0.73      0.06     0.62     0.85        564
## hu_birth_cohort1735M1740      0.57      0.06     0.46     0.70        567
## hu_male1                      0.44      0.02     0.40     0.47       3000
## hu_maternalage.factor1420     0.04      0.04    -0.03     0.11       3000
## hu_maternalage.factor3550     0.08      0.02     0.04     0.13       3000
## hu_paternalage.mean          -0.02      0.02    -0.05     0.01       3000
## hu_paternal_loss01            0.61      0.07     0.48     0.76       3000
## hu_paternal_loss15            0.35      0.05     0.24     0.45       1779
## hu_paternal_loss510           0.32      0.05     0.23     0.42       1681
## hu_paternal_loss1015          0.20      0.04     0.11     0.28       1584
## hu_paternal_loss1520          0.30      0.04     0.22     0.39       1467
## hu_paternal_loss2025          0.19      0.04     0.11     0.26       1516
## hu_paternal_loss2530          0.19      0.04     0.11     0.27       1325
## hu_paternal_loss3035          0.15      0.04     0.08     0.22       1651
## hu_paternal_loss3540          0.11      0.04     0.03     0.18       1567
## hu_paternal_loss4045          0.07      0.04    -0.01     0.15       3000
## hu_paternal_lossunclear       0.39      0.04     0.31     0.46       1583
## hu_maternal_loss01            1.09      0.07     0.95     1.24       3000
## hu_maternal_loss15            0.42      0.05     0.32     0.51       3000
## hu_maternal_loss510           0.28      0.04     0.19     0.36       3000
## hu_maternal_loss1015          0.27      0.04     0.19     0.36       3000
## hu_maternal_loss1520          0.21      0.04     0.13     0.29       3000
## hu_maternal_loss2025          0.18      0.04     0.10     0.26       3000
## hu_maternal_loss2530          0.07      0.04    -0.01     0.14       3000
## hu_maternal_loss3035          0.10      0.04     0.03     0.17       3000
## hu_maternal_loss3540          0.09      0.03     0.02     0.15       3000
## hu_maternal_loss4045         -0.01      0.04    -0.07     0.06       3000
## hu_maternal_lossunclear       0.23      0.04     0.16     0.31       2095
## hu_older_siblings1           -0.04      0.03    -0.10     0.02       3000
## hu_older_siblings2           -0.07      0.03    -0.13     0.00       2531
## hu_older_siblings3           -0.11      0.03    -0.17    -0.04       2264
## hu_older_siblings4           -0.11      0.04    -0.18    -0.04       2335
## hu_older_siblings5P          -0.14      0.03    -0.20    -0.07       1561
## hu_nr.siblings                0.01      0.00     0.01     0.02       2142
## hu_last_born1                 0.01      0.03    -0.05     0.07       3000
##                           Rhat
## Intercept                 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.01
## birth_cohort1710M1715     1.01
## birth_cohort1715M1720     1.01
## birth_cohort1720M1725     1.01
## birth_cohort1725M1730     1.01
## birth_cohort1730M1735     1.01
## birth_cohort1735M1740     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.01
## paternal_loss2530         1.01
## 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_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 2.111 2.056 2.164 8.256 7.818 8.708
birth_cohort1675M1680 0.02087 -0.008699 0.05056 1.021 0.9913 1.052
birth_cohort1680M1685 0.04809 0.01807 0.07743 1.049 1.018 1.081
birth_cohort1685M1690 0.0515 0.01897 0.08446 1.053 1.019 1.088
birth_cohort1690M1695 0.04855 0.0162 0.08137 1.05 1.016 1.085
birth_cohort1695M1700 0.03642 0.004959 0.06915 1.037 1.005 1.072
birth_cohort1700M1705 0.02286 -0.008163 0.05464 1.023 0.9919 1.056
birth_cohort1705M1710 -0.0003071 -0.03108 0.03268 0.9997 0.9694 1.033
birth_cohort1710M1715 -0.01063 -0.04227 0.02242 0.9894 0.9586 1.023
birth_cohort1715M1720 -0.03841 -0.06857 -0.00485 0.9623 0.9337 0.9952
birth_cohort1720M1725 -0.04049 -0.07065 -0.009747 0.9603 0.9318 0.9903
birth_cohort1725M1730 -0.06427 -0.09512 -0.03097 0.9378 0.9093 0.9695
birth_cohort1730M1735 -0.04748 -0.07774 -0.01529 0.9536 0.9252 0.9848
birth_cohort1735M1740 -0.05863 -0.08844 -0.02683 0.9431 0.9154 0.9735
male1 0.1111 0.1029 0.1194 1.118 1.108 1.127
maternalage.factor1420 -0.008942 -0.02829 0.01023 0.9911 0.9721 1.01
maternalage.factor3550 0.006271 -0.006868 0.01946 1.006 0.9932 1.02
paternalage.mean -0.01935 -0.03007 -0.008612 0.9808 0.9704 0.9914
paternal_loss01 -0.03304 -0.07474 0.006752 0.9675 0.928 1.007
paternal_loss15 -0.0134 -0.04481 0.01769 0.9867 0.9562 1.018
paternal_loss510 -0.006052 -0.0338 0.02123 0.994 0.9668 1.021
paternal_loss1015 -0.01233 -0.03766 0.01307 0.9877 0.963 1.013
paternal_loss1520 -0.02127 -0.04447 0.002404 0.979 0.9565 1.002
paternal_loss2025 -0.02061 -0.04241 0.001744 0.9796 0.9585 1.002
paternal_loss2530 -0.01093 -0.03256 0.01042 0.9891 0.968 1.01
paternal_loss3035 -0.02162 -0.04149 -0.001757 0.9786 0.9594 0.9982
paternal_loss3540 -0.02134 -0.0406 -0.002496 0.9789 0.9602 0.9975
paternal_loss4045 -0.002545 -0.0227 0.01756 0.9975 0.9776 1.018
paternal_lossunclear -0.05174 -0.07706 -0.02639 0.9496 0.9258 0.974
maternal_loss01 -0.04976 -0.09595 -0.00283 0.9515 0.9085 0.9972
maternal_loss15 -0.02613 -0.0543 0.003573 0.9742 0.9471 1.004
maternal_loss510 0.01345 -0.01108 0.03871 1.014 0.989 1.039
maternal_loss1015 -0.006977 -0.03061 0.01639 0.993 0.9699 1.017
maternal_loss1520 0.006892 -0.01646 0.02993 1.007 0.9837 1.03
maternal_loss2025 -0.01861 -0.04099 0.003649 0.9816 0.9598 1.004
maternal_loss2530 -0.01238 -0.03205 0.006994 0.9877 0.9685 1.007
maternal_loss3035 -0.007674 -0.02624 0.01106 0.9924 0.9741 1.011
maternal_loss3540 0.001243 -0.01552 0.01743 1.001 0.9846 1.018
maternal_loss4045 0.004325 -0.01282 0.02028 1.004 0.9873 1.02
maternal_lossunclear -0.01877 -0.04317 0.005978 0.9814 0.9578 1.006
older_siblings1 -0.02005 -0.03516 -0.005137 0.9802 0.9654 0.9949
older_siblings2 -0.02212 -0.03842 -0.006172 0.9781 0.9623 0.9938
older_siblings3 -0.02835 -0.04564 -0.01148 0.972 0.9554 0.9886
older_siblings4 -0.01528 -0.03354 0.002503 0.9848 0.967 1.003
older_siblings5P -0.02672 -0.04467 -0.008628 0.9736 0.9563 0.9914
nr.siblings 0.006774 0.004512 0.00906 1.007 1.005 1.009
last_born1 0.002269 -0.01251 0.01748 1.002 0.9876 1.018
hu_Intercept -0.8534 -1.028 -0.6754 0.426 0.3579 0.5089
hu_birth_cohort1675M1680 0.08067 -0.05742 0.2283 1.084 0.9442 1.256
hu_birth_cohort1680M1685 0.2333 0.09755 0.3731 1.263 1.102 1.452
hu_birth_cohort1685M1690 0.3422 0.2056 0.4831 1.408 1.228 1.621
hu_birth_cohort1690M1695 0.09 -0.04033 0.2317 1.094 0.9605 1.261
hu_birth_cohort1695M1700 0.1083 -0.02441 0.2411 1.114 0.9759 1.273
hu_birth_cohort1700M1705 0.2609 0.1299 0.3938 1.298 1.139 1.483
hu_birth_cohort1705M1710 0.1607 0.03293 0.2886 1.174 1.033 1.335
hu_birth_cohort1710M1715 0.4401 0.3152 0.5694 1.553 1.371 1.767
hu_birth_cohort1715M1720 0.2946 0.1743 0.4233 1.343 1.19 1.527
hu_birth_cohort1720M1725 0.3158 0.1925 0.4371 1.371 1.212 1.548
hu_birth_cohort1725M1730 0.6771 0.5589 0.8049 1.968 1.749 2.236
hu_birth_cohort1730M1735 0.7344 0.6175 0.8536 2.084 1.854 2.348
hu_birth_cohort1735M1740 0.5734 0.4571 0.6952 1.774 1.579 2.004
hu_male1 0.4358 0.4035 0.4685 1.546 1.497 1.598
hu_maternalage.factor1420 0.03707 -0.03426 0.108 1.038 0.9663 1.114
hu_maternalage.factor3550 0.08281 0.03542 0.1309 1.086 1.036 1.14
hu_paternalage.mean -0.01855 -0.0507 0.01304 0.9816 0.9506 1.013
hu_paternal_loss01 0.6144 0.4765 0.7555 1.849 1.61 2.129
hu_paternal_loss15 0.3462 0.2366 0.4505 1.414 1.267 1.569
hu_paternal_loss510 0.3219 0.2321 0.4184 1.38 1.261 1.52
hu_paternal_loss1015 0.1957 0.1127 0.284 1.216 1.119 1.328
hu_paternal_loss1520 0.3014 0.2182 0.3872 1.352 1.244 1.473
hu_paternal_loss2025 0.1903 0.1131 0.2644 1.21 1.12 1.303
hu_paternal_loss2530 0.1895 0.1107 0.2665 1.209 1.117 1.305
hu_paternal_loss3035 0.1481 0.07541 0.2207 1.16 1.078 1.247
hu_paternal_loss3540 0.1082 0.03362 0.178 1.114 1.034 1.195
hu_paternal_loss4045 0.07217 -0.006481 0.151 1.075 0.9935 1.163
hu_paternal_lossunclear 0.3871 0.3118 0.4648 1.473 1.366 1.592
hu_maternal_loss01 1.094 0.9513 1.24 2.986 2.589 3.454
hu_maternal_loss15 0.4189 0.32 0.5111 1.52 1.377 1.667
hu_maternal_loss510 0.2803 0.1935 0.3627 1.324 1.214 1.437
hu_maternal_loss1015 0.2732 0.1938 0.3559 1.314 1.214 1.427
hu_maternal_loss1520 0.2106 0.1299 0.2923 1.234 1.139 1.339
hu_maternal_loss2025 0.1826 0.1037 0.2608 1.2 1.109 1.298
hu_maternal_loss2530 0.06541 -0.008822 0.1385 1.068 0.9912 1.149
hu_maternal_loss3035 0.09648 0.02536 0.1651 1.101 1.026 1.18
hu_maternal_loss3540 0.08931 0.02466 0.1526 1.093 1.025 1.165
hu_maternal_loss4045 -0.005619 -0.07424 0.06315 0.9944 0.9284 1.065
hu_maternal_lossunclear 0.2329 0.1582 0.3066 1.262 1.171 1.359
hu_older_siblings1 -0.04322 -0.1025 0.01677 0.9577 0.9026 1.017
hu_older_siblings2 -0.06922 -0.1336 -0.00333 0.9331 0.8749 0.9967
hu_older_siblings3 -0.1065 -0.1743 -0.03853 0.899 0.8401 0.9622
hu_older_siblings4 -0.106 -0.1757 -0.03521 0.8994 0.8389 0.9654
hu_older_siblings5P -0.1394 -0.2029 -0.07462 0.8699 0.8163 0.9281
hu_nr.siblings 0.01319 0.006083 0.02044 1.013 1.006 1.021
hu_last_born1 0.008674 -0.04947 0.06787 1.009 0.9517 1.07

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/rpqa/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: 68724) 
## 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: 12205) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.27      0.00     0.27     0.28       1269 1.00
## sd(hu_Intercept)     0.63      0.01     0.60     0.66       1008 1.01
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     2.12      0.03     2.06     2.17        947
## paternalage                   0.01      0.01    -0.01     0.03       1308
## birth_cohort1675M1680         0.02      0.02    -0.01     0.05       1249
## birth_cohort1680M1685         0.05      0.02     0.02     0.08       1156
## birth_cohort1685M1690         0.05      0.02     0.02     0.08       1008
## birth_cohort1690M1695         0.05      0.02     0.02     0.08        966
## birth_cohort1695M1700         0.04      0.02     0.00     0.07        838
## birth_cohort1700M1705         0.02      0.02    -0.01     0.05        733
## birth_cohort1705M1710         0.00      0.02    -0.03     0.03        709
## birth_cohort1710M1715        -0.01      0.02    -0.04     0.02        768
## birth_cohort1715M1720        -0.04      0.02    -0.07    -0.01        737
## birth_cohort1720M1725        -0.04      0.02    -0.07    -0.01        720
## birth_cohort1725M1730        -0.07      0.02    -0.10    -0.04        687
## birth_cohort1730M1735        -0.05      0.02    -0.08    -0.02        660
## birth_cohort1735M1740        -0.06      0.02    -0.09    -0.03        648
## male1                         0.11      0.00     0.10     0.12       3000
## maternalage.factor1420       -0.01      0.01    -0.03     0.01       3000
## maternalage.factor3550        0.00      0.01    -0.01     0.02       3000
## paternalage.mean             -0.03      0.01    -0.05    -0.01       1286
## paternal_loss01              -0.04      0.02    -0.08     0.01       1917
## paternal_loss15              -0.02      0.02    -0.05     0.02       1413
## paternal_loss510             -0.01      0.01    -0.04     0.02       1079
## paternal_loss1015            -0.02      0.01    -0.04     0.01       1099
## paternal_loss1520            -0.02      0.01    -0.05     0.00       1179
## paternal_loss2025            -0.02      0.01    -0.04     0.00       1287
## paternal_loss2530            -0.01      0.01    -0.03     0.01       1237
## paternal_loss3035            -0.02      0.01    -0.04     0.00       1424
## paternal_loss3540            -0.02      0.01    -0.04     0.00       1840
## paternal_loss4045             0.00      0.01    -0.02     0.02       3000
## paternal_lossunclear         -0.05      0.01    -0.08    -0.03       1207
## maternal_loss01              -0.05      0.02    -0.10    -0.01       3000
## maternal_loss15              -0.03      0.02    -0.06     0.00       1833
## maternal_loss510              0.01      0.01    -0.01     0.04       1681
## maternal_loss1015            -0.01      0.01    -0.03     0.02       1772
## maternal_loss1520             0.01      0.01    -0.02     0.03       1868
## maternal_loss2025            -0.02      0.01    -0.04     0.00       1819
## maternal_loss2530            -0.01      0.01    -0.03     0.01       2198
## maternal_loss3035            -0.01      0.01    -0.03     0.01       2407
## maternal_loss3540             0.00      0.01    -0.02     0.02       2320
## maternal_loss4045             0.00      0.01    -0.01     0.02       3000
## maternal_lossunclear         -0.02      0.01    -0.04     0.01       1390
## older_siblings1              -0.02      0.01    -0.04    -0.01       3000
## older_siblings2              -0.03      0.01    -0.04    -0.01       1861
## older_siblings3              -0.03      0.01    -0.05    -0.01       1744
## older_siblings4              -0.02      0.01    -0.04     0.00       1625
## older_siblings5P             -0.04      0.01    -0.06    -0.01       1529
## nr.siblings                   0.01      0.00     0.00     0.01       1849
## last_born1                    0.00      0.01    -0.01     0.02       3000
## hu_Intercept                 -0.80      0.09    -0.97    -0.63        663
## hu_paternalage                0.13      0.04     0.05     0.21       1810
## hu_birth_cohort1675M1680      0.08      0.07    -0.06     0.21        791
## hu_birth_cohort1680M1685      0.23      0.07     0.10     0.37        726
## hu_birth_cohort1685M1690      0.34      0.07     0.20     0.47        622
## hu_birth_cohort1690M1695      0.08      0.07    -0.05     0.22        625
## hu_birth_cohort1695M1700      0.10      0.07    -0.02     0.23        534
## hu_birth_cohort1700M1705      0.25      0.06     0.13     0.38        519
## hu_birth_cohort1705M1710      0.15      0.06     0.03     0.28        461
## hu_birth_cohort1710M1715      0.43      0.06     0.31     0.56        484
## hu_birth_cohort1715M1720      0.29      0.06     0.16     0.40        420
## hu_birth_cohort1720M1725      0.31      0.06     0.19     0.43        459
## hu_birth_cohort1725M1730      0.67      0.06     0.55     0.79        414
## hu_birth_cohort1730M1735      0.72      0.06     0.61     0.85        393
## hu_birth_cohort1735M1740      0.57      0.06     0.45     0.68        428
## hu_male1                      0.44      0.02     0.40     0.47       3000
## hu_maternalage.factor1420     0.05      0.04    -0.03     0.12       3000
## hu_maternalage.factor3550     0.03      0.03    -0.03     0.09       3000
## hu_paternalage.mean          -0.14      0.04    -0.22    -0.06       1773
## hu_paternal_loss01            0.58      0.07     0.43     0.72       3000
## hu_paternal_loss15            0.31      0.05     0.21     0.42       3000
## hu_paternal_loss510           0.29      0.05     0.20     0.39       1811
## hu_paternal_loss1015          0.17      0.04     0.09     0.26       1585
## hu_paternal_loss1520          0.28      0.04     0.20     0.37       1717
## hu_paternal_loss2025          0.18      0.04     0.10     0.26       1604
## hu_paternal_loss2530          0.18      0.04     0.11     0.25       1693
## hu_paternal_loss3035          0.14      0.04     0.07     0.22       1557
## hu_paternal_loss3540          0.11      0.04     0.03     0.18       2191
## hu_paternal_loss4045          0.07      0.04    -0.01     0.15       3000
## hu_paternal_lossunclear       0.37      0.04     0.29     0.45       1571
## hu_maternal_loss01            1.06      0.07     0.92     1.21       3000
## hu_maternal_loss15            0.39      0.05     0.30     0.49       3000
## hu_maternal_loss510           0.26      0.05     0.17     0.35       3000
## hu_maternal_loss1015          0.25      0.04     0.17     0.34       3000
## hu_maternal_loss1520          0.20      0.04     0.12     0.28       3000
## hu_maternal_loss2025          0.17      0.04     0.09     0.25       3000
## hu_maternal_loss2530          0.05      0.04    -0.02     0.13       3000
## hu_maternal_loss3035          0.09      0.04     0.01     0.16       3000
## hu_maternal_loss3540          0.08      0.03     0.02     0.15       3000
## hu_maternal_loss4045         -0.01      0.03    -0.08     0.06       3000
## hu_maternal_lossunclear       0.22      0.04     0.15     0.30       3000
## hu_older_siblings1           -0.06      0.03    -0.12     0.00       3000
## hu_older_siblings2           -0.11      0.03    -0.17    -0.04       2283
## hu_older_siblings3           -0.17      0.04    -0.24    -0.09       1866
## hu_older_siblings4           -0.19      0.04    -0.27    -0.10       1790
## hu_older_siblings5P          -0.27      0.05    -0.37    -0.17       1591
## hu_nr.siblings                0.02      0.00     0.01     0.03       1905
## hu_last_born1                 0.00      0.03    -0.06     0.05       3000
##                           Rhat
## Intercept                 1.00
## paternalage               1.00
## birth_cohort1675M1680     1.00
## birth_cohort1680M1685     1.00
## birth_cohort1685M1690     1.00
## birth_cohort1690M1695     1.01
## birth_cohort1695M1700     1.01
## birth_cohort1700M1705     1.01
## birth_cohort1705M1710     1.01
## birth_cohort1710M1715     1.01
## birth_cohort1715M1720     1.01
## birth_cohort1720M1725     1.01
## birth_cohort1725M1730     1.01
## birth_cohort1730M1735     1.01
## birth_cohort1735M1740     1.00
## 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.01
## 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_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.01
## hu_birth_cohort1720M1725  1.00
## hu_birth_cohort1725M1730  1.01
## hu_birth_cohort1730M1735  1.00
## hu_birth_cohort1735M1740  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.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 2.116 2.061 2.171 8.297 7.857 8.771
paternalage 0.01106 -0.009251 0.03101 1.011 0.9908 1.031
birth_cohort1675M1680 0.02066 -0.01018 0.05274 1.021 0.9899 1.054
birth_cohort1680M1685 0.04774 0.01539 0.07966 1.049 1.016 1.083
birth_cohort1685M1690 0.0504 0.01792 0.08458 1.052 1.018 1.088
birth_cohort1690M1695 0.04764 0.01557 0.08053 1.049 1.016 1.084
birth_cohort1695M1700 0.03544 0.003737 0.06698 1.036 1.004 1.069
birth_cohort1700M1705 0.02165 -0.01016 0.05255 1.022 0.9899 1.054
birth_cohort1705M1710 -0.001667 -0.03323 0.02935 0.9983 0.9673 1.03
birth_cohort1710M1715 -0.01198 -0.04335 0.0184 0.9881 0.9576 1.019
birth_cohort1715M1720 -0.04016 -0.07132 -0.008616 0.9606 0.9312 0.9914
birth_cohort1720M1725 -0.04194 -0.07258 -0.01256 0.9589 0.93 0.9875
birth_cohort1725M1730 -0.06608 -0.09781 -0.03615 0.9361 0.9068 0.9645
birth_cohort1730M1735 -0.04898 -0.07959 -0.01911 0.9522 0.9235 0.9811
birth_cohort1735M1740 -0.06012 -0.09126 -0.02936 0.9417 0.9128 0.9711
male1 0.1111 0.1027 0.119 1.117 1.108 1.126
maternalage.factor1420 -0.008028 -0.02651 0.01063 0.992 0.9738 1.011
maternalage.factor3550 0.001539 -0.01453 0.01701 1.002 0.9856 1.017
paternalage.mean -0.02979 -0.0525 -0.006672 0.9706 0.9489 0.9934
paternal_loss01 -0.03818 -0.08053 0.005463 0.9625 0.9226 1.005
paternal_loss15 -0.01727 -0.04887 0.01538 0.9829 0.9523 1.016
paternal_loss510 -0.01039 -0.03783 0.01889 0.9897 0.9629 1.019
paternal_loss1015 -0.01595 -0.0406 0.009437 0.9842 0.9602 1.009
paternal_loss1520 -0.02417 -0.04855 0.001478 0.9761 0.9526 1.001
paternal_loss2025 -0.02254 -0.0439 -0.0002945 0.9777 0.9571 0.9997
paternal_loss2530 -0.01238 -0.03315 0.008837 0.9877 0.9674 1.009
paternal_loss3035 -0.02263 -0.0421 -0.002771 0.9776 0.9588 0.9972
paternal_loss3540 -0.02209 -0.04079 -0.003466 0.9782 0.96 0.9965
paternal_loss4045 -0.003084 -0.02221 0.01595 0.9969 0.978 1.016
paternal_lossunclear -0.05367 -0.07911 -0.02826 0.9477 0.9239 0.9721
maternal_loss01 -0.05247 -0.09848 -0.00745 0.9489 0.9062 0.9926
maternal_loss15 -0.02784 -0.0583 0.002759 0.9725 0.9434 1.003
maternal_loss510 0.01142 -0.0138 0.03681 1.011 0.9863 1.037
maternal_loss1015 -0.008465 -0.03329 0.0163 0.9916 0.9673 1.016
maternal_loss1520 0.006102 -0.01831 0.03029 1.006 0.9819 1.031
maternal_loss2025 -0.01971 -0.04263 0.003716 0.9805 0.9583 1.004
maternal_loss2530 -0.01311 -0.03394 0.006938 0.987 0.9666 1.007
maternal_loss3035 -0.008168 -0.02811 0.01117 0.9919 0.9723 1.011
maternal_loss3540 0.0007781 -0.01645 0.01802 1.001 0.9837 1.018
maternal_loss4045 0.003977 -0.01315 0.02133 1.004 0.9869 1.022
maternal_lossunclear -0.01935 -0.04379 0.005983 0.9808 0.9572 1.006
older_siblings1 -0.02196 -0.03783 -0.006998 0.9783 0.9629 0.993
older_siblings2 -0.02586 -0.04328 -0.009269 0.9745 0.9576 0.9908
older_siblings3 -0.03388 -0.05364 -0.01454 0.9667 0.9478 0.9856
older_siblings4 -0.02217 -0.04442 -0.0008486 0.9781 0.9566 0.9992
older_siblings5P -0.03786 -0.0642 -0.01192 0.9629 0.9378 0.9882
nr.siblings 0.007288 0.004837 0.009753 1.007 1.005 1.01
last_born1 0.001409 -0.01376 0.01619 1.001 0.9863 1.016
hu_Intercept -0.802 -0.971 -0.6293 0.4484 0.3787 0.5329
hu_paternalage 0.1302 0.05207 0.21 1.139 1.053 1.234
hu_birth_cohort1675M1680 0.07755 -0.05517 0.2122 1.081 0.9463 1.236
hu_birth_cohort1680M1685 0.2297 0.09645 0.3666 1.258 1.101 1.443
hu_birth_cohort1685M1690 0.3351 0.2018 0.4707 1.398 1.224 1.601
hu_birth_cohort1690M1695 0.08124 -0.05342 0.2177 1.085 0.948 1.243
hu_birth_cohort1695M1700 0.09921 -0.02458 0.2287 1.104 0.9757 1.257
hu_birth_cohort1700M1705 0.2545 0.132 0.3795 1.29 1.141 1.462
hu_birth_cohort1705M1710 0.153 0.03165 0.2796 1.165 1.032 1.323
hu_birth_cohort1710M1715 0.4317 0.315 0.5585 1.54 1.37 1.748
hu_birth_cohort1715M1720 0.2861 0.1646 0.4042 1.331 1.179 1.498
hu_birth_cohort1720M1725 0.3064 0.1888 0.4314 1.358 1.208 1.539
hu_birth_cohort1725M1730 0.6666 0.5494 0.7915 1.948 1.732 2.207
hu_birth_cohort1730M1735 0.7247 0.6115 0.8465 2.064 1.843 2.331
hu_birth_cohort1735M1740 0.5654 0.4516 0.6836 1.76 1.571 1.981
hu_male1 0.4355 0.4023 0.4671 1.546 1.495 1.595
hu_maternalage.factor1420 0.04791 -0.02599 0.121 1.049 0.9743 1.129
hu_maternalage.factor3550 0.02944 -0.02912 0.08786 1.03 0.9713 1.092
hu_paternalage.mean -0.144 -0.2226 -0.06089 0.8659 0.8004 0.9409
hu_paternal_loss01 0.5751 0.4313 0.7169 1.777 1.539 2.048
hu_paternal_loss15 0.3138 0.2118 0.4217 1.369 1.236 1.525
hu_paternal_loss510 0.2939 0.2026 0.3864 1.342 1.225 1.472
hu_paternal_loss1015 0.1738 0.08665 0.2583 1.19 1.091 1.295
hu_paternal_loss1520 0.2844 0.2029 0.3705 1.329 1.225 1.448
hu_paternal_loss2025 0.1774 0.0959 0.2556 1.194 1.101 1.291
hu_paternal_loss2530 0.1792 0.1066 0.2522 1.196 1.112 1.287
hu_paternal_loss3035 0.1435 0.07124 0.2171 1.154 1.074 1.242
hu_paternal_loss3540 0.1053 0.03131 0.1773 1.111 1.032 1.194
hu_paternal_loss4045 0.07001 -0.01036 0.147 1.073 0.9897 1.158
hu_paternal_lossunclear 0.3712 0.2902 0.4492 1.45 1.337 1.567
hu_maternal_loss01 1.059 0.922 1.208 2.882 2.514 3.348
hu_maternal_loss15 0.3929 0.2967 0.4921 1.481 1.345 1.636
hu_maternal_loss510 0.2585 0.1718 0.3451 1.295 1.187 1.412
hu_maternal_loss1015 0.2549 0.171 0.3382 1.29 1.186 1.402
hu_maternal_loss1520 0.1975 0.1191 0.2849 1.218 1.126 1.33
hu_maternal_loss2025 0.1701 0.08799 0.2515 1.185 1.092 1.286
hu_maternal_loss2530 0.05272 -0.02344 0.1316 1.054 0.9768 1.141
hu_maternal_loss3035 0.08588 0.01278 0.1572 1.09 1.013 1.17
hu_maternal_loss3540 0.08124 0.01733 0.1462 1.085 1.017 1.157
hu_maternal_loss4045 -0.01105 -0.08108 0.05575 0.989 0.9221 1.057
hu_maternal_lossunclear 0.2196 0.1477 0.2954 1.246 1.159 1.344
hu_older_siblings1 -0.06168 -0.1216 -0.002541 0.9402 0.8855 0.9975
hu_older_siblings2 -0.1075 -0.1732 -0.04053 0.898 0.841 0.9603
hu_older_siblings3 -0.1651 -0.2393 -0.09131 0.8478 0.7871 0.9127
hu_older_siblings4 -0.1851 -0.2685 -0.103 0.831 0.7646 0.9022
hu_older_siblings5P -0.2685 -0.368 -0.1671 0.7646 0.6921 0.8461
hu_nr.siblings 0.01934 0.01141 0.02725 1.02 1.011 1.028
hu_last_born1 -0.001526 -0.05817 0.05299 0.9985 0.9435 1.054

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 5.69 [5.41;5.97] [5.51;5.87]
estimate father 35y 5.52 [5.2;5.83] [5.31;5.72]
percentage change -3 [-6.08;0.24] [-4.97;-0.9]
OR/IRR 1.01 [0.99;1.03] [1;1.02]
OR hurdle 1.14 [1.05;1.23] [1.08;1.2]

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/rpqa/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: 68724) 
## 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.1      0.09     0.00     0.32        522
## sds(hu_spaternalage_1)      0.8      0.46     0.24     1.97        915
##                        Rhat
## sds(spaternalage_1)    1.01
## sds(hu_spaternalage_1) 1.00
## 
## Group-Level Effects: 
## ~idParents (Number of levels: 12205) 
##                  Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept)        0.27      0.00     0.27     0.28        848    1
## sd(hu_Intercept)     0.63      0.01     0.60     0.65       1049    1
## 
## Population-Level Effects: 
##                           Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept                     2.15      0.05     2.06     2.26        885
## birth_cohort1675M1680         0.02      0.02    -0.01     0.05        734
## birth_cohort1680M1685         0.05      0.02     0.02     0.08        743
## birth_cohort1685M1690         0.05      0.02     0.02     0.08        702
## birth_cohort1690M1695         0.05      0.02     0.02     0.08        558
## birth_cohort1695M1700         0.04      0.02     0.00     0.07        552
## birth_cohort1700M1705         0.02      0.02    -0.01     0.05        475
## birth_cohort1705M1710         0.00      0.02    -0.03     0.03        448
## birth_cohort1710M1715        -0.01      0.02    -0.04     0.02        424
## birth_cohort1715M1720        -0.04      0.02    -0.07    -0.01        425
## birth_cohort1720M1725        -0.04      0.02    -0.07    -0.01        405
## birth_cohort1725M1730        -0.07      0.02    -0.10    -0.04        423
## birth_cohort1730M1735        -0.05      0.02    -0.08    -0.02        399
## birth_cohort1735M1740        -0.06      0.02    -0.09    -0.03        440
## male1                         0.11      0.00     0.10     0.12       3000
## maternalage.factor1420       -0.01      0.01    -0.03     0.01       3000
## maternalage.factor3550        0.00      0.01    -0.01     0.02       2284
## paternalage.mean             -0.03      0.01    -0.05    -0.01       1255
## paternal_loss01              -0.04      0.02    -0.08     0.00       1144
## paternal_loss15              -0.02      0.02    -0.05     0.01        928
## paternal_loss510             -0.01      0.01    -0.04     0.02        768
## paternal_loss1015            -0.02      0.01    -0.04     0.01        845
## paternal_loss1520            -0.02      0.01    -0.05     0.00        745
## paternal_loss2025            -0.02      0.01    -0.04     0.00        795
## paternal_loss2530            -0.01      0.01    -0.03     0.01        760
## paternal_loss3035            -0.02      0.01    -0.04     0.00        958
## paternal_loss3540            -0.02      0.01    -0.04     0.00        951
## paternal_loss4045             0.00      0.01    -0.02     0.02       1532
## paternal_lossunclear         -0.05      0.01    -0.08    -0.03        792
## maternal_loss01              -0.05      0.02    -0.10    -0.01       1719
## maternal_loss15              -0.03      0.02    -0.06     0.00       1444
## maternal_loss510              0.01      0.01    -0.01     0.04       1237
## maternal_loss1015            -0.01      0.01    -0.03     0.02       1200
## maternal_loss1520             0.01      0.01    -0.02     0.03       1282
## maternal_loss2025            -0.02      0.01    -0.04     0.00       1258
## maternal_loss2530            -0.01      0.01    -0.03     0.01       1325
## maternal_loss3035            -0.01      0.01    -0.03     0.01       1375
## maternal_loss3540             0.00      0.01    -0.02     0.02       1762
## maternal_loss4045             0.00      0.01    -0.01     0.02       3000
## maternal_lossunclear         -0.02      0.01    -0.05     0.01        819
## older_siblings1              -0.02      0.01    -0.04    -0.01       1970
## older_siblings2              -0.02      0.01    -0.04    -0.01       1504
## older_siblings3              -0.03      0.01    -0.05    -0.01       1340
## older_siblings4              -0.02      0.01    -0.04     0.00       1275
## older_siblings5P             -0.04      0.01    -0.06    -0.01       1260
## nr.siblings                   0.01      0.00     0.00     0.01        883
## last_born1                    0.00      0.01    -0.01     0.02       3000
## spaternalage_1                0.02      0.02    -0.01     0.09        396
## hu_Intercept                 -0.20      0.18    -0.55     0.17        529
## hu_birth_cohort1675M1680      0.08      0.07    -0.05     0.21        382
## hu_birth_cohort1680M1685      0.23      0.07     0.10     0.36        379
## hu_birth_cohort1685M1690      0.34      0.07     0.21     0.48        357
## hu_birth_cohort1690M1695      0.10      0.07    -0.03     0.23        290
## hu_birth_cohort1695M1700      0.12      0.07    -0.01     0.25        255
## hu_birth_cohort1700M1705      0.27      0.06     0.15     0.39        272
## hu_birth_cohort1705M1710      0.16      0.06     0.04     0.29        266
## hu_birth_cohort1710M1715      0.44      0.06     0.32     0.56        241
## hu_birth_cohort1715M1720      0.30      0.06     0.18     0.42        257
## hu_birth_cohort1720M1725      0.32      0.06     0.21     0.44        251
## hu_birth_cohort1725M1730      0.68      0.06     0.57     0.80        244
## hu_birth_cohort1730M1735      0.74      0.06     0.62     0.85        249
## hu_birth_cohort1735M1740      0.57      0.06     0.46     0.69        245
## hu_male1                      0.44      0.02     0.40     0.47       3000
## hu_maternalage.factor1420     0.05      0.04    -0.02     0.13       3000
## hu_maternalage.factor3550     0.04      0.03    -0.02     0.09       1567
## hu_paternalage.mean          -0.17      0.04    -0.26    -0.09        729
## hu_paternal_loss01            0.58      0.07     0.44     0.72       1406
## hu_paternal_loss15            0.31      0.05     0.21     0.42       1088
## hu_paternal_loss510           0.29      0.05     0.20     0.38        876
## hu_paternal_loss1015          0.17      0.04     0.08     0.26        888
## hu_paternal_loss1520          0.28      0.04     0.19     0.36        670
## hu_paternal_loss2025          0.16      0.04     0.09     0.24        740
## hu_paternal_loss2530          0.16      0.04     0.09     0.24        690
## hu_paternal_loss3035          0.12      0.04     0.05     0.20        874
## hu_paternal_loss3540          0.09      0.04     0.02     0.16        974
## hu_paternal_loss4045          0.06      0.04    -0.02     0.13        876
## hu_paternal_lossunclear       0.36      0.04     0.29     0.44        699
## hu_maternal_loss01            1.06      0.07     0.93     1.20       3000
## hu_maternal_loss15            0.39      0.05     0.30     0.49       1359
## hu_maternal_loss510           0.26      0.04     0.18     0.35       1497
## hu_maternal_loss1015          0.26      0.04     0.17     0.34       1466
## hu_maternal_loss1520          0.20      0.04     0.12     0.29       1664
## hu_maternal_loss2025          0.17      0.04     0.09     0.25       1374
## hu_maternal_loss2530          0.05      0.04    -0.02     0.13       1629
## hu_maternal_loss3035          0.09      0.04     0.01     0.15       1518
## hu_maternal_loss3540          0.08      0.03     0.02     0.14       1569
## hu_maternal_loss4045         -0.01      0.03    -0.07     0.05       3000
## hu_maternal_lossunclear       0.22      0.04     0.14     0.30       1614
## hu_older_siblings1           -0.08      0.03    -0.14    -0.02       1527
## hu_older_siblings2           -0.15      0.03    -0.21    -0.08       1053
## hu_older_siblings3           -0.22      0.04    -0.30    -0.14        830
## hu_older_siblings4           -0.26      0.05    -0.35    -0.17        759
## hu_older_siblings5P          -0.35      0.05    -0.46    -0.25        721
## hu_nr.siblings                0.02      0.00     0.01     0.03       1114
## hu_last_born1                 0.00      0.03    -0.06     0.06       3000
## hu_spaternalage_1             0.11      0.11    -0.12     0.34        922
##                           Rhat
## Intercept                 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.01
## 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.01
## paternal_loss15           1.01
## paternal_loss510          1.01
## paternal_loss1015         1.01
## paternal_loss1520         1.01
## paternal_loss2025         1.01
## paternal_loss2530         1.01
## paternal_loss3035         1.01
## paternal_loss3540         1.01
## paternal_loss4045         1.00
## paternal_lossunclear      1.01
## 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.01
## 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.02
## hu_Intercept              1.01
## hu_birth_cohort1675M1680  1.02
## hu_birth_cohort1680M1685  1.02
## hu_birth_cohort1685M1690  1.02
## hu_birth_cohort1690M1695  1.02
## hu_birth_cohort1695M1700  1.03
## hu_birth_cohort1700M1705  1.03
## hu_birth_cohort1705M1710  1.03
## hu_birth_cohort1710M1715  1.03
## hu_birth_cohort1715M1720  1.02
## hu_birth_cohort1720M1725  1.03
## hu_birth_cohort1725M1730  1.03
## hu_birth_cohort1730M1735  1.03
## hu_birth_cohort1735M1740  1.03
## 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
## 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 2.155 2.057 2.258 8.628 7.824 9.56
birth_cohort1675M1680 0.02124 -0.009419 0.05173 1.021 0.9906 1.053
birth_cohort1680M1685 0.04805 0.01562 0.07915 1.049 1.016 1.082
birth_cohort1685M1690 0.05085 0.0177 0.08392 1.052 1.018 1.088
birth_cohort1690M1695 0.04769 0.01646 0.0789 1.049 1.017 1.082
birth_cohort1695M1700 0.03534 0.003852 0.0658 1.036 1.004 1.068
birth_cohort1700M1705 0.02128 -0.009419 0.05267 1.022 0.9906 1.054
birth_cohort1705M1710 -0.002076 -0.03199 0.02917 0.9979 0.9685 1.03
birth_cohort1710M1715 -0.0121 -0.04348 0.02031 0.988 0.9575 1.021
birth_cohort1715M1720 -0.04041 -0.07079 -0.0102 0.9604 0.9317 0.9899
birth_cohort1720M1725 -0.04281 -0.0736 -0.01222 0.9581 0.929 0.9879
birth_cohort1725M1730 -0.06648 -0.09729 -0.0357 0.9357 0.9073 0.9649
birth_cohort1730M1735 -0.04943 -0.08098 -0.01807 0.9518 0.9222 0.9821
birth_cohort1735M1740 -0.06045 -0.09096 -0.02906 0.9413 0.9131 0.9714
male1 0.1112 0.1026 0.1192 1.118 1.108 1.127
maternalage.factor1420 -0.0085 -0.02749 0.01034 0.9915 0.9729 1.01
maternalage.factor3550 0.001402 -0.01381 0.01697 1.001 0.9863 1.017
paternalage.mean -0.02987 -0.05303 -0.007511 0.9706 0.9484 0.9925
paternal_loss01 -0.03811 -0.07875 0.004686 0.9626 0.9243 1.005
paternal_loss15 -0.01797 -0.04988 0.01457 0.9822 0.9513 1.015
paternal_loss510 -0.01061 -0.03769 0.01816 0.9894 0.963 1.018
paternal_loss1015 -0.01569 -0.0416 0.01164 0.9844 0.9593 1.012
paternal_loss1520 -0.02376 -0.04792 0.0002498 0.9765 0.9532 1
paternal_loss2025 -0.02229 -0.04442 -0.0001385 0.978 0.9566 0.9999
paternal_loss2530 -0.01217 -0.03333 0.009057 0.9879 0.9672 1.009
paternal_loss3035 -0.02239 -0.04237 -0.00298 0.9779 0.9585 0.997
paternal_loss3540 -0.02207 -0.04085 -0.003602 0.9782 0.96 0.9964
paternal_loss4045 -0.003256 -0.02262 0.0153 0.9967 0.9776 1.015
paternal_lossunclear -0.0534 -0.07919 -0.02793 0.948 0.9239 0.9725
maternal_loss01 -0.05169 -0.09789 -0.005329 0.9496 0.9067 0.9947
maternal_loss15 -0.02772 -0.05841 0.004157 0.9727 0.9433 1.004
maternal_loss510 0.01219 -0.01417 0.0384 1.012 0.9859 1.039
maternal_loss1015 -0.007542 -0.03148 0.01761 0.9925 0.969 1.018
maternal_loss1520 0.006269 -0.01629 0.02999 1.006 0.9838 1.03
maternal_loss2025 -0.01893 -0.04127 0.004319 0.9813 0.9596 1.004
maternal_loss2530 -0.01239 -0.03298 0.009388 0.9877 0.9676 1.009
maternal_loss3035 -0.007949 -0.02709 0.0106 0.9921 0.9733 1.011
maternal_loss3540 0.001355 -0.01536 0.0178 1.001 0.9848 1.018
maternal_loss4045 0.004111 -0.01242 0.02026 1.004 0.9877 1.02
maternal_lossunclear -0.01957 -0.04533 0.006472 0.9806 0.9557 1.006
older_siblings1 -0.02093 -0.03643 -0.005014 0.9793 0.9642 0.995
older_siblings2 -0.02433 -0.04302 -0.006437 0.976 0.9579 0.9936
older_siblings3 -0.03225 -0.05358 -0.01146 0.9683 0.9478 0.9886
older_siblings4 -0.02071 -0.04489 0.003599 0.9795 0.9561 1.004
older_siblings5P -0.0366 -0.06457 -0.008108 0.9641 0.9375 0.9919
nr.siblings 0.007349 0.004815 0.009774 1.007 1.005 1.01
last_born1 0.001685 -0.01311 0.01642 1.002 0.987 1.017
spaternalage_1 0.0227 -0.01192 0.0908 1.023 0.9882 1.095
hu_Intercept -0.1987 -0.5481 0.1672 0.8198 0.5781 1.182
hu_birth_cohort1675M1680 0.07553 -0.05022 0.2054 1.078 0.951 1.228
hu_birth_cohort1680M1685 0.231 0.09706 0.3644 1.26 1.102 1.44
hu_birth_cohort1685M1690 0.3446 0.2108 0.4845 1.411 1.235 1.623
hu_birth_cohort1690M1695 0.09924 -0.03229 0.2336 1.104 0.9682 1.263
hu_birth_cohort1695M1700 0.1156 -0.01276 0.2507 1.123 0.9873 1.285
hu_birth_cohort1700M1705 0.2678 0.1493 0.3925 1.307 1.161 1.481
hu_birth_cohort1705M1710 0.1636 0.04121 0.2915 1.178 1.042 1.338
hu_birth_cohort1710M1715 0.4423 0.3221 0.5635 1.556 1.38 1.757
hu_birth_cohort1715M1720 0.2982 0.1841 0.4193 1.347 1.202 1.521
hu_birth_cohort1720M1725 0.322 0.2054 0.4406 1.38 1.228 1.554
hu_birth_cohort1725M1730 0.6824 0.5685 0.8016 1.979 1.766 2.229
hu_birth_cohort1730M1735 0.7381 0.6239 0.8548 2.092 1.866 2.351
hu_birth_cohort1735M1740 0.575 0.4594 0.6922 1.777 1.583 1.998
hu_male1 0.4353 0.4031 0.468 1.545 1.496 1.597
hu_maternalage.factor1420 0.0546 -0.01978 0.1273 1.056 0.9804 1.136
hu_maternalage.factor3550 0.0379 -0.0195 0.09412 1.039 0.9807 1.099
hu_paternalage.mean -0.1735 -0.2552 -0.0949 0.8407 0.7748 0.9095
hu_paternal_loss01 0.5769 0.4444 0.7155 1.781 1.56 2.045
hu_paternal_loss15 0.3147 0.21 0.4205 1.37 1.234 1.523
hu_paternal_loss510 0.2897 0.196 0.3823 1.336 1.217 1.466
hu_paternal_loss1015 0.1671 0.08152 0.2568 1.182 1.085 1.293
hu_paternal_loss1520 0.2751 0.1934 0.3603 1.317 1.213 1.434
hu_paternal_loss2025 0.1644 0.08598 0.2413 1.179 1.09 1.273
hu_paternal_loss2530 0.1615 0.08727 0.2356 1.175 1.091 1.266
hu_paternal_loss3035 0.1238 0.05373 0.1979 1.132 1.055 1.219
hu_paternal_loss3540 0.08655 0.01516 0.1574 1.09 1.015 1.17
hu_paternal_loss4045 0.05513 -0.02293 0.1339 1.057 0.9773 1.143
hu_paternal_lossunclear 0.362 0.2895 0.443 1.436 1.336 1.557
hu_maternal_loss01 1.061 0.9305 1.199 2.89 2.536 3.315
hu_maternal_loss15 0.3941 0.2998 0.493 1.483 1.35 1.637
hu_maternal_loss510 0.2602 0.1762 0.347 1.297 1.193 1.415
hu_maternal_loss1015 0.2587 0.1727 0.344 1.295 1.189 1.411
hu_maternal_loss1520 0.2017 0.1215 0.2892 1.224 1.129 1.335
hu_maternal_loss2025 0.172 0.09297 0.2493 1.188 1.097 1.283
hu_maternal_loss2530 0.05348 -0.02334 0.1273 1.055 0.9769 1.136
hu_maternal_loss3035 0.08548 0.01267 0.1548 1.089 1.013 1.167
hu_maternal_loss3540 0.08071 0.02128 0.1435 1.084 1.022 1.154
hu_maternal_loss4045 -0.009918 -0.0746 0.05309 0.9901 0.9281 1.055
hu_maternal_lossunclear 0.2217 0.1444 0.2993 1.248 1.155 1.349
hu_older_siblings1 -0.0812 -0.14 -0.02379 0.922 0.8694 0.9765
hu_older_siblings2 -0.1473 -0.2142 -0.07722 0.863 0.8072 0.9257
hu_older_siblings3 -0.2218 -0.2984 -0.1445 0.8011 0.742 0.8655
hu_older_siblings4 -0.2562 -0.3461 -0.1686 0.774 0.7074 0.8449
hu_older_siblings5P -0.3523 -0.4576 -0.2483 0.703 0.6328 0.7801
hu_nr.siblings 0.02283 0.01469 0.03079 1.023 1.015 1.031
hu_last_born1 0.0004019 -0.05658 0.05862 1 0.945 1.06
hu_spaternalage_1 0.114 -0.1174 0.3446 1.121 0.8893 1.411

Paternal age effect

pander::pander(paternal_age_10y_effect(model))
effect median_estimate ci_95 ci_80
estimate father 25y 5.79 [5.5;6.09] [5.6;5.99]
estimate father 35y 5.33 [5;5.69] [5.1;5.56]
percentage change -7.98 [-11.85;-4.12] [-10.49;-5.23]
OR/IRR 1.02 [0.99;1.1] [1;1.06]
OR hurdle 1.12 [0.89;1.41] [0.97;1.28]

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/rpqa/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      299887.04 992.25
## m2      300572.14 996.62
## m3      300565.05 996.79
## m4      300534.66 996.90
## m1 - m2   -685.11  72.68
## m1 - m3   -678.02  73.68
## m1 - m4   -647.62  74.25
## m2 - m3      7.09   8.17
## m2 - m4     37.48  13.97
## m3 - m4     30.39  11.30

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

##              WAIC     SE
## m1      299887.04 992.25
## m2      300572.16 996.62
## m3      300565.06 996.79
## m4      300534.67 996.90
## m1 - m2   -685.12  72.68
## m1 - m3   -678.03  73.68
## m1 - m4   -647.63  74.25
## m2 - m3      7.10   8.17
## m2 - m4     37.49  13.97
## m3 - m4     30.39  11.30