This function returns the choice probabilities of an RprobitB_fit
object.
Arguments
- x
An object of class
RprobitB_fit
.- data
Either
NULL
or an object of classRprobitB_data
. In the former case, choice probabilities are computed for the data that was used for model fitting. Alternatively, a new data set can be provided.- par_set
Specifying the parameter set for calculation and either
a function that computes a posterior point estimate (the default is
mean()
),"true"
to select the true parameter set,an object of class
RprobitB_parameter
.
Value
A data frame of choice probabilities with choice situations in rows and
alternatives in columns. The first two columns are the decider identifier
"id"
and the choice situation identifier "idc"
.
Examples
data <- simulate_choices(form = choice ~ covariate, N = 10, T = 10, J = 2)
x <- fit_model(data)
#> Computing sufficient statistics - 0 of 4
#> Computing sufficient statistics - 1 of 4
#> Computing sufficient statistics - 2 of 4
#> Computing sufficient statistics - 3 of 4
#> Computing sufficient statistics - 4 of 4
#> MCMC iteration - 1 of 1000
#> MCMC iteration - 10 of 1000
#> MCMC iteration - 20 of 1000
#> MCMC iteration - 30 of 1000
#> MCMC iteration - 40 of 1000
#> MCMC iteration - 50 of 1000
#> MCMC iteration - 60 of 1000
#> MCMC iteration - 70 of 1000
#> MCMC iteration - 80 of 1000
#> MCMC iteration - 90 of 1000
#> MCMC iteration - 100 of 1000
#> MCMC iteration - 110 of 1000
#> MCMC iteration - 120 of 1000
#> MCMC iteration - 130 of 1000
#> MCMC iteration - 140 of 1000
#> MCMC iteration - 150 of 1000
#> MCMC iteration - 160 of 1000
#> MCMC iteration - 170 of 1000
#> MCMC iteration - 180 of 1000
#> MCMC iteration - 190 of 1000
#> MCMC iteration - 200 of 1000
#> MCMC iteration - 210 of 1000
#> MCMC iteration - 220 of 1000
#> MCMC iteration - 230 of 1000
#> MCMC iteration - 240 of 1000
#> MCMC iteration - 250 of 1000
#> MCMC iteration - 260 of 1000
#> MCMC iteration - 270 of 1000
#> MCMC iteration - 280 of 1000
#> MCMC iteration - 290 of 1000
#> MCMC iteration - 300 of 1000
#> MCMC iteration - 310 of 1000
#> MCMC iteration - 320 of 1000
#> MCMC iteration - 330 of 1000
#> MCMC iteration - 340 of 1000
#> MCMC iteration - 350 of 1000
#> MCMC iteration - 360 of 1000
#> MCMC iteration - 370 of 1000
#> MCMC iteration - 380 of 1000
#> MCMC iteration - 390 of 1000
#> MCMC iteration - 400 of 1000
#> MCMC iteration - 410 of 1000
#> MCMC iteration - 420 of 1000
#> MCMC iteration - 430 of 1000
#> MCMC iteration - 440 of 1000
#> MCMC iteration - 450 of 1000
#> MCMC iteration - 460 of 1000
#> MCMC iteration - 470 of 1000
#> MCMC iteration - 480 of 1000
#> MCMC iteration - 490 of 1000
#> MCMC iteration - 500 of 1000
#> MCMC iteration - 510 of 1000
#> MCMC iteration - 520 of 1000
#> MCMC iteration - 530 of 1000
#> MCMC iteration - 540 of 1000
#> MCMC iteration - 550 of 1000
#> MCMC iteration - 560 of 1000
#> MCMC iteration - 570 of 1000
#> MCMC iteration - 580 of 1000
#> MCMC iteration - 590 of 1000
#> MCMC iteration - 600 of 1000
#> MCMC iteration - 610 of 1000
#> MCMC iteration - 620 of 1000
#> MCMC iteration - 630 of 1000
#> MCMC iteration - 640 of 1000
#> MCMC iteration - 650 of 1000
#> MCMC iteration - 660 of 1000
#> MCMC iteration - 670 of 1000
#> MCMC iteration - 680 of 1000
#> MCMC iteration - 690 of 1000
#> MCMC iteration - 700 of 1000
#> MCMC iteration - 710 of 1000
#> MCMC iteration - 720 of 1000
#> MCMC iteration - 730 of 1000
#> MCMC iteration - 740 of 1000
#> MCMC iteration - 750 of 1000
#> MCMC iteration - 760 of 1000
#> MCMC iteration - 770 of 1000
#> MCMC iteration - 780 of 1000
#> MCMC iteration - 790 of 1000
#> MCMC iteration - 800 of 1000
#> MCMC iteration - 810 of 1000
#> MCMC iteration - 820 of 1000
#> MCMC iteration - 830 of 1000
#> MCMC iteration - 840 of 1000
#> MCMC iteration - 850 of 1000
#> MCMC iteration - 860 of 1000
#> MCMC iteration - 870 of 1000
#> MCMC iteration - 880 of 1000
#> MCMC iteration - 890 of 1000
#> MCMC iteration - 900 of 1000
#> MCMC iteration - 910 of 1000
#> MCMC iteration - 920 of 1000
#> MCMC iteration - 930 of 1000
#> MCMC iteration - 940 of 1000
#> MCMC iteration - 950 of 1000
#> MCMC iteration - 960 of 1000
#> MCMC iteration - 970 of 1000
#> MCMC iteration - 980 of 1000
#> MCMC iteration - 990 of 1000
#> MCMC iteration - 1000 of 1000
#> Computing log-likelihood
choice_probabilities(x)
#> id idc A B
#> 1 1 1 0.843718969 1.562810e-01
#> 2 1 2 0.020547192 9.794528e-01
#> 3 1 3 0.936683304 6.331670e-02
#> 4 1 4 0.920378659 7.962134e-02
#> 5 1 5 0.274295841 7.257042e-01
#> 6 1 6 0.198698642 8.013014e-01
#> 7 1 7 0.705218561 2.947814e-01
#> 8 1 8 0.939063800 6.093620e-02
#> 9 1 9 0.482215823 5.177842e-01
#> 10 1 10 0.956376644 4.362336e-02
#> 11 2 1 0.456421869 5.435781e-01
#> 12 2 2 0.398579981 6.014200e-01
#> 13 2 3 0.579771700 4.202283e-01
#> 14 2 4 0.212290248 7.877098e-01
#> 15 2 5 0.402797906 5.972021e-01
#> 16 2 6 0.020595171 9.794048e-01
#> 17 2 7 0.394804841 6.051952e-01
#> 18 2 8 0.987946150 1.205385e-02
#> 19 2 9 0.029132265 9.708677e-01
#> 20 2 10 0.991637698 8.362302e-03
#> 21 3 1 0.802125553 1.978744e-01
#> 22 3 2 0.265441151 7.345588e-01
#> 23 3 3 0.855774351 1.442256e-01
#> 24 3 4 0.507096098 4.929039e-01
#> 25 3 5 0.662091128 3.379089e-01
#> 26 3 6 0.179391284 8.206087e-01
#> 27 3 7 0.937463801 6.253620e-02
#> 28 3 8 0.163929623 8.360704e-01
#> 29 3 9 0.986108333 1.389167e-02
#> 30 3 10 0.996096477 3.903523e-03
#> 31 4 1 0.988351488 1.164851e-02
#> 32 4 2 0.889272764 1.107272e-01
#> 33 4 3 0.772652444 2.273476e-01
#> 34 4 4 0.209995164 7.900048e-01
#> 35 4 5 0.977382790 2.261721e-02
#> 36 4 6 0.099958434 9.000416e-01
#> 37 4 7 0.026922209 9.730778e-01
#> 38 4 8 0.239910875 7.600891e-01
#> 39 4 9 0.301024724 6.989753e-01
#> 40 4 10 0.993630982 6.369018e-03
#> 41 5 1 0.362458763 6.375412e-01
#> 42 5 2 0.955204940 4.479506e-02
#> 43 5 3 0.970818082 2.918192e-02
#> 44 5 4 0.213555985 7.864440e-01
#> 45 5 5 0.954428233 4.557177e-02
#> 46 5 6 0.732884417 2.671156e-01
#> 47 5 7 0.036512285 9.634877e-01
#> 48 5 8 0.569765586 4.302344e-01
#> 49 5 9 0.543285434 4.567146e-01
#> 50 5 10 0.557550464 4.424495e-01
#> 51 6 1 0.927449496 7.255050e-02
#> 52 6 2 0.833027236 1.669728e-01
#> 53 6 3 0.872441366 1.275586e-01
#> 54 6 4 0.906836497 9.316350e-02
#> 55 6 5 0.099704635 9.002954e-01
#> 56 6 6 0.979309759 2.069024e-02
#> 57 6 7 0.078535490 9.214645e-01
#> 58 6 8 0.023306010 9.766940e-01
#> 59 6 9 0.434391541 5.656085e-01
#> 60 6 10 0.111984201 8.880158e-01
#> 61 7 1 0.555127535 4.448725e-01
#> 62 7 2 0.635581102 3.644189e-01
#> 63 7 3 0.992049282 7.950718e-03
#> 64 7 4 0.550046256 4.499537e-01
#> 65 7 5 0.167391037 8.326090e-01
#> 66 7 6 0.863708216 1.362918e-01
#> 67 7 7 0.999977175 2.282528e-05
#> 68 7 8 0.301335935 6.986641e-01
#> 69 7 9 0.498267595 5.017324e-01
#> 70 7 10 0.627243708 3.727563e-01
#> 71 8 1 0.986461744 1.353826e-02
#> 72 8 2 0.981712969 1.828703e-02
#> 73 8 3 0.952789304 4.721070e-02
#> 74 8 4 0.655113697 3.448863e-01
#> 75 8 5 0.249166607 7.508334e-01
#> 76 8 6 0.369160102 6.308399e-01
#> 77 8 7 0.775998842 2.240012e-01
#> 78 8 8 0.641813053 3.581869e-01
#> 79 8 9 0.995699219 4.300781e-03
#> 80 8 10 0.783105733 2.168943e-01
#> 81 9 1 0.888417029 1.115830e-01
#> 82 9 2 0.877198916 1.228011e-01
#> 83 9 3 0.316104963 6.838950e-01
#> 84 9 4 0.932303999 6.769600e-02
#> 85 9 5 0.595052872 4.049471e-01
#> 86 9 6 0.988917215 1.108279e-02
#> 87 9 7 0.001503186 9.984968e-01
#> 88 9 8 0.999510036 4.899642e-04
#> 89 9 9 0.945421455 5.457854e-02
#> 90 9 10 0.904857500 9.514250e-02
#> 91 10 1 0.915782929 8.421707e-02
#> 92 10 2 0.526533100 4.734669e-01
#> 93 10 3 0.592436678 4.075633e-01
#> 94 10 4 0.999160926 8.390738e-04
#> 95 10 5 0.227265862 7.727341e-01
#> 96 10 6 0.459737354 5.402626e-01
#> 97 10 7 0.973004605 2.699539e-02
#> 98 10 8 0.189603056 8.103969e-01
#> 99 10 9 0.396656136 6.033439e-01
#> 100 10 10 0.796565073 2.034349e-01