Dummy

Baysig quick tour: Bayesian statistical inference

This is the third document in a quick tour of the Baysig programming language, following on from Baysig quick tour: Probability distributions. The tour begins in Baysig quick tour: Fundamentals.

When we move from simple to more complex distributions, the connection to statistical modelling becomes clearer:

regress = prob
   offset  ~  uniform 1.0 5.0
   err     ~  gamma 1 1
   slope   ~  uniform (-0.5) 1.0
   xys     ~  repeat 30  ( prob x ~ uniform 0.0 1.0
                                y ~ normal (offset+slope*x) err
                                return (x,y) 
                         )
   return  xys

regress can be interpreted in two ways. It is a piece of computer code that generates some random data, in this case a list of pairs of floating-point values. It can also be read as a hierarchical probability distribution, with the individual random number generators denoting elementary probability distributions. If we view this as a statistical model for some process observed in nature, sampleing from this distribution generates simulated data.

Here's some data generated in such a way:

[ {"x": 0.06723903237544909,"y":2.0611381432093396},{"x": 0.08024228063417652,"y":1.9145274893568431},{"x": 0.08594454687227135,"y":2.13171026319092},{"x": 0.10243172782995545,"y":1.9860059527439953},{"x": 0.12695106215005533,"y":2.1305207930121477},{"x": 0.15488060730390266,"y":2.2069940520721687},{"x": 0.1986933737524537,"y":2.0765080698285057},{"x": 0.20748790055687724,"y":2.0563973623391205},{"x": 0.23725791560422116,"y":1.9341866290363365},{"x": 0.2503612868605091,"y":2.1530140882480087},{"x": 0.2799495917931082,"y":2.1645212662402322},{"x": 0.3892275456779701,"y":2.2357113855183024},{"x": 0.4291325466309517,"y":2.1767216551355397},{"x": 0.48083370818775933,"y":2.2243159108359736},{"x": 0.5455243255816223,"y":2.0841786878262165},{"x": 0.5961720800483999,"y":2.222248399110608},{"x": 0.6538586878808818,"y":2.147818580470587},{"x": 0.6734093766830418,"y":2.4017313795147497},{"x": 0.6738945938818842,"y":2.4802331986321544},{"x": 0.7105592679489775,"y":2.398466199516559},{"x": 0.741267759059851,"y":2.4125457143183002},{"x": 0.7487356876369416,"y":2.38080325555049},{"x": 0.7672041314112032,"y":2.550942798814675},{"x": 0.786474705624039,"y":2.394134784473607},{"x": 0.8576326295401977,"y":2.3682088475631975},{"x": 0.8634057356657939,"y":2.277126734113836},{"x": 0.8688925620794512,"y":2.3919115826073853},{"x": 0.9475702596706269,"y":2.5250430458101207},{"x": 0.9690038128683818,"y":2.4134941045090414},{"x": 0.9852615403908448,"y":2.5864563530730704} ]
scatterPlot theData

An experimental scientist is unlikely to be impressed. He or she is already in possession of actually observed data and has little use for "fake" data. However, because regress is a probabilistic model, we can use Bayes' Theorem to "invert" it. That is, we can combine the model and the data and derive the likely values of the unknown parameters (offset, err and slope above). To put it differently, assuming for the moment that regress is the computational process that generated the observed data, what are the most likely value to have been generated by the individual random number generators that make up regress? Inversion thus turns a model into a data analysis tool. In Bayesian terminology, the first three lines of regress denote the prior, which here is part of the model.

This operation cannot be expressed as a simple function because depends on being able to "look inside" regress, so we have defined it as a top-level action.

regrParams <* estimate regress theData

estimate returns, here in the variable regrParams, the probability distribution Bayesians call the "posterior," i.e. the distribution of the parameters given the observed data. The type of regrParams is a probability distribution over a record containing as named fields the parameters in the regress model. If we ask Baysig to print this variable, it displays the mean and the standard deviation of each variable:

regrParams ⇒ {
   offset => 1.989 ± 0.037,
   err => 0.0111 ± 0.0037,
   slope => 0.504 ± 0.063,
}

But that is an incomplete summary of the information available in this variable. This summary does not address important questions such as the shape of the posterior distribution (e.g. skew, kurtosis or multiple peaks) or correlations in the estimates of individual fields. But such information is still present in the variable regrParams. For instance, we can plot the marginal distribution of a single parameter:

