Skip to contents

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

Value

The predicted values for each regression model.

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.566468381 0.2559095  0.06929056  1.06677488
#>  [2,]  0.278387702 0.1821139 -0.06621433  0.64546803
#>  [3,] -0.084384387 0.3382100 -0.76725175  0.56977504
#>  [4,] -0.134978753 0.3935054 -0.89137440  0.64480295
#>  [5,]  0.151125244 0.3473834 -0.52507515  0.84560531
#>  [6,]  0.378567399 0.1890771  0.01212420  0.76701729
#>  [7,]  0.493477350 0.2104514  0.08819373  0.91290550
#>  [8,]  0.478943749 0.2474621 -0.01089564  0.96426624
#>  [9,]  0.362329947 0.2177746 -0.06145668  0.79651210
#> [10,]  0.432048714 0.1752925  0.08768049  0.77613698
#> [11,] -0.674418496 0.4637123 -1.58651908  0.24369605
#> [12,] -0.571734157 0.4448238 -1.43915598  0.32241858
#> [13,]  0.069515192 0.2619108 -0.43375845  0.58098429
#> [14,] -0.386831591 0.3874905 -1.15376007  0.37701676
#> [15,]  0.088446794 0.1457032 -0.19855384  0.37439381
#> [16,]  0.236300477 0.1973690 -0.15516341  0.62285093
#> [17,]  0.317439800 0.2405635 -0.15900468  0.79567180
#> [18,]  0.201332307 0.2928941 -0.37375587  0.77502213
#> [19,]  0.170970861 0.2508085 -0.32288275  0.66684712
#> [20,]  0.168853464 0.2215738 -0.26315966  0.61560762
#> [21,] -0.332449230 0.3046716 -0.92340896  0.26880164
#> [22,]  0.218752809 0.1660347 -0.09989176  0.54942578
#> [23,]  0.241756581 0.1432102 -0.04149163  0.52109752
#> [24,]  0.092490322 0.3499861 -0.60894350  0.75913088
#> [25,]  0.546015401 0.3137197 -0.07064542  1.15387257
#> [26,]  0.203546950 0.2258833 -0.22623330  0.64174582
#> [27,]  0.218114631 0.1953151 -0.16643004  0.60804052
#> [28,]  0.126831952 0.1503709 -0.16464794  0.42537771
#> [29,]  0.074942663 0.2315349 -0.36304702  0.52857517
#> [30,] -0.235126250 0.1992161 -0.62645365  0.15097289
#> [31,]  0.219121105 0.4109440 -0.58839758  1.02872013
#> [32,]  0.036728893 0.1983535 -0.35298314  0.42759642
#> [33,] -0.218736249 0.1970584 -0.61302794  0.16411503
#> [34,] -0.013967073 0.1856452 -0.37740158  0.34257057
#> [35,] -0.868469200 0.4296124 -1.71347458 -0.02922968
#> [36,] -0.698622408 0.3740276 -1.42633300  0.03265651
#> [37,] -0.685184978 0.4405585 -1.57080748  0.16720258
#> [38,] -0.680234017 0.4640204 -1.58294902  0.24208783
#> [39,] -0.278451716 0.3447809 -0.94840730  0.40668333
#> [40,]  0.187593033 0.1330373 -0.07359870  0.45258806
#> [41,] -0.184488318 0.2042626 -0.58105092  0.21671379
#> [42,] -0.147485899 0.3358125 -0.80867637  0.49619050
#> [43,]  0.017051990 0.2513637 -0.47654526  0.49714512
#> [44,]  0.010150758 0.2081423 -0.39209850  0.41843014
#> [45,]  0.069813548 0.2784758 -0.48171912  0.60601524
#> [46,]  0.274693373 0.1208211  0.04325416  0.51294036
#> [47,]  0.277833907 0.1977603 -0.11536603  0.66194757
#> [48,] -0.305576813 0.3930934 -1.08262999  0.46638907
#> [49,]  0.021656902 0.1233738 -0.22495063  0.26628942
#> [50,]  0.065611255 0.2215859 -0.36934312  0.49908171
#> [51,]  0.045227052 0.1430132 -0.23909881  0.32320778
#> [52,]  0.167518622 0.1608733 -0.14287954  0.48557931
#> [53,]  0.097853248 0.1944180 -0.28325491  0.48471945
#> [54,]  0.165442334 0.1986791 -0.22963802  0.55280688
#> [55,]  0.110846306 0.1516323 -0.18575107  0.40718349
#> [56,] -0.015026276 0.1928099 -0.40060130  0.35958364
#> [57,]  0.527445934 0.2094239  0.11711410  0.93451486
#> [58,]  0.104822305 0.2207580 -0.33917444  0.52981879
#> [59,]  0.275072371 0.3947363 -0.48327326  1.05352657
#> [60,]  0.023629418 0.2625299 -0.49873943  0.54160074
#> [61,] -0.056633445 0.2819543 -0.61354875  0.49905892
#> [62,] -0.196882762 0.2477914 -0.68591829  0.28684376
#> [63,] -0.159142254 0.2250988 -0.60639596  0.28715806
#> [64,]  0.240988939 0.3507233 -0.43926505  0.93663452
#> [65,]  0.098313626 0.4055484 -0.71736403  0.89654448
#> [66,]  0.275224212 0.2210086 -0.15503765  0.71710580
#> [67,] -0.362054069 0.3133464 -0.97418885  0.24310946
#> [68,]  0.213421773 0.1706148 -0.11941992  0.54917241
#> [69,]  0.148310829 0.2509914 -0.33385173  0.64056410
#> [70,] -0.400495978 0.4186008 -1.21695112  0.41369612
#> [71,]  0.064391083 0.2438465 -0.40383786  0.54986653
#> [72,] -0.119609203 0.1962137 -0.50452300  0.27151086
#> [73,] -0.117809110 0.2060069 -0.52168840  0.27384651
#> [74,] -0.101269414 0.2039777 -0.50429655  0.29812693
#> [75,] -0.158738310 0.1680335 -0.49269370  0.16947451
#> [76,] -0.064863845 0.1509386 -0.36091088  0.23428555
#> [77,] -0.181690209 0.1348607 -0.44523985  0.08206486
#> [78,] -0.057266312 0.2829694 -0.61906222  0.50410462
#> [79,] -0.495006265 0.3886076 -1.25442311  0.26179530
#> [80,]  0.098751920 0.2132491 -0.32544374  0.51478887
#> [81,]  0.005791708 0.1013316 -0.19639559  0.20904870
#> [82,] -0.292397725 0.2094297 -0.70501332  0.10886413
#> [83,] -0.446184568 0.3858018 -1.19021979  0.31143305
#> [84,]  0.440075563 0.2588222 -0.06421615  0.95963130
#> [85,]  0.208088188 0.2030169 -0.18189095  0.60864724
#> [86,]  0.136877317 0.3979159 -0.65063726  0.92252606
#> [87,] -0.201403425 0.1702092 -0.54339939  0.13392716
#> [88,] -0.059592367 0.2237350 -0.50265841  0.37818027
#> [89,] -0.294855922 0.2135100 -0.72098435  0.11546470
#> [90,]  0.127772044 0.3373006 -0.54206722  0.77912694
#> [91,] -0.233879160 0.3233374 -0.87822442  0.39548690
#> [92,] -0.150844176 0.2254057 -0.58912284  0.28808395
#> [93,] -0.272036163 0.2857859 -0.83474066  0.28537411

# }