/* BUGS book, 2.3.1 in Picat. Page 17 Cf my Gamble model gamble_bugs_book_2_3_1.rkt This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import ppl_distributions, ppl_utils, ppl_common_utils. import util. % import ordset. main => go. /* var : x Probabilities (truncated): 36.227393396346493: 0.0001000000000000 29.634453123808932: 0.0001000000000000 27.102741780728874: 0.0001000000000000 26.830065960719224: 0.0001000000000000 ......... -9.598330602691806: 0.0001000000000000 -10.071388204269972: 0.0001000000000000 -11.000708729526696: 0.0001000000000000 -18.34854276714066: 0.0001000000000000 mean = 10.0167 HPD intervals: HPD interval (0.84): 6.79470131294486..13.63299226564605 theoretical_mean = 10 */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean, % show_simple_stats % , % show_percentiles, show_hpd_intervals,hpd_intervals=[0.84] % show_histogram, % min_accepted_samples=1000,show_accepted_samples=true ]), nl, println(theoretical_mean=student_t_dist_mean(10,2,4)), % show_store_lengths,nl, % fail, nl. go => true. model() => % Note: The parameter order is different from Gamble's t-dist(4,10,2) X = student_t_dist(10,2,4), add("x",X).