2.03166 2.03761 2.03761 2.03761 2.03761 1.95225 1.97964 1.97964 2.01692 1.95465 2.0106 2.0106 2.0106 2.00183 1.98841 1.98841 1.98841 1.98841 1.90215 1.99145 1.9176 1.97989 2.02005 1.99649 1.95976 2.00735 1.99494 1.91155 1.96785 1.96785 1.92627 1.94481 1.94481 1.97052 1.95729 1.95729 1.91053 1.90367 1.90367 1.97664 1.96425 1.96425 1.95157 1.98531 1.98763 2.00301 2.00301 2.00556 2.06464 2.09775 2.00429 1.99941 1.95273 1.9373 1.98948 2.02392 2.02392 2.04672 2.02824 2.02824 1.95764 1.95764 1.95764 2.00307 1.9867 1.9867 1.9867 1.9867 1.9867 1.9867 1.97689 1.98138 1.9377 1.93103 1.96054 1.96054 1.96054 1.96054 1.95241 1.95642 1.95642 1.94097 1.95614 1.9998 1.98744 1.95733 1.95733 1.98753 1.92081 1.95978 1.95978 1.95978 1.95978 1.96326 1.97679 1.99148 1.99148 1.96507 1.96507 1.99797 2.00622 2.01648 1.99977 1.95979 1.95979 1.97932 1.9233 2.01796 2.02256 2.0179 2.00261 1.96729 1.96729 1.9135 1.89598 1.96687 1.97029 1.97029 1.9677 1.99902 2.0104 2.0104 2.00686 1.97915 1.99831 1.94579 1.93694 1.95602 1.95602 1.95602 1.94441 1.92338 1.95129 2.07321 2.00485 1.97095 1.93561 1.94551 1.96061 1.99069 1.98211 1.97541 1.98132 1.97768 1.94404 1.94404 2.00689 1.97754 2.0163 2.0163 2.0163 1.98357 1.98471 1.98471 1.98471 1.96873 1.96873 1.95383 1.93061 1.91721 1.92269 1.92336 1.93716 1.93716 1.93716 1.93716 1.93986 1.9479 1.97333 1.89025 1.9418 2.04601 1.97653 1.98062 1.9947 1.9947 1.97254 1.95792 2.002 1.98026 1.98964 2.03249 2.03249 2.02405 2.00509 2.00509 2.0137 2.01015 1.96962 1.96962 1.96962 1.96962 1.96962 1.97127 1.99432 1.99432 1.98469 1.95133 1.98903 1.95175 1.98967 2.03791 1.9849 1.9849 1.98596 1.98912 1.94854 1.92163 1.92163 1.9456 1.98801 1.96105 1.96239 2.03881 2.02138 1.98034 2.01949 2.01949 1.99898 2.00389 2.00192 2.00192 2.00192 2.02442 2.02442 2.02442 2.02442 2.00168 2.00168 2.00168 1.99745 1.93279 1.97412 1.97412 1.95574 1.96701 1.96618 1.96618 2.04826 2.04826 1.93185 1.95476 1.93827 1.93827 1.93827 1.99907 1.94685 1.95829 1.96807 1.92325 1.94751 1.94751 1.9963 2.02907 2.02907 2.02907 2.02907 1.97746 1.97746 1.97746 1.97746 1.97746 1.96419 1.96419 1.96419 1.96419 1.97111 1.98791 1.98791 2.01267 2.01267 2.01267 1.98836 1.97004 1.97004 1.97398 2.00931 2.00931 2.00931 2.02276 2.04409 2.04409 2.04409 2.05337 2.05337 2.06481 2.03753 2.021 2.021 2.021 1.98337 2.05817 1.99252 2.03065 2.03158 2.06704 2.04489 2.04489 2.04489 2.0144 2.01348 2.02858 2.06124 2.03205 2.03205 1.97525 1.97906 1.99406 1.95428 1.96959 2.00053 2.00053 1.95465 1.9551 1.9551 1.99161 1.99161 1.99161 1.97878 1.98864 1.98864 1.99627 1.99627 1.99627 1.99627 1.99557 1.99557 2.00548 2.00548 2.01712 2.01712 2.0088 2.00548 1.99295 1.96745 1.96745 1.96745 1.99799 1.99799 1.99799 1.99799 1.98889 1.98889 1.99504 2.00551 1.99525 1.99525 1.99525 1.98746 1.98746 1.98746 2.00794 2.00794 1.94538 2.01155 2.01155 2.01155 2.01155 2.01155 1.99752 1.95761 1.93841 1.93758 1.93758 1.99483 1.99436 1.99436 1.99436 2.00659 1.97013 1.9448 1.9853 1.96448 1.96448 1.98521 1.97093 1.97093 1.94245 1.95467 1.95985 1.95985 1.90867 1.94044 1.97453 1.9527 2.08967 2.08967 2.08976 2.01311 1.98947 2.00046 1.97912 1.98396 1.96871 1.94897 1.94897 1.93654 1.95491 1.95491 1.95491 2.01789 1.96034 1.98356 1.97646 1.94752 1.99421 1.9628 1.9628 2.05763 2.05763 2.01075 2.01075 1.98034 1.98034 1.98034 2.02854 2.01907 2.01907 1.9876 2.0368 2.02928 2.02928 2.02928 2.04211 2.04211 2.04211 1.9181 1.91674 1.86715 1.90424 2.00442 1.99117 1.98293 2.0274 2.00673 2.00673 2.00673 2.00127 1.93327 1.97137 1.94852 1.95782 1.9943 1.96548 2.00743 2.00743 1.97925 1.97925 1.97951 2.01678 2.06232 2.04335 2.02364 2.08665 2.0639 2.04873 2.04873 1.99445 1.99445 1.98762 2.03274 2.03274 1.94242 2.05439 2.05439 2.05711 2.05711 2.05711 2.06504 2.06504 2.07114 2.08596 2.08688 2.06606 2.06606 2.08231 2.04868 2.03058 2.03496 1.98999 1.93149 1.93149 2.03339 1.96531 1.96848 1.96848 1.98866 2.01007 2.01007 2.01007 2.01007 1.9993 1.9993 1.9993 1.9993 1.9993 2.00513 2.00513 1.96549 2.01328 1.96328 1.96328 2.03259 1.9741 1.97548 2.04511 2.03664 2.03664 2.03664 2.03356 2.04104 2.04104 2.04104 2.04104 1.99164 1.98361 1.98361 1.98361 1.95394 1.95528 1.96478 1.97591 1.92863 1.95235 1.91493 1.91493 2.00952 2.04844 2.09259 2.09259 2.09259 1.95114 1.95114 2.00743 1.98711 1.95941 1.96069 1.88356 1.88356 1.88356 2.09332 1.96306 1.9451 1.9451 1.96022 1.96639 1.9452 1.9452 1.98711 1.98803 1.98803 2.00953 2.02632 1.9941 1.97501 1.96535 1.96535 1.96918 1.96918 1.96286 1.96286 2.00122 1.98805 1.96237 1.95745 1.9079 1.92426 1.94257 1.97917 2.02504 1.94602 2.03428 2.02977 1.98859 2.00473 1.95665 1.95481 1.9566 1.9566 1.95162 1.95408 1.95408 1.89984 1.90708 1.93244 1.92042 1.98034 1.93425 1.92941 1.92941 1.92941 1.9617 1.99254 1.97335 1.98301 1.98301 1.98301 1.98301 1.98301 1.98301 1.98949 1.98109 1.95636 1.97299 1.99128 1.99128 2.01036 2.00345 2.00345 1.97867 1.99619 2.00248 2.00248 1.97126 1.97126 1.96746 1.96746 1.99934 1.96 2.01342 2.0017 1.98158 2.00792 2.01418 2.00648 1.96381 2 1.96326 1.97821 1.99794 1.98407 1.99694 2.03843 2.01637 1.98478 1.95011 2.01763 2.01763 1.9931 2.00197 2.02661 2.00928 1.97945 1.97945 1.99715 1.99715 1.93256 1.96199 1.96085 1.96085 1.96085 1.9919 1.9919 1.9919 1.98762 1.99241 1.99241 2.0381 1.99192 1.98357 1.98357 1.95685 2.02123 2.02278 1.94922 1.94922 1.94922 2.04441 2.04769 2.04769 2.00788 2.00788 1.98555 1.94479 1.94479 1.94479 1.99037 1.99037 1.96861 1.96861 1.96861 1.96861 1.96296 1.96296 1.96296 1.96296 1.93363 1.94388 1.94773 1.99547 1.96952 1.93993 2.02689 2.02277 1.98687 2.0218 1.95191 1.95191 1.95191 1.95191 1.94349 1.9435 1.95829 1.99919 2.00343 2.03892 2.0234 2.0234 2.01363 2.01157 1.98689 2.05188 2.05188 2.05188 2.09166 2.09166 2.09166 2.06231 2.06231 2.01923 1.99439 1.99439 1.98872 1.9824 2.03356 2.00685 2.01376 2.0038 1.97871 2.00303 2.00254 2.00254 2.03474 2.02323 1.91036 2.06721 2.01869 2.07515 1.99846 2.04239 2.01864 1.9087 1.90044 1.93963 1.93963 2.03939 1.96182 1.96182 1.96182 1.96182 2.02077 1.99068 1.97626 2.00931 2.00931 1.99036 2.05338 2.02081 1.98919 1.92831 1.94265 1.95263 1.96326 1.96326 1.96326 1.96326 1.96326 1.96326 2.00071 2.00071 1.98544 1.97502 1.97502 1.97502 1.97502 1.97502 1.98821 2.00692 1.98402 1.94041 1.94041 1.94041 1.94041 1.94041 1.93639 1.96037 1.94635 1.98864 1.98864 1.98864 1.98656 1.98656 1.96088 1.96088 1.96088 1.96088 1.96088 1.96271 1.96271 1.96271 1.96749 1.96749 2.01641 1.96211 1.9605 1.97152 2.00349 2.00349 2.01191 2.04542 2.06759 2.00283 1.94874 1.93323 1.98908 1.99735 1.98893 1.98893 1.99592 2.03069 2.03069 2.03069 2.03069 1.98567 1.97594 1.98728 1.97245 1.96561 2.02489 2.02732 1.95396 1.99203 1.99203 1.97637 1.95775 1.93392 1.97778 1.95133 1.96639 1.97883 1.97485 1.97485 1.97485 1.97485 1.95556 1.95976 2.01637 1.99287 1.99287 1.93158 1.9893 1.9893 2.01796 1.98438 1.99619 1.99619 1.99619 2.02037 1.92626 1.9278 1.98139 2.01707 2.01707 1.9973 2.01062 2.01062 2.01062 2.01062 2.01062 2.01062 2.01062 2.00624 2.00624 2.00654 2.00654 2.00654 2.04111 2.04111 2.02022 1.95006 1.97768 1.97642 1.98707 1.99778 1.99778 1.97658 1.97658 1.97658 2.00868 2.00938 2.01419 2.05063 1.93506 1.97098 1.95702 1.97823 1.97823 1.97827 1.9869 1.96921 2.02236 2.06116 1.99775 1.99672 1.99427 1.98523 2.00677 2.00677 2.00677 2.04952 2.02074 2.0188 2.0188 1.98046 1.98046 1.98046 1.94534 2.00549 1.99749 1.95269 1.98372 1.98428 1.92119 1.96446 2.04959 2.05489 2.05489 2.0693 2.05336 2.05336 2.04056 2.04056 2.03271 2.07621 2.02275 2.01694 1.98612 1.98612 1.98612 1.98612 1.96911 1.99391 2.01194 2.01988 1.95246 1.92177 1.98067 2.01261 2.00551 2.00558 2.02506 1.99427 1.98559 1.98559 1.94889 1.94889 1.94889 2.00746 2.00703 2.00703 1.98624 1.98715 2.0242 2.0242 1.97767 1.94794 2.00147 2.04488 2.01855 2.01855 2.02583 2.01746 1.97585 1.96167 1.96167 2.00117 2.00117 2.00117 2.00117 1.98224 1.97454 1.98649 1.98649 1.98649 1.98283 1.99044 1.98981 2.03355 2.05532 2.05532 2.05532 1.99542 2.03509 2.03037 2.06938 2.06938 2.02094 2.00812 2.00812
distPlot (with regrParams offset)

