/* Log gamma distribution in Picat. See more in ppl_distributions.pi and ppl_distributions_test.pi Cf my Gamble model gamble_log_gamma_dist.rkt Note: My Gamble implementation has parameter in different order. 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. import util. % import ordset. main => go. /* var : d Probabilities (truncated): 7.230093711237946: 0.0001000000000000 6.980156980411966: 0.0001000000000000 6.846738128102021: 0.0001000000000000 5.829432765039231: 0.0001000000000000 ......... 2.000137930562389: 0.0001000000000000 2.00006881169998: 0.0001000000000000 2.000020700721352: 0.0001000000000000 2.000002653498838: 0.0001000000000000 mean = 2.25473 variance = 0.106087 [min = 2.0,mean = 2.25473,median = 2.15097,max = 7.23009,variance = 0.106087,stdev = 0.325711] Picat> X=log_gamma_dist_mean(1,0.2,2) X = 2.25 Picat> X=log_gamma_dist_variance(1,0.2,2) X = 0.104166666666667 % Stdev Picat> X=log_gamma_dist_variance(1,0.2,2).sqrt X = 0.322748612183952 */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean,variance % , % show_percentiles, % show_hpd_intervals,hpd_intervals=[0.94], % show_histogram, % min_accepted_samples=1000,show_accepted_samples=true ]), Post = get_store().get("d"), show_simple_stats(Post), % show_store_lengths,nl, % fail, nl. go => true. model() => D = log_gamma_dist(1,0.2,2), add("d",D).