2020 excess mortality & voting patterns in CH
INLA models using GEM
Males
Canton
DIC
WAIC
Model
summary(gem_bym2_kt$Male)
Call:
c("inla(formula = formula, family = \"Poisson\", data = data_sex, ", "
quantiles = c(0.025, 0.5, 0.975), control.compute = list(config = TRUE,
", " cpo = TRUE, dic = TRUE, waic = TRUE), control.predictor =
list(compute = TRUE, ", " link = 1), control.family = control.family,
control.mode = list(restart = TRUE), ", " num.threads = threads)")
Time used:
Pre = 17.3, Running = 68.2, Post = 4.23, Total = 89.7
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant mode kld
(Intercept) 37.971 3.600 30.902 37.970 45.033 37.971 0
year -0.021 0.002 -0.025 -0.021 -0.018 -0.021 0
Random effects:
Name Model
id_age IID model
id_kt IID model
id_space BYM2 model
Model hyperparameters:
mean sd 0.025quant 0.5quant 0.975quant mode
Precision for id_age 0.760 0.326 0.279 0.711 1.531 0.604
Precision for id_kt 1080.827 484.577 394.336 998.679 2253.953 833.926
Precision for id_space 56.931 4.886 48.040 56.676 67.249 56.117
Phi for id_space 0.373 0.084 0.218 0.370 0.545 0.364
Deviance Information Criterion (DIC) ...............: 135921.51
Deviance Information Criterion (DIC, saturated) ....: 50578.62
Effective number of parameters .....................: 751.14
Watanabe-Akaike information criterion (WAIC) ...: 135953.01
Effective number of parameters .................: 757.02
Marginal log-Likelihood: -67352.76
CPO, PIT is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
$Male$summary.hyperpar gem_bym2_kt
mean sd 0.025quant 0.5quant
Precision for id_age 0.7596845 0.3261455 0.2790999 0.7109357
Precision for id_kt 1080.8272541 484.5769609 394.3355537 998.6790071
Precision for id_space 56.9314130 4.8856663 48.0399231 56.6759151
Phi for id_space 0.3728067 0.0841687 0.2182465 0.3698433
0.975quant mode
Precision for id_age 1.5310777 0.6042316
Precision for id_kt 2253.9530231 833.9260756
Precision for id_space 67.2488690 56.1165031
Phi for id_space 0.5449771 0.3643848
Canton effect
Observed vs predicted
Examples
Lugano
Errors
Zero observed 2015-19
Zero predicted 2015-19
Large(ish) absolute error
Aggregating all observed and pred over years
# A tibble: 6 × 4
year observed predicted diff
<int> <int> <int> <int>
1 2015 31723 31103 620
2 2016 30457 31294 -837
3 2017 31513 31466 47
4 2018 31533 31589 -56
5 2019 31951 31722 229
6 2020 36710 31940 4770
Region effect
x <categorical>
# total N=2145 valid N=2145 mean=4.01 sd=0.87
Value | N | Raw % | Valid % | Cum. %
---------------------------------------------
[0,0.64) | 1 | 0.05 | 0.05 | 0.05
[0.64,0.86) | 98 | 4.57 | 4.57 | 4.62
[0.86,0.95) | 439 | 20.47 | 20.47 | 25.08
[0.95,1.05) | 1017 | 47.41 | 47.41 | 72.49
[1.05,1.16) | 528 | 24.62 | 24.62 | 97.11
[1.16,1.57) | 61 | 2.84 | 2.84 | 99.95
[1.57,10) | 1 | 0.05 | 0.05 | 100.00
<NA> | 0 | 0.00 | <NA> | <NA>
Performance
= inla.tmarginal(function(x) 1/x,
marg.variance $Male$marginals.hyperpar$"Precision for id_space")
gem_bym2_ktinla.zmarginal(marg.variance)
Mean 0.0176927
Stdev 0.00150129
Quantile 0.025 0.014891
Quantile 0.25 0.016646
Quantile 0.5 0.0176418
Quantile 0.75 0.0186782
Quantile 0.975 0.0207835
table(gem_bym2_kt$Male$cpo$failure > 0)
FALSE
53535
sum(-log(gem_bym2_kt$Male$cpo$cpo), na.rm = TRUE)
[1] 67977.99
Females
Canton
DIC
WAIC
Model
summary(gem_bym2_kt$Female)
Call:
c("inla(formula = formula, family = \"Poisson\", data = data_sex, ", "
quantiles = c(0.025, 0.5, 0.975), control.compute = list(config = TRUE,
", " cpo = TRUE, dic = TRUE, waic = TRUE), control.predictor =
list(compute = TRUE, ", " link = 1), control.family = control.family,
control.mode = list(restart = TRUE), ", " num.threads = threads)")
Time used:
Pre = 16.2, Running = 51.2, Post = 4.63, Total = 72.1
Fixed effects:
mean sd 0.025quant 0.5quant 0.975quant mode kld
(Intercept) 17.050 3.457 10.262 17.050 23.832 17.050 0
year -0.011 0.002 -0.014 -0.011 -0.008 -0.011 0
Random effects:
Name Model
id_age IID model
id_kt IID model
id_space BYM2 model
Model hyperparameters:
mean sd 0.025quant 0.5quant 0.975quant mode
Precision for id_age 0.721 0.351 0.228 0.661 1.569 0.531
Precision for id_kt 740.498 387.373 261.846 651.742 1754.927 514.075
Precision for id_space 48.757 3.973 41.817 48.437 57.382 47.608
Phi for id_space 0.216 0.062 0.106 0.213 0.346 0.209
Deviance Information Criterion (DIC) ...............: 121016.62
Deviance Information Criterion (DIC, saturated) ....: 46755.88
Effective number of parameters .....................: 843.23
Watanabe-Akaike information criterion (WAIC) ...: 121078.56
Effective number of parameters .................: 860.65
Marginal log-Likelihood: -59950.70
CPO, PIT is computed
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
$Female$summary.hyperpar gem_bym2_kt
mean sd 0.025quant 0.5quant
Precision for id_age 0.7214584 0.35115784 0.2279906 0.6614275
Precision for id_kt 740.4983399 387.37300426 261.8458331 651.7420004
Precision for id_space 48.7566823 3.97282665 41.8173480 48.4374321
Phi for id_space 0.2158365 0.06179372 0.1055651 0.2130570
0.975quant mode
Precision for id_age 1.5693826 0.5314274
Precision for id_kt 1754.9266538 514.0745742
Precision for id_space 57.3816639 47.6084758
Phi for id_space 0.3460103 0.2088108
Canton effect
Observed vs predicted
Examples
Lugano
Aggregating all observed and pred over time
# A tibble: 6 × 4
year observed predicted diff
<int> <int> <int> <int>
1 2015 34464 33831 633
2 2016 33151 33976 -825
3 2017 34079 34109 -30
4 2018 34212 34205 7
5 2019 34563 34346 217
6 2020 38070 34531 3539
Region effect
x <categorical>
# total N=2145 valid N=2145 mean=4.00 sd=0.88
Value | N | Raw % | Valid % | Cum. %
---------------------------------------------
[0,0.64) | 1 | 0.05 | 0.05 | 0.05
[0.64,0.86) | 109 | 5.08 | 5.08 | 5.13
[0.86,0.95) | 407 | 18.97 | 18.97 | 24.10
[0.95,1.05) | 1078 | 50.26 | 50.26 | 74.36
[1.05,1.16) | 471 | 21.96 | 21.96 | 96.32
[1.16,1.57) | 75 | 3.50 | 3.50 | 99.81
[1.57,10) | 4 | 0.19 | 0.19 | 100.00
<NA> | 0 | 0.00 | <NA> | <NA>
Performance
= inla.tmarginal(function(x) 1/x,
marg.variance $Female$marginals.hyperpar$"Precision for id_space")
gem_bym2_ktinla.zmarginal(marg.variance)
Mean 0.0206442
Stdev 0.00164554
Quantile 0.025 0.0174472
Quantile 0.25 0.0195108
Quantile 0.5 0.020644
Quantile 0.75 0.0217554
Quantile 0.975 0.023891
table(gem_bym2_kt$Female$cpo$failure > 0)
FALSE
53586
sum(-log(gem_bym2_kt$Female$cpo$cpo), na.rm = TRUE)
[1] 60543.33