/* Spread of traits in Picat. From http://godplaysdice.blogspot.com/2007/09/more-men-at-top-and-at-bottom.html """ More men at the top, and at the bottom. As has been documented by a lot of people, it seems that a lot of psychological traits have the following properties: - men and women have approximately the same average for this trait, and - both genders have an approximately normal distribution for this trait, but - the distribution of men's values for this trait has a larger standard deviation than the women's values """ Cf my Gamble model gamble_spread_of_traits.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. import util. % import ordset. main => go. /* Here we model this by using a gaussian 100 with stdev=20 for men and stdev=10 for women. As can be seen, the range for men is much larger than for women. However, the probability that women has higher value than men is (still) 0.5. var : men mean = 99.911 [min = 22.7614,mean = 99.911,median = 99.5458,max = 189.514,variance = 400.484,stdev = 20.0121] HPD intervals: HPD interval (0.84): 73.37903321225750..129.28031852979359 HPD interval (0.9): 65.53899247688335..131.15500942530201 HPD interval (0.95): 61.35180048170533..139.81534443592830 HPD interval (0.99): 48.14623495277832..151.31420104059453 var : women mean = 99.9721 [min = 62.3324,mean = 99.9721,median = 100.013,max = 136.305,variance = 100.879,stdev = 10.0439] HPD intervals: HPD interval (0.84): 86.23514669347946..114.47483798265237 HPD interval (0.9): 83.15737982376066..116.10328340263663 HPD interval (0.95): 80.14976514768408..119.02297598964398 HPD interval (0.99): 75.00086603533137..126.68575088480048 var : diff mean = -0.0611296 [min = -88.0243,mean = -0.0611296,median = -0.309563,max = 88.1071,variance = 500.976,stdev = 22.3825] HPD intervals: HPD interval (0.84): -28.91372015928050..34.08250317484425 HPD interval (0.9): -36.69458083247871..36.36843108956859 HPD interval (0.95): -44.77494369585491..42.63348950427753 HPD interval (0.99): -57.03870327219290..58.88567951234310 var : p mean = 0.505 [min = 0,mean = 0.505,median = 1.0,max = 1,variance = 0.249975,stdev = 0.499975] HPD intervals: HPD interval (0.84): 0.00000000000000..1.00000000000000 HPD interval (0.9): 0.00000000000000..1.00000000000000 HPD interval (0.95): 0.00000000000000..1.00000000000000 HPD interval (0.99): 0.00000000000000..1.00000000000000 */ go ?=> reset_store, run_model(10_000,$model,[mean,show_simple_stats, % show_percentiles, show_hpd_intervals,hpd_intervals=[0.84,0.9,0.95,0.99] % show_histogram, % min_accepted_samples=1000,show_accepted_samples=true ]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => Men = normal_dist(100,20), Women = normal_dist(100,10), Diff = Men - Women, P = check1(Women > Men), add("men",Men), add("women",Women), add("diff",Diff), add("p",P).