or a scatter plot of samples from the estimates of two parameters

[ {"x": 0.308167,"y":2.08976},{"x": 0.319946,"y":2.08688},{"x": 0.319946,"y":2.08688},{"x": 0.320658,"y":2.09259},{"x": 0.320658,"y":2.09259},{"x": 0.331438,"y":2.08231},{"x": 0.349021,"y":2.06231},{"x": 0.355814,"y":2.06504},{"x": 0.369577,"y":2.06938},{"x": 0.379116,"y":2.03496},{"x": 0.379634,"y":2.04959},{"x": 0.384571,"y":2.04409},{"x": 0.384571,"y":2.04409},{"x": 0.384571,"y":2.04409},{"x": 0.385302,"y":2.03158},{"x": 0.385302,"y":2.03158},{"x": 0.395647,"y":2.04056},{"x": 0.395647,"y":2.04056},{"x": 0.396243,"y":2.03166},{"x": 0.396424,"y":2.021},{"x": 0.396424,"y":2.021},{"x": 0.399341,"y":2.06606},{"x": 0.401801,"y":2.04111},{"x": 0.401801,"y":2.04111},{"x": 0.402153,"y":2.04239},{"x": 0.403601,"y":2.05817},{"x": 0.404174,"y":2.02858},{"x": 0.404427,"y":2.05711},{"x": 0.404427,"y":2.05711},{"x": 0.404802,"y":2.03664},{"x": 0.404802,"y":2.03664},{"x": 0.404802,"y":2.03664},{"x": 0.406864,"y":2.02323},{"x": 0.407547,"y":2.05489},{"x": 0.408504,"y":2.04873},{"x": 0.416187,"y":2.03761},{"x": 0.416187,"y":2.03761},{"x": 0.417678,"y":2.07515},{"x": 0.417678,"y":2.07515},{"x": 0.421841,"y":2.04211},{"x": 0.422558,"y":2.05439},{"x": 0.422558,"y":2.05439},{"x": 0.428087,"y":2.03065},{"x": 0.42836,"y":2.04511},{"x": 0.428381,"y":2.02123},{"x": 0.428381,"y":2.02123},{"x": 0.428761,"y":2.02392},{"x": 0.430463,"y":2.02824},{"x": 0.430463,"y":2.02824},{"x": 0.430463,"y":2.02824},{"x": 0.43144,"y":2.00509},{"x": 0.432279,"y":2.04104},{"x": 0.432279,"y":2.04104},{"x": 0.432279,"y":2.04104},{"x": 0.432868,"y":2.05763},{"x": 0.432868,"y":2.05763},{"x": 0.432868,"y":2.05763},{"x": 0.432868,"y":2.05763},{"x": 0.433586,"y":2.0234},{"x": 0.433586,"y":2.0234},{"x": 0.434971,"y":2.00677},{"x": 0.435077,"y":2.02022},{"x": 0.43586,"y":2.02907},{"x": 0.435976,"y":2.00556},{"x": 0.436964,"y":2.05336},{"x": 0.436964,"y":2.05336},{"x": 0.437625,"y":1.99694},{"x": 0.439034,"y":2.00673},{"x": 0.439034,"y":2.00673},{"x": 0.439034,"y":2.00673},{"x": 0.439313,"y":2.05532},{"x": 0.439313,"y":2.05532},{"x": 0.439669,"y":2.03249},{"x": 0.439787,"y":2.02278},{"x": 0.441857,"y":2.05188},{"x": 0.441857,"y":2.05188},{"x": 0.441975,"y":2.07621},{"x": 0.441975,"y":2.07621},{"x": 0.442683,"y":2.0368},{"x": 0.446844,"y":2.00548},{"x": 0.44709,"y":2.03069},{"x": 0.44709,"y":2.03069},{"x": 0.44709,"y":2.03069},{"x": 0.44709,"y":2.03069},{"x": 0.44709,"y":2.03069},{"x": 0.44709,"y":2.03069},{"x": 0.449316,"y":1.9931},{"x": 0.451261,"y":2.00389},{"x": 0.451383,"y":1.95133},{"x": 0.451383,"y":1.95133},{"x": 0.451383,"y":1.95133},{"x": 0.452228,"y":2.03791},{"x": 0.453467,"y":2.04489},{"x": 0.453585,"y":2.02977},{"x": 0.45444,"y":2.00197},{"x": 0.45444,"y":2.00197},{"x": 0.45444,"y":2.00197},{"x": 0.454682,"y":2.02037},{"x": 0.455314,"y":1.98841},{"x": 0.455314,"y":1.98841},{"x": 0.455314,"y":1.98841},{"x": 0.455314,"y":1.98841},{"x": 0.45647,"y":1.97653},{"x": 0.456969,"y":2.00931},{"x": 0.458625,"y":2.02732},{"x": 0.459685,"y":2.00953},{"x": 0.461019,"y":2.00429},{"x": 0.461961,"y":1.99439},{"x": 0.462869,"y":2.00812},{"x": 0.463368,"y":1.98062},{"x": 0.463368,"y":1.98062},{"x": 0.463581,"y":1.99037},{"x": 0.463634,"y":2.01311},{"x": 0.464058,"y":2.01363},{"x": 0.464078,"y":2.01864},{"x": 0.464854,"y":1.99161},{"x": 0.464854,"y":1.99161},{"x": 0.464866,"y":1.96873},{"x": 0.465374,"y":1.99427},{"x": 0.466315,"y":2.00548},{"x": 0.466315,"y":2.00548},{"x": 0.466473,"y":2.00343},{"x": 0.466473,"y":2.00343},{"x": 0.466473,"y":2.00343},{"x": 0.466764,"y":2.01328},{"x": 0.466764,"y":2.01328},{"x": 0.466939,"y":2.0038},{"x": 0.467053,"y":2.03881},{"x": 0.467318,"y":2.00794},{"x": 0.467318,"y":2.00794},{"x": 0.467503,"y":2.03339},{"x": 0.469124,"y":1.98762},{"x": 0.469935,"y":2.02661},{"x": 0.470342,"y":1.97989},{"x": 0.470603,"y":1.9605},{"x": 0.471048,"y":2.04601},{"x": 0.471282,"y":1.97878},{"x": 0.47167,"y":2.00254},{"x": 0.472464,"y":2.01763},{"x": 0.472464,"y":2.01763},{"x": 0.472594,"y":2.01712},{"x": 0.472876,"y":1.98791},{"x": 0.473205,"y":2.03259},{"x": 0.473205,"y":2.03259},{"x": 0.473355,"y":1.99831},{"x": 0.473369,"y":1.99619},{"x": 0.473378,"y":2.0179},{"x": 0.474519,"y":2.01707},{"x": 0.476154,"y":2.02081},{"x": 0.476649,"y":1.97912},{"x": 0.476771,"y":1.99547},{"x": 0.476808,"y":1.98908},{"x": 0.47716,"y":1.98872},{"x": 0.47859,"y":2.00551},{"x": 0.480153,"y":1.97095},{"x": 0.480153,"y":1.97095},{"x": 0.480251,"y":1.97335},{"x": 0.480575,"y":1.9824},{"x": 0.480575,"y":1.9824},{"x": 0.481178,"y":1.95574},{"x": 0.481178,"y":1.95574},{"x": 0.481836,"y":1.9963},{"x": 0.481982,"y":1.97754},{"x": 0.482801,"y":1.98864},{"x": 0.483171,"y":2.01062},{"x": 0.483171,"y":2.01062},{"x": 0.483171,"y":2.01062},{"x": 0.483265,"y":2.01261},{"x": 0.483736,"y":2.00703},{"x": 0.485929,"y":2.0163},{"x": 0.486329,"y":1.9993},{"x": 0.486329,"y":1.9993},{"x": 0.486329,"y":1.9993},{"x": 0.48692,"y":2.03428},{"x": 0.48692,"y":2.03428},{"x": 0.48736,"y":2.01157},{"x": 0.487744,"y":2.00743},{"x": 0.487744,"y":2.00743},{"x": 0.488696,"y":1.97658},{"x": 0.488696,"y":1.97658},{"x": 0.489046,"y":2.01923},{"x": 0.489425,"y":2.03355},{"x": 0.489425,"y":2.03355},{"x": 0.489425,"y":2.03355},{"x": 0.489604,"y":2.01194},{"x": 0.489604,"y":2.01194},{"x": 0.490011,"y":2.0106},{"x": 0.490011,"y":2.0106},{"x": 0.490054,"y":2.02506},{"x": 0.490669,"y":1.99778},{"x": 0.490669,"y":1.99778},{"x": 0.490993,"y":1.98612},{"x": 0.491118,"y":1.96618},{"x": 0.491118,"y":1.96618},{"x": 0.491118,"y":1.96618},{"x": 0.491478,"y":1.93561},{"x": 0.491552,"y":2.01796},{"x": 0.491552,"y":2.01796},{"x": 0.491552,"y":2.01796},{"x": 0.491816,"y":2.00168},{"x": 0.49205,"y":1.9893},{"x": 0.492061,"y":1.97867},{"x": 0.492826,"y":1.98026},{"x": 0.492917,"y":1.94889},{"x": 0.492917,"y":1.94889},{"x": 0.492917,"y":1.94889},{"x": 0.492917,"y":1.94889},{"x": 0.492968,"y":2.01007},{"x": 0.492968,"y":2.01007},{"x": 0.492968,"y":2.01007},{"x": 0.493345,"y":1.98544},{"x": 0.493345,"y":1.98544},{"x": 0.493541,"y":1.98438},{"x": 0.494366,"y":1.97004},{"x": 0.49505,"y":2.02632},{"x": 0.49505,"y":2.02632},{"x": 0.496642,"y":1.97823},{"x": 0.497044,"y":1.98034},{"x": 0.497134,"y":1.98763},{"x": 0.497485,"y":2.0242},{"x": 0.497485,"y":2.0242},{"x": 0.497485,"y":2.0242},{"x": 0.498305,"y":1.97642},{"x": 0.499478,"y":1.95733},{"x": 0.499478,"y":1.95733},{"x": 0.499539,"y":1.99252},{"x": 0.50043,"y":1.9867},{"x": 0.50043,"y":1.9867},{"x": 0.50043,"y":1.9867},{"x": 0.50043,"y":1.9867},{"x": 0.500476,"y":1.98711},{"x": 0.500476,"y":1.98711},{"x": 0.500791,"y":1.95465},{"x": 0.500791,"y":1.95465},{"x": 0.500796,"y":1.99619},{"x": 0.500796,"y":1.99619},{"x": 0.500796,"y":1.99619},{"x": 0.50101,"y":2.0104},{"x": 0.501262,"y":2.03509},{"x": 0.501478,"y":1.99649},{"x": 0.50175,"y":1.97485},{"x": 0.503304,"y":1.96531},{"x": 0.50358,"y":2},{"x": 0.50358,"y":2},{"x": 0.50358,"y":2},{"x": 0.50358,"y":2},{"x": 0.503614,"y":1.97906},{"x": 0.503701,"y":1.97453},{"x": 0.503701,"y":1.97453},{"x": 0.505814,"y":2.01191},{"x": 0.506345,"y":1.99445},{"x": 0.507811,"y":2.01789},{"x": 0.507811,"y":2.01789},{"x": 0.508481,"y":1.98656},{"x": 0.508807,"y":1.98947},{"x": 0.509157,"y":1.98372},{"x": 0.509157,"y":1.98372},{"x": 0.50948,"y":1.98801},{"x": 0.509811,"y":1.98471},{"x": 0.509814,"y":1.9973},{"x": 0.510325,"y":1.97917},{"x": 0.510325,"y":1.97917},{"x": 0.510325,"y":1.97917},{"x": 0.510637,"y":1.97126},{"x": 0.510717,"y":1.98428},{"x": 0.510753,"y":2.00624},{"x": 0.510753,"y":2.00624},{"x": 0.510753,"y":2.00624},{"x": 0.511494,"y":2.04952},{"x": 0.511494,"y":2.04952},{"x": 0.511494,"y":2.04952},{"x": 0.511742,"y":1.99799},{"x": 0.512303,"y":2.0017},{"x": 0.51261,"y":1.9876},{"x": 0.512672,"y":1.9418},{"x": 0.512885,"y":2.00349},{"x": 0.512885,"y":2.00349},{"x": 0.513009,"y":1.9551},{"x": 0.513203,"y":2.01015},{"x": 0.513367,"y":1.96507},{"x": 0.513367,"y":1.96507},{"x": 0.513367,"y":1.96507},{"x": 0.515828,"y":1.97746},{"x": 0.515828,"y":1.97746},{"x": 0.515828,"y":1.97746},{"x": 0.515832,"y":2.00301},{"x": 0.515832,"y":2.00301},{"x": 0.516197,"y":1.96745},{"x": 0.516393,"y":1.97111},{"x": 0.516393,"y":1.97111},{"x": 0.516479,"y":1.99977},{"x": 0.51691,"y":1.99203},{"x": 0.51691,"y":1.99203},{"x": 0.517362,"y":1.98396},{"x": 0.517406,"y":2.01692},{"x": 0.517406,"y":2.01692},{"x": 0.517676,"y":1.97915},{"x": 0.518063,"y":1.9919},{"x": 0.518063,"y":1.9919},{"x": 0.518643,"y":1.98866},{"x": 0.518891,"y":1.96729},{"x": 0.518891,"y":1.96729},{"x": 0.518891,"y":1.96729},{"x": 0.519126,"y":1.99902},{"x": 0.519203,"y":1.98361},{"x": 0.519203,"y":1.98361},{"x": 0.519203,"y":1.98361},{"x": 0.519203,"y":1.98361},{"x": 0.519203,"y":1.98361},{"x": 0.519314,"y":1.97127},{"x": 0.519664,"y":1.97768},{"x": 0.520274,"y":1.98357},{"x": 0.520861,"y":1.96561},{"x": 0.52088,"y":1.98034},{"x": 0.52088,"y":1.98034},{"x": 0.521567,"y":1.96962},{"x": 0.521906,"y":2.00117},{"x": 0.521944,"y":2.01949},{"x": 0.523039,"y":1.97013},{"x": 0.523304,"y":1.98889},{"x": 0.52384,"y":1.96182},{"x": 0.5242,"y":1.98555},{"x": 0.524519,"y":1.99627},{"x": 0.524519,"y":1.99627},{"x": 0.525271,"y":1.98301},{"x": 0.525271,"y":1.98301},{"x": 0.525271,"y":1.98301},{"x": 0.525271,"y":1.98301},{"x": 0.525271,"y":1.98301},{"x": 0.525271,"y":1.98301},{"x": 0.525497,"y":1.98559},{"x": 0.525677,"y":1.95764},{"x": 0.525677,"y":1.95764},{"x": 0.52594,"y":1.96478},{"x": 0.525953,"y":1.94751},{"x": 0.526255,"y":1.97964},{"x": 0.526585,"y":1.99287},{"x": 0.52717,"y":1.96749},{"x": 0.52717,"y":1.96749},{"x": 0.527901,"y":1.99241},{"x": 0.527913,"y":1.96448},{"x": 0.52805,"y":1.96088},{"x": 0.52805,"y":1.96088},{"x": 0.528139,"y":2.00622},{"x": 0.528293,"y":1.98567},{"x": 0.528293,"y":1.98567},{"x": 0.529302,"y":1.96952},{"x": 0.529629,"y":1.97502},{"x": 0.529629,"y":1.97502},{"x": 0.529629,"y":1.97502},{"x": 0.529629,"y":1.97502},{"x": 0.529629,"y":1.97502},{"x": 0.529629,"y":1.97502},{"x": 0.529958,"y":1.98903},{"x": 0.529958,"y":1.98903},{"x": 0.529958,"y":1.98903},{"x": 0.530576,"y":1.99295},{"x": 0.531195,"y":1.96419},{"x": 0.531195,"y":1.96419},{"x": 0.531195,"y":1.96419},{"x": 0.53157,"y":1.99794},{"x": 0.531667,"y":1.99745},{"x": 0.531979,"y":1.99069},{"x": 0.534255,"y":1.98744},{"x": 0.534888,"y":2.00122},{"x": 0.534907,"y":1.9869},{"x": 0.53503,"y":1.96326},{"x": 0.53503,"y":1.96326},{"x": 0.53503,"y":1.96326},{"x": 0.53503,"y":1.96326},{"x": 0.537846,"y":1.95467},{"x": 0.538471,"y":1.95011},{"x": 0.540483,"y":1.93185},{"x": 0.541162,"y":1.99148},{"x": 0.541327,"y":1.95976},{"x": 0.541455,"y":1.98067},{"x": 0.544172,"y":1.96549},{"x": 0.544802,"y":1.95556},{"x": 0.544981,"y":1.96328},{"x": 0.544981,"y":1.96328},{"x": 0.545702,"y":1.92941},{"x": 0.545702,"y":1.92941},{"x": 0.545702,"y":1.92941},{"x": 0.545702,"y":1.92941},{"x": 0.548316,"y":1.97768},{"x": 0.548456,"y":1.94602},{"x": 0.549196,"y":1.98356},{"x": 0.54994,"y":1.96054},{"x": 0.54994,"y":1.96054},{"x": 0.54994,"y":1.96054},{"x": 0.550637,"y":1.9278},{"x": 0.550638,"y":1.95979},{"x": 0.550833,"y":1.97093},{"x": 0.55191,"y":1.95191},{"x": 0.552677,"y":1.93827},{"x": 0.552677,"y":1.93827},{"x": 0.552677,"y":1.93827},{"x": 0.552677,"y":1.93827},{"x": 0.553731,"y":1.99483},{"x": 0.554339,"y":1.96548},{"x": 0.554412,"y":1.98836},{"x": 0.554412,"y":1.98836},{"x": 0.554431,"y":1.94897},{"x": 0.554844,"y":1.98357},{"x": 0.556743,"y":1.95465},{"x": 0.556871,"y":1.96167},{"x": 0.556955,"y":1.93694},{"x": 0.557581,"y":1.93327},{"x": 0.557929,"y":1.99128},{"x": 0.557929,"y":1.99128},{"x": 0.558939,"y":1.98521},{"x": 0.55943,"y":1.95225},{"x": 0.559889,"y":1.93392},{"x": 0.559889,"y":1.93392},{"x": 0.560002,"y":1.95269},{"x": 0.560204,"y":1.94852},{"x": 0.560231,"y":1.96326},{"x": 0.560873,"y":1.97254},{"x": 0.561371,"y":1.98034},{"x": 0.561591,"y":1.97454},{"x": 0.561591,"y":1.97454},{"x": 0.562031,"y":1.97778},{"x": 0.562654,"y":1.93323},{"x": 0.564707,"y":1.98046},{"x": 0.566861,"y":1.96},{"x": 0.568355,"y":1.97679},{"x": 0.568355,"y":1.96037},{"x": 0.569648,"y":1.95408},{"x": 0.569901,"y":1.96237},{"x": 0.570349,"y":1.94404},{"x": 0.570349,"y":1.94404},{"x": 0.570349,"y":1.94404},{"x": 0.571518,"y":1.96848},{"x": 0.571518,"y":1.96848},{"x": 0.571967,"y":1.92081},{"x": 0.572753,"y":1.96061},{"x": 0.572753,"y":1.96061},{"x": 0.572837,"y":1.90708},{"x": 0.574131,"y":1.96785},{"x": 0.574131,"y":1.96785},{"x": 0.574131,"y":1.96785},{"x": 0.576324,"y":1.93963},{"x": 0.576324,"y":1.93963},{"x": 0.577987,"y":1.94922},{"x": 0.577987,"y":1.94922},{"x": 0.57805,"y":1.9566},{"x": 0.579367,"y":1.96921},{"x": 0.579367,"y":1.96921},{"x": 0.580235,"y":1.94242},{"x": 0.581034,"y":1.96535},{"x": 0.581365,"y":1.94479},{"x": 0.581365,"y":1.94479},{"x": 0.582789,"y":1.95396},{"x": 0.582789,"y":1.95396},{"x": 0.583129,"y":1.93103},{"x": 0.583172,"y":1.95602},{"x": 0.583172,"y":1.95602},{"x": 0.585057,"y":1.95665},{"x": 0.585205,"y":1.94044},{"x": 0.585205,"y":1.94044},{"x": 0.586626,"y":1.94265},{"x": 0.587516,"y":1.91053},{"x": 0.588314,"y":1.97137},{"x": 0.588314,"y":1.97137},{"x": 0.588565,"y":1.94441},{"x": 0.588565,"y":1.94441},{"x": 0.588904,"y":1.92336},{"x": 0.590524,"y":1.92325},{"x": 0.590524,"y":1.92325},{"x": 0.591009,"y":1.95642},{"x": 0.591216,"y":1.95528},{"x": 0.592988,"y":1.95263},{"x": 0.59689,"y":1.91493},{"x": 0.598935,"y":1.93639},{"x": 0.599715,"y":1.92831},{"x": 0.602284,"y":1.9176},{"x": 0.602284,"y":1.9176},{"x": 0.606945,"y":1.95246},{"x": 0.608268,"y":1.94481},{"x": 0.608268,"y":1.94481},{"x": 0.60863,"y":1.94041},{"x": 0.60863,"y":1.94041},{"x": 0.609916,"y":1.89984},{"x": 0.613027,"y":1.93716},{"x": 0.62521,"y":1.90867},{"x": 0.62521,"y":1.90867},{"x": 0.62521,"y":1.90867},{"x": 0.62623,"y":1.91674},{"x": 0.628293,"y":1.95383},{"x": 0.629029,"y":1.90424},{"x": 0.630233,"y":1.93279},{"x": 0.630981,"y":1.89598},{"x": 0.630981,"y":1.89598},{"x": 0.637108,"y":1.9135},{"x": 0.639338,"y":1.90044},{"x": 0.640467,"y":1.93986},{"x": 0.640467,"y":1.93986},{"x": 0.640467,"y":1.93986},{"x": 0.674261,"y":1.88356},{"x": 0.698669,"y":1.90367} ]
scatterPlot scatter

