Model Predictions for var_estimate Objects
Usage
# S3 method for class 'var_estimate'
predict(object, summary = TRUE, cred = 0.95, iter = NULL, progress = TRUE, ...)Arguments
- object
object of class
var_estimate- summary
summarize the posterior samples (defaults to
TRUE).- cred
credible interval used for summarizing
- iter
number of posterior samples (defaults to all in the object).
- progress
Logical. Should a progress bar be included (defaults to
TRUE) ?- ...
Currently ignored
Examples
# \donttest{
# data
Y <- subset(ifit, id == 1)[,-1]
# fit model with alias (var_estimate also works)
fit <- var_estimate(Y, progress = FALSE)
# fitted values
pred <- predict(fit, progress = FALSE)
# predicted values (1st outcome)
pred[,,1]
#> Post.mean Post.sd Cred.lb Cred.ub
#> [1,] 0.560337416 0.2511761 0.062501999 1.052654189
#> [2,] 0.277441884 0.1824482 -0.083545404 0.629163723
#> [3,] -0.088472724 0.3364972 -0.768058467 0.561610968
#> [4,] -0.137618296 0.3956847 -0.921878085 0.621729071
#> [5,] 0.150982226 0.3541184 -0.540232640 0.858840923
#> [6,] 0.377749770 0.1894631 -0.007294313 0.746671869
#> [7,] 0.489360867 0.2081968 0.076917276 0.896922474
#> [8,] 0.478533003 0.2436344 0.000485289 0.948910445
#> [9,] 0.360153815 0.2176151 -0.076802565 0.787009306
#> [10,] 0.428909047 0.1727568 0.091788458 0.773912838
#> [11,] -0.665143489 0.4739418 -1.593623205 0.279316767
#> [12,] -0.567834208 0.4447840 -1.426456395 0.311525304
#> [13,] 0.071313308 0.2596801 -0.453023593 0.576518120
#> [14,] -0.386913112 0.3851274 -1.162219970 0.355001527
#> [15,] 0.090927007 0.1480161 -0.199970757 0.385323899
#> [16,] 0.234943476 0.2003208 -0.164739763 0.633090370
#> [17,] 0.314353004 0.2471760 -0.165580588 0.788645496
#> [18,] 0.198913380 0.2898744 -0.371153890 0.774067287
#> [19,] 0.166644236 0.2511874 -0.319452577 0.661865725
#> [20,] 0.169970300 0.2216186 -0.275893646 0.599445219
#> [21,] -0.332401141 0.3054867 -0.934405753 0.260627029
#> [22,] 0.218366285 0.1685999 -0.112850500 0.539059435
#> [23,] 0.241330490 0.1440283 -0.038405161 0.518563433
#> [24,] 0.085888117 0.3539925 -0.617022889 0.771055762
#> [25,] 0.543014955 0.3193298 -0.087706583 1.159671141
#> [26,] 0.205757998 0.2292493 -0.244053110 0.655434520
#> [27,] 0.217955289 0.1956579 -0.176911714 0.604059165
#> [28,] 0.127250229 0.1522244 -0.167804395 0.431284230
#> [29,] 0.076578104 0.2332966 -0.378158905 0.532144183
#> [30,] -0.235239483 0.1991420 -0.620612297 0.158138570
#> [31,] 0.211471865 0.4104818 -0.591878866 1.012802916
#> [32,] 0.039329062 0.2013358 -0.350959101 0.433559532
#> [33,] -0.217755585 0.1940000 -0.610984279 0.159964502
#> [34,] -0.014081706 0.1892036 -0.387494527 0.356959332
#> [35,] -0.854250131 0.4277039 -1.677898968 -0.007392299
#> [36,] -0.686714138 0.3761040 -1.417198026 0.056608693
#> [37,] -0.678495147 0.4388479 -1.548842417 0.200550674
#> [38,] -0.681781152 0.4627328 -1.589656518 0.221663557
#> [39,] -0.279135805 0.3442441 -0.954146072 0.393780966
#> [40,] 0.187100907 0.1370017 -0.076427427 0.453184037
#> [41,] -0.180207446 0.2017406 -0.588527167 0.209842190
#> [42,] -0.145019959 0.3314668 -0.804502014 0.496930259
#> [43,] 0.014800295 0.2484290 -0.477693744 0.500364494
#> [44,] 0.005897438 0.2074293 -0.402836280 0.418724901
#> [45,] 0.066673319 0.2752565 -0.494088042 0.604874722
#> [46,] 0.272810440 0.1201181 0.038932250 0.507546658
#> [47,] 0.274701019 0.1999652 -0.116803545 0.669933208
#> [48,] -0.303168824 0.3915829 -1.071613204 0.478205732
#> [49,] 0.021542520 0.1241947 -0.223214509 0.262219841
#> [50,] 0.060932385 0.2204702 -0.360174023 0.501899299
#> [51,] 0.047048534 0.1431237 -0.242302082 0.327012346
#> [52,] 0.167046153 0.1593616 -0.151129206 0.482378715
#> [53,] 0.097971405 0.1918208 -0.293426471 0.471611106
#> [54,] 0.165050656 0.1985578 -0.217763443 0.555465398
#> [55,] 0.110558917 0.1494741 -0.186239600 0.404959764
#> [56,] -0.012055486 0.1960683 -0.394374144 0.366128072
#> [57,] 0.523466823 0.2076074 0.113001338 0.930341284
#> [58,] 0.107922512 0.2231194 -0.330769778 0.536851337
#> [59,] 0.270827892 0.3857370 -0.502252662 1.032750854
#> [60,] 0.019619515 0.2645349 -0.519237694 0.534773230
#> [61,] -0.057428127 0.2805790 -0.621475923 0.489352269
#> [62,] -0.193896099 0.2478923 -0.674714138 0.277096628
#> [63,] -0.156769409 0.2283753 -0.596776852 0.300575168
#> [64,] 0.238518763 0.3558053 -0.458733469 0.952920266
#> [65,] 0.102739064 0.4159045 -0.715924431 0.922769244
#> [66,] 0.273400613 0.2219496 -0.164371126 0.701597437
#> [67,] -0.359065547 0.3048522 -0.978137843 0.228265539
#> [68,] 0.210009494 0.1680183 -0.113918490 0.547444830
#> [69,] 0.146937814 0.2465063 -0.343298298 0.641450713
#> [70,] -0.393995144 0.4240603 -1.244987858 0.441595981
#> [71,] 0.058775835 0.2446168 -0.422460592 0.537105844
#> [72,] -0.116430071 0.1982469 -0.501392563 0.277985568
#> [73,] -0.116091646 0.2074397 -0.526004470 0.295712444
#> [74,] -0.100795625 0.2067173 -0.509940798 0.302158793
#> [75,] -0.156874404 0.1687338 -0.481334049 0.174764369
#> [76,] -0.065758666 0.1505595 -0.371012887 0.233086275
#> [77,] -0.181100953 0.1344314 -0.443206552 0.080861531
#> [78,] -0.057237097 0.2859807 -0.620744666 0.507702003
#> [79,] -0.490498705 0.3918486 -1.260942100 0.280396387
#> [80,] 0.099891913 0.2194112 -0.331572668 0.533359502
#> [81,] 0.007047521 0.1016367 -0.198384370 0.201385425
#> [82,] -0.290720625 0.2133621 -0.698824199 0.135642200
#> [83,] -0.442116191 0.3946920 -1.210160408 0.320924885
#> [84,] 0.434658592 0.2581092 -0.082345156 0.931678412
#> [85,] 0.203722968 0.2017943 -0.188144710 0.607327069
#> [86,] 0.140037273 0.3904586 -0.600808438 0.905351830
#> [87,] -0.202497293 0.1696053 -0.537261859 0.132891564
#> [88,] -0.055383264 0.2298656 -0.500645194 0.389242521
#> [89,] -0.291101451 0.2183253 -0.712593381 0.143988437
#> [90,] 0.122346904 0.3443111 -0.535810995 0.803885212
#> [91,] -0.234649109 0.3277140 -0.860426235 0.406374393
#> [92,] -0.153656646 0.2239895 -0.596609919 0.288646805
#> [93,] -0.270087104 0.2838175 -0.831422838 0.265274671
# }
