
Provides posterior summary of variables' fitted values
Source:R/summary.R
summary.PosteriorFitted.RdProvides posterior summary of the fitted values including their mean, standard deviations, as well as 5 and 95 percentiles.
Usage
# S3 method for class 'PosteriorFitted'
summary(object, ...)Arguments
- object
an object of class PosteriorFitted obtained using the
compute_fitted_values()function containing draws the predictive density of the sample data.- ...
additional arguments affecting the summary produced.
Value
A list reporting the posterior mean, standard deviations, as well as 5 and 95 percentiles of the fitted values for each of the shocks and periods.
Author
Tomasz Woźniak wozniak.tom@pm.me
Examples
specification = specify_bsvar$new(us_fiscal_lsuw)
#> The identification is set to the default option of lower-triangular structural matrix.
burn_in = estimate(specification, 5)
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Gibbs sampler for the SVAR model |
#> **************************************************|
#> Progress of the MCMC simulation for 5 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
posterior = estimate(burn_in, 5)
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Gibbs sampler for the SVAR model |
#> **************************************************|
#> Progress of the MCMC simulation for 5 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
# compute fitted values
fitted = compute_fitted_values(posterior)
fitted_summary = summary(fitted)
fitted_summary$ttr[,1] # access posterior mean of ttr
#> 1 2 3 4 5 6 7
#> -10.509267 -10.594809 -10.646667 -10.637802 -10.652390 -10.666846 -10.686646
#> 8 9 10 11 12 13 14
#> -10.748282 -10.661327 -10.651407 -10.560179 -10.489086 -10.430461 -10.424392
#> 15 16 17 18 19 20 21
#> -10.376026 -10.337922 -10.313480 -10.277203 -10.275958 -10.227339 -10.262688
#> 22 23 24 25 26 27 28
#> -10.270096 -10.249524 -10.284287 -10.353356 -10.352299 -10.371874 -10.356895
#> 29 30 31 32 33 34 35
#> -10.332357 -10.312874 -10.290838 -10.261977 -10.243343 -10.269320 -10.238970
#> 36 37 38 39 40 41 42
#> -10.253964 -10.215152 -10.234678 -10.245688 -10.220807 -10.261654 -10.269107
#> 43 44 45 46 47 48 49
#> -10.266428 -10.277486 -10.211701 -10.176267 -10.196313 -10.214352 -10.120057
#> 50 51 52 53 54 55 56
#> -10.114370 -10.135196 -10.135260 -10.128795 -10.149165 -10.134784 -10.087737
#> 57 58 59 60 61 62 63
#> -10.076249 -10.053334 -10.049996 -10.043391 -10.055596 -10.006083 -10.033780
#> 64 65 66 67 68 69 70
#> -10.023731 -10.020493 -10.123757 -10.071136 -10.063913 -10.015011 -10.035853
#> 71 72 73 74 75 76 77
#> -10.033513 -10.051716 -9.954260 -9.922544 -9.914927 -9.904481 -9.887478
#> 78 79 80 81 82 83 84
#> -9.914504 -9.882554 -9.849604 -9.847839 -9.824004 -9.793553 -9.767945
#> 85 86 87 88 89 90 91
#> -9.728019 -9.690193 -9.710514 -9.750109 -9.768755 -9.755542 -9.808624
#> 92 93 94 95 96 97 98
#> -9.802221 -9.839720 -9.833839 -9.848223 -9.847544 -9.763847 -9.759840
#> 99 100 101 102 103 104 105
#> -9.766111 -9.759638 -9.729318 -9.729030 -9.729119 -9.680298 -9.696793
#> 106 107 108 109 110 111 112
#> -9.699696 -9.710593 -9.721863 -9.749091 -9.940498 -9.765527 -9.776535
#> 113 114 115 116 117 118 119
#> -9.750551 -9.766439 -9.735666 -9.745264 -9.713614 -9.677569 -9.700197
#> 120 121 122 123 124 125 126
#> -9.698724 -9.698186 -9.659025 -9.637187 -9.602762 -9.619159 -9.604054
#> 127 128 129 130 131 132 133
#> -9.591477 -9.590521 -9.602666 -9.594277 -9.588487 -9.563197 -9.502113
#> 134 135 136 137 138 139 140
#> -9.511597 -9.513608 -9.540339 -9.559946 -9.567193 -9.620984 -9.577530
#> 141 142 143 144 145 146 147
#> -9.615534 -9.602772 -9.618637 -9.611848 -9.577553 -9.559169 -9.550161
#> 148 149 150 151 152 153 154
#> -9.550234 -9.466158 -9.567300 -9.518005 -9.491852 -9.502735 -9.497435
#> 155 156 157 158 159 160 161
#> -9.512854 -9.484738 -9.490256 -9.431108 -9.429159 -9.440297 -9.424980
#> 162 163 164 165 166 167 168
#> -9.414670 -9.454163 -9.437631 -9.385887 -9.374764 -9.391713 -9.384342
#> 169 170 171 172 173 174 175
#> -9.394067 -9.357746 -9.386986 -9.370720 -9.411029 -9.441027 -9.419033
#> 176 177 178 179 180 181 182
#> -9.406965 -9.410974 -9.398176 -9.398624 -9.383192 -9.420443 -9.402243
#> 183 184 185 186 187 188 189
#> -9.377095 -9.362935 -9.363708 -9.336087 -9.338927 -9.344330 -9.329883
#> 190 191 192 193 194 195 196
#> -9.323813 -9.347962 -9.305543 -9.275825 -9.254264 -9.226014 -9.241956
#> 197 198 199 200 201 202 203
#> -9.240298 -9.217357 -9.209771 -9.184929 -9.167131 -9.162574 -9.139700
#> 204 205 206 207 208 209 210
#> -9.129051 -9.117587 -9.112356 -9.105142 -9.065142 -9.069074 -9.072870
#> 211 212 213 214 215 216 217
#> -9.024093 -9.062199 -9.032440 -9.052540 -9.147361 -9.128017 -9.164778
#> 218 219 220 221 222 223 224
#> -9.171515 -9.200916 -9.190900 -9.192131 -9.222682 -9.264974 -9.245567
#> 225 226 227 228 229 230 231
#> -9.244643 -9.222748 -9.200709 -9.222128 -9.169880 -9.170274 -9.158924
#> 232 233 234 235 236 237 238
#> -9.157251 -9.129924 -9.135519 -9.100479 -9.075894 -9.123592 -9.092904
#> 239 240 241 242 243 244 245
#> -9.124751 -9.083569 -9.117369 -9.087838 -9.104150 -9.131626 -9.253080
#> 246 247 248 249 250 251 252
#> -9.296973 -9.280100 -9.301820 -9.253542 -9.230843 -9.231843 -9.229376
#> 253 254 255 256 257 258 259
#> -9.212853 -9.226827 -9.189799 -9.207305 -9.241497 -9.199957 -9.197571
#> 260 261 262 263 264 265 266
#> -9.172013 -9.143128 -9.104852 -9.115096 -9.093651 -9.105681 -9.104591
#> 267 268 269 270 271 272 273
#> -9.068400 -9.044401 -9.038691 -9.040459 -9.027205 -9.056277 -9.042675
#> 274 275 276 277 278 279 280
#> -9.028592 -9.028726 -9.015907 -9.040261 -9.023647 -9.011736 -9.008968
#> 281 282 283 284 285 286 287
#> -9.015191 -9.016797 -9.018104 -9.023779 -8.983923 -9.011007 -9.009467
#> 288 289 290 291 292 293 294
#> -8.983483 -8.952186 -9.062405 -9.000298 -8.948704 -8.917148 -8.897677
#> 295 296 297 298 299 300 301
#> -8.915034 -8.912839 -8.826630 -8.828003 -8.839708 -8.854695 -8.936430
#> 302 303 304 305 306 307 308
#> -8.953545 -8.924961 -8.920834 -8.881262 -8.895784 -8.907875 -8.887520
#> 309 310 311 312
#> -8.878496 -8.853316 -8.856888 -8.820403
# workflow with the pipe |>
############################################################
us_fiscal_lsuw |>
specify_bsvar$new() |>
estimate(S = 5) |>
estimate(S = 5) |>
compute_fitted_values() |>
summary() -> fitted_summary
#> The identification is set to the default option of lower-triangular structural matrix.
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Gibbs sampler for the SVAR model |
#> **************************************************|
#> Progress of the MCMC simulation for 5 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Gibbs sampler for the SVAR model |
#> **************************************************|
#> Progress of the MCMC simulation for 5 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
fitted_summary$ttr[,1] # access posterior mean of ttr
#> 1 2 3 4 5 6 7
#> -10.292293 -10.291861 -10.200800 -10.409992 -10.281012 -10.398673 -10.285373
#> 8 9 10 11 12 13 14
#> -10.421132 -10.601689 -10.122410 -10.093436 -9.958529 -9.910369 -10.266538
#> 15 16 17 18 19 20 21
#> -9.903200 -9.756561 -9.869391 -9.818767 -9.843752 -9.790735 -9.885286
#> 22 23 24 25 26 27 28
#> -9.760737 -10.121119 -10.110657 -10.076913 -10.165170 -9.755942 -9.932224
#> 29 30 31 32 33 34 35
#> -9.996143 -9.924123 -9.617703 -9.911038 -10.199262 -9.806807 -9.641359
#> 36 37 38 39 40 41 42
#> -9.951563 -10.094197 -9.728022 -9.741317 -9.665784 -10.067431 -9.875014
#> 43 44 45 46 47 48 49
#> -9.772483 -9.918207 -10.105670 -10.170846 -9.633531 -9.847641 -9.797062
#> 50 51 52 53 54 55 56
#> -9.433655 -9.570243 -9.854620 -9.900886 -9.891807 -9.938587 -9.973093
#> 57 58 59 60 61 62 63
#> -9.383738 -10.053111 -9.684744 -9.732746 -9.514775 -9.517326 -9.837626
#> 64 65 66 67 68 69 70
#> -9.451716 -9.746847 -9.845479 -9.829815 -10.021882 -9.554211 -9.361531
#> 71 72 73 74 75 76 77
#> -9.747202 -9.543798 -9.558459 -9.744139 -9.241696 -9.381607 -9.609677
#> 78 79 80 81 82 83 84
#> -9.536316 -9.532830 -9.559099 -9.742524 -9.533575 -9.515438 -9.576364
#> 85 86 87 88 89 90 91
#> -9.633612 -9.453993 -9.085708 -9.440570 -9.668957 -9.217828 -9.718749
#> 92 93 94 95 96 97 98
#> -9.794892 -9.525167 -9.451492 -9.457240 -9.399152 -9.359174 -9.475554
#> 99 100 101 102 103 104 105
#> -9.289662 -9.355166 -9.106437 -9.605639 -9.403951 -9.420706 -9.413348
#> 106 107 108 109 110 111 112
#> -9.325990 -9.637962 -9.439835 -9.515480 -9.318755 -9.508274 -9.771890
#> 113 114 115 116 117 118 119
#> -9.419104 -9.268991 -9.541995 -9.556070 -9.338413 -9.520517 -9.436450
#> 120 121 122 123 124 125 126
#> -9.394304 -9.352108 -9.237231 -9.274349 -9.033534 -9.101104 -9.295333
#> 127 128 129 130 131 132 133
#> -9.062304 -9.353714 -9.285070 -9.431692 -8.984019 -9.406905 -9.224543
#> 134 135 136 137 138 139 140
#> -9.076075 -9.134460 -9.003347 -9.421699 -9.121755 -8.904212 -9.475233
#> 141 142 143 144 145 146 147
#> -9.316211 -9.476838 -9.118025 -9.072038 -8.993788 -9.209239 -9.157378
#> 148 149 150 151 152 153 154
#> -9.062406 -9.232017 -9.272054 -9.183952 -8.993990 -9.188468 -9.073788
#> 155 156 157 158 159 160 161
#> -8.917448 -9.368654 -9.159370 -9.063934 -8.960296 -8.957725 -9.217424
#> 162 163 164 165 166 167 168
#> -9.419257 -9.162211 -8.982836 -9.292126 -9.215652 -9.009698 -8.929917
#> 169 170 171 172 173 174 175
#> -9.179067 -9.392434 -9.146921 -8.977882 -8.865867 -8.951969 -9.143571
#> 176 177 178 179 180 181 182
#> -9.078469 -8.958614 -9.351822 -9.164934 -9.069918 -9.424891 -8.890360
#> 183 184 185 186 187 188 189
#> -8.783026 -9.104170 -8.905206 -9.138187 -8.872743 -9.154781 -9.094816
#> 190 191 192 193 194 195 196
#> -8.820581 -9.040952 -8.819768 -8.893128 -8.774365 -8.843490 -8.778876
#> 197 198 199 200 201 202 203
#> -9.000825 -8.828031 -8.876906 -9.087417 -8.876833 -8.635488 -8.857255
#> 204 205 206 207 208 209 210
#> -8.869618 -8.718164 -8.654998 -8.694757 -8.748575 -8.330722 -8.861493
#> 211 212 213 214 215 216 217
#> -8.518714 -8.896944 -8.727858 -8.628651 -8.753061 -8.818424 -8.864104
#> 218 219 220 221 222 223 224
#> -8.813432 -8.882261 -8.999091 -9.053155 -8.944619 -8.959393 -8.858064
#> 225 226 227 228 229 230 231
#> -8.967452 -8.894098 -8.724207 -9.241175 -8.657950 -8.394029 -8.848999
#> 232 233 234 235 236 237 238
#> -8.863428 -8.794246 -8.871841 -8.530954 -8.554870 -8.629246 -8.846121
#> 239 240 241 242 243 244 245
#> -8.958212 -8.681678 -8.970265 -8.748372 -8.918698 -8.582680 -8.715579
#> 246 247 248 249 250 251 252
#> -8.946277 -8.780023 -9.119956 -9.083146 -9.083708 -9.089082 -8.945760
#> 253 254 255 256 257 258 259
#> -8.934645 -8.696510 -8.931570 -8.703399 -8.746472 -8.825347 -8.915275
#> 260 261 262 263 264 265 266
#> -8.866262 -8.816072 -8.627177 -8.880681 -8.635609 -9.097018 -8.634759
#> 267 268 269 270 271 272 273
#> -8.926671 -9.004458 -8.584793 -8.703816 -8.617339 -8.863553 -8.677273
#> 274 275 276 277 278 279 280
#> -8.597325 -8.975110 -8.996721 -8.771992 -8.638944 -8.841371 -8.419284
#> 281 282 283 284 285 286 287
#> -8.682761 -8.759128 -8.765065 -8.688397 -8.399881 -8.384633 -8.581013
#> 288 289 290 291 292 293 294
#> -8.817332 -8.705472 -8.760533 -8.684625 -8.698751 -8.523169 -8.549985
#> 295 296 297 298 299 300 301
#> -8.578822 -8.547576 -8.296992 -8.630892 -8.251453 -8.614002 -8.769733
#> 302 303 304 305 306 307 308
#> -8.894835 -8.568333 -8.646641 -8.660622 -8.427500 -8.788270 -8.520218
#> 309 310 311 312
#> -8.835728 -8.833600 -8.318202 -8.526099