/* Zener test in Picat. From Matt Parker: "We have statistical evidence that people are mildly psychic" https://www.youtube.com/watch?v=VwIKKBL4ldQ Zener cards consists of 25 cards among 5 different symbols: circle, plus, 3 wayvy lines, square, star Collecting data for getting 25 Zener cards correct, they found an anomaly that indicated that the number of correct guesses was slightly more than expected. What was the cause of it? Are people psychic? Nope, it was premature stopping: people stopped before end if they got too few correct guesses (or was bored, or they answered a phone, or the computer broke down, etc). And the site didn't registered those trials. Here is a model including some probability (0.03) that a person ends the session at each guess. Cf my Gamble model gamble_.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 : len Probabilities: 25: 0.4741500000000000 0: 0.0293000000000000 2: 0.0289500000000000 4: 0.0272000000000000 5: 0.0258000000000000 3: 0.0250500000000000 6: 0.0249000000000000 1: 0.0237500000000000 7: 0.0230500000000000 8: 0.0230000000000000 9: 0.0227000000000000 10: 0.0220000000000000 13: 0.0214000000000000 14: 0.0212000000000000 11: 0.0211500000000000 12: 0.0194000000000000 16: 0.0190500000000000 15: 0.0184500000000000 17: 0.0183500000000000 18: 0.0183000000000000 22: 0.0171500000000000 19: 0.0162000000000000 20: 0.0161500000000000 23: 0.0154500000000000 21: 0.0146000000000000 24: 0.0133000000000000 mean = 17.42 HPD intervals: HPD interval (0.84): 5.00000000000000..25.00000000000000 HPD interval (0.9): 3.00000000000000..25.00000000000000 HPD interval (0.94): 2.00000000000000..25.00000000000000 HPD interval (0.99): 0.00000000000000..25.00000000000000 HPD interval (0.99999): 0.00000000000000..25.00000000000000 Histogram (total 20000) 0: 586 #### (0.029 / 0.029) 1: 475 ### (0.024 / 0.053) 2: 579 #### (0.029 / 0.082) 3: 501 ### (0.025 / 0.107) 4: 544 ### (0.027 / 0.134) 5: 516 ### (0.026 / 0.160) 6: 498 ### (0.025 / 0.185) 7: 461 ### (0.023 / 0.208) 8: 460 ### (0.023 / 0.231) 9: 454 ### (0.023 / 0.254) 10: 440 ### (0.022 / 0.276) 11: 423 ### (0.021 / 0.297) 12: 388 ## (0.019 / 0.316) 13: 428 ### (0.021 / 0.338) 14: 424 ### (0.021 / 0.359) 15: 369 ## (0.018 / 0.377) 16: 381 ## (0.019 / 0.396) 17: 367 ## (0.018 / 0.415) 18: 366 ## (0.018 / 0.433) 19: 324 ## (0.016 / 0.449) 20: 323 ## (0.016 / 0.465) 21: 292 ## (0.015 / 0.480) 22: 343 ## (0.017 / 0.497) 23: 309 ## (0.015 / 0.513) 24: 266 ## (0.013 / 0.526) 25: 9483 ############################################################ (0.474 / 1.000) var : num correct Probabilities: 4: 0.1415500000000000 3: 0.1360500000000000 0: 0.1285500000000000 5: 0.1275000000000000 2: 0.1271500000000000 1: 0.1223000000000000 6: 0.0946500000000000 7: 0.0639000000000000 8: 0.0327000000000000 9: 0.0162500000000000 10: 0.0063000000000000 11: 0.0018500000000000 12: 0.0011000000000000 13: 0.0001000000000000 15: 0.0000500000000000 mean = 3.5101 HPD intervals: HPD interval (0.84): 0.00000000000000..6.00000000000000 HPD interval (0.9): 0.00000000000000..7.00000000000000 HPD interval (0.94): 0.00000000000000..7.00000000000000 HPD interval (0.99): 0.00000000000000..9.00000000000000 HPD interval (0.99999): 0.00000000000000..15.00000000000000 Histogram (total 20000) 0: 2571 ###################################################### (0.129 / 0.129) 1: 2446 #################################################### (0.122 / 0.251) 2: 2543 ###################################################### (0.127 / 0.378) 3: 2721 ########################################################## (0.136 / 0.514) 4: 2831 ############################################################ (0.142 / 0.656) 5: 2550 ###################################################### (0.128 / 0.783) 6: 1893 ######################################## (0.095 / 0.878) 7: 1278 ########################### (0.064 / 0.942) 8: 654 ############## (0.033 / 0.974) 9: 325 ####### (0.016 / 0.991) 10: 126 ### (0.006 / 0.997) 11: 37 # (0.002 / 0.999) 12: 22 (0.001 / 1.000) 13: 2 (0.000 / 1.000) 15: 1 (0.000 / 1.000) */ go ?=> reset_store, run_model(20_000,$model,[show_probs,mean, show_hpd_intervals,hpd_intervals=[0.84,0.9,0.94,0.99,0.99999], show_histogram ]), nl, % show_store_lengths,nl, % fail, nl. go => true. f(A,C,N,PQuit) = Res => if C == N ; flip(PQuit) == true then Res = [A,C] else Res = f(A++[uniform_draw(0..4)],C+1,N,PQuit) end. model() => N = 25, PQuit = 0.03, % 0s 1s 2s 3s 4s Cards = rep(N,0..4).flatten, [A,Len] = f([],0,N,PQuit), NumCorrect = [ cond(A[I] == Cards[I],1,0) : I in 1..Len].sum, add("len",Len), add("num correct",NumCorrect).