Therefore, non-Gaussian distribution shape and correlation between parameters are retained in the output of estimate. Perhaps more fundamentally, regrParams is a probability distribution and can be sampled from in order to form further probability distributions. with, as defined above, is a thin layer of syntactical sugar for doing this.

Classical statistics invites us to consider whether model parameters are "significant" by evaluating the probability that certain statistics (calculations from the data) exceed the observed statistic in a model (the "null model" or "null hypothesis") in which said model parameter equals exactly zero. That sounds convoluted -- it is convoluted and almost impossible to interpret for complex models -- and it tells us nothing about the probability that the parameter really is zero. In the Bayesian approach, we directly ask the question: could this parameter possibly be zero? So we draw out the distribution of the parameter given the data. For instance, we might be interested in whether the slope in the regress model could possibly be zero (no correlation):

0.396243 0.416187 0.416187 0.416187 0.416187 0.55943 0.526255 0.526255 0.517406 0.556743 0.490011 0.490011 0.490011 0.518382 0.455314 0.455314 0.455314 0.455314 0.604864 0.578068 0.602284 0.470342 0.438097 0.501478 0.541327 0.46468 0.449579 0.59504 0.574131 0.574131 0.591942 0.608268 0.608268 0.527175 0.523872 0.523872 0.587516 0.698669 0.698669 0.534249 0.506978 0.506978 0.514496 0.552549 0.497134 0.515832 0.515832 0.435976 0.331228 0.382127 0.461019 0.460885 0.569136 0.550564 0.486849 0.428761 0.428761 0.424765 0.430463 0.430463 0.525677 0.525677 0.525677 0.513186 0.50043 0.50043 0.50043 0.50043 0.50043 0.50043 0.474017 0.496412 0.547298 0.583129 0.54994 0.54994 0.54994 0.54994 0.558615 0.591009 0.591009 0.55874 0.574014 0.517234 0.534255 0.499478 0.499478 0.538052 0.571967 0.533245 0.533245 0.533245 0.533245 0.560231 0.568355 0.541162 0.541162 0.513367 0.513367 0.48498 0.528139 0.426658 0.516479 0.550638 0.550638 0.571275 0.558617 0.491552 0.465479 0.473378 0.507 0.518891 0.518891 0.637108 0.630981 0.574415 0.540442 0.540442 0.462641 0.519126 0.50101 0.50101 0.483053 0.517676 0.473355 0.584914 0.556955 0.583172 0.583172 0.583172 0.588565 0.605026 0.577972 0.377946 0.494414 0.480153 0.491478 0.552379 0.572753 0.531979 0.546795 0.53663 0.515999 0.519664 0.570349 0.570349 0.525839 0.481982 0.485929 0.485929 0.485929 0.554844 0.509811 0.509811 0.509811 0.464866 0.464866 0.628293 0.642553 0.555188 0.693634 0.588904 0.613027 0.613027 0.613027 0.613027 0.640467 0.513701 0.569503 0.624151 0.512672 0.471048 0.45647 0.463368 0.539847 0.539847 0.560873 0.49442 0.565922 0.492826 0.434126 0.439669 0.439669 0.48004 0.43144 0.43144 0.421379 0.513203 0.521567 0.521567 0.521567 0.521567 0.521567 0.519314 0.540149 0.540149 0.543164 0.451383 0.529958 0.556525 0.504981 0.452228 0.523695 0.523695 0.542254 0.561705 0.604192 0.60335 0.60335 0.56902 0.50948 0.539786 0.579731 0.467053 0.510197 0.497044 0.521944 0.521944 0.494785 0.451261 0.512671 0.512671 0.512671 0.434794 0.434794 0.434794 0.434794 0.491816 0.491816 0.491816 0.531667 0.630233 0.487363 0.487363 0.481178 0.508452 0.491118 0.491118 0.35317 0.35317 0.540483 0.562731 0.552677 0.552677 0.552677 0.542434 0.574109 0.597228 0.556811 0.590524 0.525953 0.525953 0.481836 0.43586 0.43586 0.43586 0.43586 0.515828 0.515828 0.515828 0.515828 0.515828 0.531195 0.531195 0.531195 0.531195 0.516393 0.472876 0.472876 0.518267 0.518267 0.518267 0.554412 0.494366 0.494366 0.555768 0.456969 0.456969 0.456969 0.481761 0.384571 0.384571 0.384571 0.365808 0.365808 0.369725 0.422357 0.396424 0.396424 0.396424 0.468262 0.403601 0.499539 0.428087 0.385302 0.364366 0.453467 0.453467 0.453467 0.459929 0.493952 0.404174 0.417572 0.380437 0.380437 0.543111 0.503614 0.485264 0.550108 0.519681 0.539656 0.539656 0.500791 0.513009 0.513009 0.464854 0.464854 0.464854 0.471282 0.550117 0.550117 0.524519 0.524519 0.524519 0.524519 0.472281 0.472281 0.466315 0.466315 0.472594 0.472594 0.427192 0.446844 0.530576 0.516197 0.516197 0.516197 0.511742 0.511742 0.511742 0.511742 0.523304 0.523304 0.50631 0.501719 0.458988 0.458988 0.458988 0.509312 0.509312 0.509312 0.467318 0.467318 0.547306 0.483367 0.483367 0.483367 0.483367 0.483367 0.497496 0.556984 0.565584 0.533947 0.533947 0.553731 0.466826 0.466826 0.466826 0.492844 0.523039 0.541165 0.535833 0.527913 0.527913 0.558939 0.550833 0.550833 0.566601 0.537846 0.574873 0.574873 0.62521 0.585205 0.503701 0.576979 0.343416 0.343416 0.308167 0.463634 0.508807 0.518266 0.476649 0.517362 0.550609 0.554431 0.554431 0.569271 0.59435 0.59435 0.59435 0.507811 0.510689 0.549196 0.580493 0.517202 0.517135 0.502678 0.502678 0.432868 0.432868 0.529741 0.529741 0.52088 0.52088 0.52088 0.472907 0.422141 0.422141 0.51261 0.442683 0.420327 0.420327 0.420327 0.421841 0.421841 0.421841 0.632287 0.62623 0.709413 0.629029 0.462128 0.482258 0.517545 0.484184 0.439034 0.439034 0.439034 0.431244 0.557581 0.588314 0.560204 0.57612 0.514019 0.554339 0.487744 0.487744 0.498197 0.498197 0.500844 0.455831 0.42369 0.378718 0.422775 0.40468 0.364353 0.408504 0.408504 0.506345 0.506345 0.516277 0.440995 0.440995 0.580235 0.422558 0.422558 0.404427 0.404427 0.404427 0.355814 0.355814 0.348212 0.364507 0.319946 0.399341 0.399341 0.331438 0.32709 0.402219 0.379116 0.458028 0.58521 0.58521 0.467503 0.503304 0.571518 0.571518 0.518643 0.492968 0.492968 0.492968 0.492968 0.486329 0.486329 0.486329 0.486329 0.486329 0.489818 0.489818 0.544172 0.466764 0.544981 0.544981 0.473205 0.566991 0.512778 0.42836 0.404802 0.404802 0.404802 0.429819 0.432279 0.432279 0.432279 0.432279 0.461468 0.519203 0.519203 0.519203 0.53896 0.591216 0.52594 0.512105 0.596176 0.57575 0.59689 0.59689 0.50827 0.37351 0.320658 0.320658 0.320658 0.553751 0.553751 0.468966 0.525874 0.560447 0.562891 0.674261 0.674261 0.674261 0.311306 0.477267 0.580093 0.580093 0.537775 0.560377 0.54928 0.54928 0.500476 0.507009 0.507009 0.459685 0.49505 0.5491 0.578113 0.581034 0.581034 0.590202 0.590202 0.491804 0.491804 0.534888 0.515924 0.569901 0.615224 0.596037 0.590198 0.590348 0.510325 0.466121 0.548456 0.48692 0.453585 0.504837 0.447338 0.585057 0.532949 0.57805 0.57805 0.56025 0.569648 0.569648 0.609916 0.572837 0.625763 0.571581 0.561371 0.520821 0.545702 0.545702 0.545702 0.560458 0.540671 0.480251 0.525271 0.525271 0.525271 0.525271 0.525271 0.525271 0.527718 0.51525 0.51329 0.502839 0.557929 0.557929 0.422065 0.51405 0.51405 0.492061 0.473369 0.511195 0.511195 0.510637 0.510637 0.523495 0.523495 0.518812 0.566861 0.494049 0.512303 0.498985 0.457436 0.473484 0.498815 0.554884 0.50358 0.475165 0.562797 0.53157 0.50779 0.437625 0.469981 0.450443 0.532348 0.538471 0.472464 0.472464 0.449316 0.45444 0.469935 0.497348 0.49465 0.49465 0.503259 0.503259 0.540273 0.602901 0.542751 0.542751 0.542751 0.518063 0.518063 0.518063 0.469124 0.527901 0.527901 0.401069 0.533204 0.520274 0.520274 0.566435 0.428381 0.439787 0.577987 0.577987 0.577987 0.426329 0.437024 0.437024 0.494129 0.494129 0.5242 0.581365 0.581365 0.581365 0.463581 0.463581 0.515203 0.515203 0.515203 0.515203 0.556485 0.556485 0.556485 0.556485 0.562594 0.581085 0.563341 0.476771 0.529302 0.554155 0.482101 0.495718 0.46804 0.494498 0.55191 0.55191 0.55191 0.55191 0.511917 0.635951 0.455779 0.505679 0.466473 0.436754 0.433586 0.433586 0.464058 0.48736 0.408344 0.441857 0.441857 0.441857 0.311629 0.311629 0.311629 0.349021 0.349021 0.489046 0.461961 0.461961 0.47716 0.480575 0.461484 0.442763 0.46264 0.466939 0.541923 0.490936 0.47167 0.47167 0.454225 0.406864 0.589377 0.386502 0.309764 0.417678 0.553065 0.402153 0.464078 0.651832 0.639338 0.576324 0.576324 0.4349 0.52384 0.52384 0.52384 0.52384 0.422563 0.479193 0.528291 0.454202 0.454202 0.486693 0.461353 0.476154 0.528771 0.599715 0.586626 0.592988 0.53503 0.53503 0.53503 0.53503 0.53503 0.53503 0.51148 0.51148 0.493345 0.529629 0.529629 0.529629 0.529629 0.529629 0.527983 0.519752 0.491616 0.60863 0.60863 0.60863 0.60863 0.60863 0.598935 0.568355 0.566548 0.482801 0.482801 0.482801 0.508481 0.508481 0.52805 0.52805 0.52805 0.52805 0.52805 0.575672 0.575672 0.575672 0.52717 0.52717 0.524502 0.636785 0.470603 0.498877 0.512885 0.512885 0.505814 0.397046 0.359047 0.487083 0.571006 0.562654 0.476808 0.468942 0.484146 0.484146 0.471016 0.44709 0.44709 0.44709 0.44709 0.528293 0.557537 0.518879 0.536805 0.520861 0.428506 0.458625 0.582789 0.51691 0.51691 0.536911 0.537749 0.559889 0.562031 0.581226 0.531506 0.55202 0.50175 0.50175 0.50175 0.50175 0.544802 0.517468 0.45122 0.526585 0.526585 0.601286 0.49205 0.49205 0.524605 0.493541 0.500796 0.500796 0.500796 0.454682 0.583933 0.550637 0.549169 0.474519 0.474519 0.509814 0.483171 0.483171 0.483171 0.483171 0.483171 0.483171 0.483171 0.510753 0.510753 0.470502 0.470502 0.470502 0.401801 0.401801 0.435077 0.561117 0.548316 0.498305 0.521538 0.490669 0.490669 0.488696 0.488696 0.488696 0.49217 0.46425 0.492945 0.438669 0.564083 0.577093 0.502651 0.496642 0.496642 0.549664 0.534907 0.579367 0.428345 0.401444 0.488251 0.51942 0.508672 0.494345 0.434971 0.434971 0.434971 0.511494 0.468026 0.440265 0.440265 0.564707 0.564707 0.564707 0.540577 0.534154 0.493934 0.560002 0.509157 0.510717 0.617002 0.552604 0.379634 0.407547 0.407547 0.40877 0.436964 0.436964 0.395647 0.395647 0.359245 0.441975 0.37215 0.409082 0.490993 0.490993 0.490993 0.490993 0.528513 0.491538 0.489604 0.502846 0.606945 0.634125 0.541455 0.483265 0.47859 0.477639 0.490054 0.465374 0.525497 0.525497 0.492917 0.492917 0.492917 0.505577 0.483736 0.483736 0.502294 0.533411 0.497485 0.497485 0.475921 0.547052 0.489941 0.415825 0.484335 0.484335 0.465654 0.43877 0.578702 0.556871 0.556871 0.521906 0.521906 0.521906 0.521906 0.543161 0.561591 0.504444 0.504444 0.504444 0.489092 0.485733 0.487312 0.489425 0.439313 0.439313 0.439313 0.460921 0.501262 0.412905 0.369577 0.369577 0.442336 0.462869 0.462869
distPlot (with regrParams slope)

