A generic wrapper around posterior::summarise_draws()
with
opinionated defaults.
Usage
enw_posterior(fit, variables = NULL, probs = c(0.05, 0.2, 0.8, 0.95), ...)
Arguments
- fit
A
cmdstanr
fit object.- variables
A character vector of variables to return posterior summaries for. By default summaries for all parameters are returned.
- probs
A vector of numeric probabilities to produce quantile summaries for. By default these are the 5%, 20%, 80%, and 95% quantiles which are also the minimum set required for plotting functions to work.
- ...
Additional arguments that may be passed but will not be used.
See also
Functions used for postprocessing of model fits
enw_add_latest_obs_to_nowcast()
,
enw_nowcast_samples()
,
enw_nowcast_summary()
,
enw_pp_summary()
,
enw_quantiles_to_long()
,
enw_summarise_samples()
Examples
fit <- enw_example("nowcast")
enw_posterior(fit$fit[[1]], variables = "expr_beta")
#> variable mean median sd mad q5
#> <char> <num> <num> <num> <num> <num>
#> 1: expr_beta[1] 0.35684525 0.38513650 0.6071031 0.5922742 -0.6494806
#> 2: expr_beta[2] -0.33875491 -0.35413550 0.5316359 0.5444528 -1.2489460
#> 3: expr_beta[3] -0.82588123 -0.81671050 0.5264853 0.5388206 -1.6927830
#> 4: expr_beta[4] 0.47819954 0.48673550 0.5527218 0.5539461 -0.3921465
#> 5: expr_beta[5] -0.46612483 -0.43738750 0.5324975 0.5265810 -1.3767895
#> 6: expr_beta[6] -0.24890586 -0.25825550 0.5541499 0.5388702 -1.1487240
#> 7: expr_beta[7] 1.73567813 1.73280500 0.5577201 0.5502299 0.8544918
#> 8: expr_beta[8] 0.30912781 0.29048400 0.5303134 0.5079153 -0.5208296
#> 9: expr_beta[9] 0.26129720 0.25496650 0.5351315 0.5102094 -0.5510549
#> 10: expr_beta[10] -0.34293924 -0.33896900 0.5085884 0.5114610 -1.1630510
#> 11: expr_beta[11] -0.18025398 -0.18849850 0.5293584 0.5401356 -1.0364660
#> 12: expr_beta[12] -0.55133190 -0.53363050 0.5061724 0.5214957 -1.4455940
#> 13: expr_beta[13] -1.21675116 -1.25548500 0.5557861 0.5387249 -2.0703980
#> 14: expr_beta[14] 1.50577137 1.49453000 0.5682583 0.5690664 0.5844779
#> 15: expr_beta[15] 1.80676209 1.78822500 0.5266780 0.5213044 0.9916373
#> 16: expr_beta[16] -0.22659670 -0.21280000 0.4970468 0.5192970 -1.0156420
#> 17: expr_beta[17] -0.22585278 -0.22793000 0.5033182 0.4833884 -1.0889905
#> 18: expr_beta[18] -0.19098402 -0.17873650 0.4940566 0.4875967 -1.0151905
#> 19: expr_beta[19] -0.55160992 -0.54766700 0.4783924 0.4669671 -1.3509820
#> 20: expr_beta[20] -0.32821312 -0.32561850 0.5125612 0.5046108 -1.1962030
#> 21: expr_beta[21] 1.63637949 1.63849000 0.5249875 0.5045733 0.7770415
#> 22: expr_beta[22] 0.40856186 0.39918700 0.4671506 0.4531634 -0.3303581
#> 23: expr_beta[23] -0.26195283 -0.27824500 0.4949229 0.4692837 -1.0530325
#> 24: expr_beta[24] -0.33525424 -0.32169400 0.5123588 0.4978281 -1.1339600
#> 25: expr_beta[25] -0.13372196 -0.14382750 0.4999209 0.4859259 -0.9678827
#> 26: expr_beta[26] -0.86077846 -0.86628550 0.4833677 0.4761889 -1.6534950
#> 27: expr_beta[27] -0.64756284 -0.65141150 0.5581826 0.5363091 -1.5271545
#> 28: expr_beta[28] 2.09501813 2.07307500 0.5592953 0.5371830 1.1501045
#> 29: expr_beta[29] 1.60666427 1.60619500 0.5061789 0.5187395 0.8145032
#> 30: expr_beta[30] 0.11283333 0.10585800 0.4617883 0.4696899 -0.6313616
#> 31: expr_beta[31] -0.64318005 -0.62561600 0.4883210 0.4828776 -1.4844680
#> 32: expr_beta[32] -0.23554353 -0.22705450 0.5100066 0.5079847 -1.0740710
#> 33: expr_beta[33] -0.66394530 -0.65881200 0.5019356 0.5210079 -1.4722470
#> 34: expr_beta[34] -0.13647475 -0.12728800 0.5257835 0.5127135 -1.0345925
#> 35: expr_beta[35] 1.45225360 1.44985000 0.5448896 0.5435212 0.5733330
#> 36: expr_beta[36] 0.19724123 0.17712750 0.5479048 0.5495294 -0.6532589
#> 37: expr_beta[37] 0.02321996 0.04016270 0.5654696 0.5489968 -0.8943150
#> 38: expr_beta[38] 0.09745179 0.07998625 0.5901572 0.5827882 -0.8472095
#> 39: expr_beta[39] 0.16275776 0.14112550 0.6432952 0.6728869 -0.8980906
#> 40: expr_beta[40] 0.42947144 0.41642350 0.7665738 0.7325518 -0.7988134
#> variable mean median sd mad q5
#> q20 q80 q95 rhat ess_bulk ess_tail
#> <num> <num> <num> <num> <num> <num>
#> 1: -0.163013600 0.87226020 1.31767450 1.0001047 867.1216 773.7010
#> 2: -0.787502200 0.13752940 0.51372130 1.0029342 1370.1095 692.4391
#> 3: -1.267146000 -0.36400680 -0.01222673 1.0007299 1019.0570 680.3411
#> 4: -0.003975476 0.92062180 1.38134150 1.0013801 1110.4424 911.1582
#> 5: -0.920010600 -0.03905900 0.39158630 1.0039360 1330.7214 848.9383
#> 6: -0.717053400 0.20730320 0.71817620 1.0001761 1538.3876 758.6339
#> 7: 1.271064000 2.21426000 2.65595500 1.0055696 1349.1534 885.1633
#> 8: -0.122569800 0.73059860 1.27063700 1.0006482 1588.5825 802.7376
#> 9: -0.192926400 0.69688320 1.16726600 0.9988548 1308.2225 725.2749
#> 10: -0.765678800 0.07463298 0.48722810 1.0033819 1370.6060 863.7248
#> 11: -0.601448200 0.27612500 0.67290860 1.0090129 1099.6415 680.6538
#> 12: -0.975785800 -0.12505980 0.26517450 1.0034301 922.8422 711.5400
#> 13: -1.677980000 -0.75861240 -0.26068960 1.0033923 1033.1353 710.5464
#> 14: 1.018106000 2.00031200 2.46543500 1.0008425 1373.2452 747.9076
#> 15: 1.343624000 2.24870200 2.70458000 1.0013836 1045.4871 989.8063
#> 16: -0.666397400 0.17619740 0.59433185 1.0005048 1780.9331 654.9422
#> 17: -0.625236800 0.17792700 0.60199935 1.0013312 1314.6543 764.2015
#> 18: -0.584519400 0.20731240 0.61549185 1.0020052 1143.0577 726.4011
#> 19: -0.954171800 -0.16228140 0.22944395 1.0031739 1071.1708 745.8015
#> 20: -0.769528400 0.10849600 0.50364475 0.9997411 965.2687 945.7367
#> 21: 1.205266000 2.06758600 2.51144850 1.0100474 943.2035 797.7075
#> 22: 0.006352270 0.78036720 1.21200000 0.9996066 1210.5042 843.2722
#> 23: -0.698228800 0.13156440 0.58908165 1.0011512 1123.5315 542.4462
#> 24: -0.744428000 0.09040918 0.45692945 0.9988092 1233.4907 588.3721
#> 25: -0.545979400 0.30070380 0.69926310 1.0005777 1234.2198 712.5444
#> 26: -1.277310000 -0.46010760 -0.07827088 1.0032229 952.4666 596.0861
#> 27: -1.126038000 -0.19323020 0.29300760 1.0011828 1149.3325 795.7194
#> 28: 1.637286000 2.57600600 3.00911450 1.0033170 1098.3874 804.6810
#> 29: 1.167128000 2.03239200 2.45619300 1.0034821 1186.2869 906.1873
#> 30: -0.276539200 0.50056900 0.85454015 1.0068652 1074.9634 848.8544
#> 31: -1.034494000 -0.24212920 0.17003400 0.9992916 1215.3117 737.5176
#> 32: -0.666932800 0.18828940 0.62481300 0.9986804 1197.6937 699.0221
#> 33: -1.083712000 -0.23174800 0.16350350 0.9988375 1137.3569 803.2799
#> 34: -0.561141800 0.30273520 0.72544580 1.0003900 1095.8057 854.2453
#> 35: 1.003394000 1.90514400 2.31765300 1.0004043 879.0179 657.8051
#> 36: -0.295889000 0.65494980 1.14122800 1.0056312 1235.9879 852.6814
#> 37: -0.453943200 0.46923540 0.96774300 1.0075710 1193.8100 745.7828
#> 38: -0.376546600 0.59535760 1.05643450 1.0010685 1026.9035 699.4094
#> 39: -0.391462400 0.72403500 1.19838600 1.0052822 1393.4582 901.7751
#> 40: -0.205988800 1.08607600 1.72318550 1.0049766 1393.2373 829.0541
#> q20 q80 q95 rhat ess_bulk ess_tail