In this graphical plot it is clear that the distribution of the slope given the data does not include zero. It is therefore highly improbably that the slope is zero; or, we can "reject" that possibility.

If the outcome of such a graphical check is not clear-cut, we can also directly evaluate the probability of a hypothesis. In Baysig, a hypothesis is simply represented as a probability distribution over the Booleans (True or False). We might be tempted to evaluate the probability that slope equals exactly zero. Unfortunately, this probability is always zero, no matter what the data looks like (an elementary result of probability theory is that for any continuously distributed random variable, the probability that it takes any particular value equals zero). Instead, we can evaluate the probility that slope is greater than zero. That hypothesis can be given a name and a formal expression:

slopePositive = with regrParams (slope > 0.0)

and be evaluated:

slopePositive ⇒ >99%

That is the probability of the hypothesis being true given the data, something that can never be evaluated with classical statistics.

Occasionally it is useful to be able to sample from a model with known parameters or with a distribution of parameters estimated from data. The former situation is used for testing the precision of estimation; the latter for for doing "posterior predictive checks" which assess whether the model is consistent with the data and can be seen as Bayesian equivalents of significance tests. The update operation changes a model such that parameters are drawn from a specified probability distribution. To sample from regress with known parameters:

regress1 <* update regress (return {err=>0.01;
                                    offset=>2.0;
                                    slope=>0.4})

or with the posterior

regress2 <* update regress regrParams

sample, estimate and update together with probabilistic models written in the prob-notation forms a programming interface to fully Bayesian computing. In this language, we program directly with probability distributions over arbitrary data types. The next section illustrates how this extends to models of time-series data.

The quick tour of Baysig continues in the document Baysig quick tour: Dynamical systems.