From owner-advanced-sl@multimanpublishing.com Tue Feb 25 22:01:15 2003 Return-Path: Delivered-To: spb@merkin.meshuggeneh.net Received: from momser.meshuggeneh.net (momser.meshuggeneh.net [192.168.1.13]) by merkin.meshuggeneh.net (Postfix) with ESMTP id 5B66D800B for ; Tue, 25 Feb 2003 22:01:15 -0800 (PST) Received: by momser.meshuggeneh.net (Postfix) id 38EF72589; Tue, 25 Feb 2003 22:01:15 -0800 (PST) Delivered-To: spb@localmail.meshuggeneh.net Received: from mail.meshuggeneh.net (ns.meshuggeneh.net [63.199.183.2]) by momser.meshuggeneh.net (Postfix) with ESMTP id 074E22585 for ; Tue, 25 Feb 2003 22:01:14 -0800 (PST) Received: by mail.meshuggeneh.net (Postfix) id E72D0AF0B; Tue, 25 Feb 2003 22:01:13 -0800 (PST) Delivered-To: spb@meshuggeneh.net Received: from mail3.atl.registeredsite.com (mail3.atl.registeredsite.com [64.224.219.77]) by mail.meshuggeneh.net (Postfix) with ESMTP id 80FF9AF08 for ; Tue, 25 Feb 2003 22:01:12 -0800 (PST) Received: from multimanpublishing.com (multi-man.com [216.122.100.233] (may be forged)) by mail3.atl.registeredsite.com (8.12.6/8.12.6) with ESMTP id h1Q3hi1u032030; Wed, 26 Feb 2003 01:00:55 -0500 Received: (from multiman@localhost) by multimanpublishing.com (8.9.3/8.9.3) id VAA22626 for a05599975; Tue, 25 Feb 2003 21:21:13 -0500 (EST) To: Alain Chabot Cc: swfancher@mindspring.com, Sam Belcher , "'Stephen P. Berry'" , "'Rodney Kinney'" , advanced-sl@multimanpublishing.com Subject: Re: ASL: VASL dice bot: how to do analysis In-Reply-To: Message from Alain Chabot of "Fri, 21 Feb 2003 10:10:02 -0400." <2B20674E-45A6-11D7-B204-003065C02C4A@ustanne.ednet.ns.ca> Date: Tue, 25 Feb 2003 18:20:29 -0800 From: "Stephen P. Berry" Message-Id: <20030226022034.3C39D8028@merkin.meshuggeneh.net> Sender: owner-advanced-sl@multimanpublishing.com Precedence: bulk Alain Chabot writes: >There are 11 possible results when rolling 2d6 (from 2 to 12). If you >want to check the randomness of pairs of rolls, you will have to check >how many 2-2, 2-3, 2-4, 2-5, (not to mention 5-2, 5-4, 5-3, 5-2), etc >you get and compare that to what a random distribution predicts. >Assuming you roll 10,000 DR and that you treat them as 5,000 distinct >pairs (as opposed to having DR#2 being the second DR of the first pair >and the first of the second pair), the number of 2 followed by 2 >expected is 1/36 * 1/36 * 5000 (that's 3.85 for the NCH). This is mostly correct, so I'll just offer a couple quibbles. First, I'm not sure why you're treat 10000 DR as only 5000 pairs instead of 9999 pairs. I.e., if we call the first DR d[1] and the n'th DR d[n], then you have pairs {d[1], d[2]}, {d[2], d[3]}, ... {d[n - 1], d[n]}. Indeed, if what you're looking for is correlations in successive DR, this would be better than grouping the set of DR into subsets such that each DR is the member of exactly one subset. Also, I'm not sure why we'd want to deal with DR instead of dr. If the individual dr are generated by a function that is picking integers uniform on [1, 6], then it seems like testing paris of DR (instead of pairs of dr) suffers from two problems: tending to mask correlations between successive dr (if indeed that's what we're interested in); and needlessly making the numbers more difficult to work with (i.e., dealing with 121 combinations of different probabilities rather than 36 combinations of equal probabilities). I'm not suggesting that this is -wrong-...I'm just not sure why one would choose to model the data this way. Anyway, the serial test is easy enough for successive pairs of dr. So a count is kept for each pair {d[n - 1], d[n]} for n from 2 to the number of total dr. The average is figured as ((1/6)^2) * (n - 1), and a chi-square computed. The results for the 85450 dr I have data on are fine: d[n] d[n-1] Count 1 1 2402 1 2 2334 1 3 2387 1 4 2306 1 5 2361 1 6 2428 2 1 2378 2 2 2334 2 3 2427 2 4 2343 2 5 2381 2 6 2352 3 1 2432 3 2 2325 3 3 2329 3 4 2347 3 5 2404 3 6 2429 4 1 2309 4 2 2390 4 3 2337 4 4 2295 4 5 2350 4 6 2301 5 1 2347 5 2 2475 5 3 2390 5 4 2302 5 5 2547 5 6 2424 6 1 2351 6 2 2357 6 3 2396 6 4 2388 6 5 2442 6 6 2349 Expected value for each count: 2373.58333333333 Chi-square: 43.0407260471158 For df=35: p=0.01 p=0.05 p=0.001 49.80 57.34 66.62 ...so there's no evidence there that the distribution of pairs of successive dr are not independent. While we're on the subject, I'll throw out -one- more standard test for randomness. This one is popularly called the coupon collector's test. For the current audience, instead of coupons we might think of baseball cards or any other widget that comes in sets of which you want to `collect all n', for some sufficiently marketable value of n. The idea is that we walk through our data, starting with an empty set, then add the elements of our data to the set, one by one, until we have a complete set of one of each type (not counting duplicates). So for my dataset of 85450 dr, we start with a set of zero 1s, zero 2s, and so on. Each time we see a new dr, we add it to our set. We keep track of how long it takes us to get a complete set of the numbers in [1, 6], then re-start from an empty set (selling the completed set on eBay, complete with photocopies of a couple other dr) and do it again. After counting up the length between complete sets (i.e., the number of dr we had look through before we got one of each possible dr) we can do a trust ol' chi-square on the resulting data, where the probability for each length will be: d! p(r) = ----- * S((r - 1), (d - 1)) , d <= r < t d^r d! p(t) = 1 - ----------- * S((t - 1), d) d^(t - 1) ...where: r is the length in question; d is the number of items in a complete set; S(n,m) is the Stirling number of the second kind (which is the number of ways you can partition a set of n elements into m disjoint, nonempty subsets; and t the upper bound of the lengths we're going to consider (so if we were interested in lengths from 1 to 10, t would be 11. we'll choose t such that the expected value for the highest r will be around 1. if this doesn't make sense, just peek down at the data and it'll probably be more clear). We multiply these values for p(r) with the total number of lengths we measure to obtain an expected value for each length, then do our chi-square. The data once again looks good: Length Count Expected Value 6 85 89.75309 7 223 224.38272 8 372 349.03978 9 420 436.29973 10 475 481.38403 11 477 490.83719 12 490 474.63947 13 477 442.26326 14 401 401.22929 15 377 356.91274 16 293 312.85229 17 247 271.18876 18 235 233.07425 19 185 199.00003 20 174 169.03892 21 162 143.01511 22 104 120.61831 23 99 101.47771 24 75 85.20793 25 68 71.43616 26 50 59.81688 27 57 50.03876 28 54 41.82664 29 24 34.94069 30 39 29.17404 31 23 24.34958 32 24 20.31657 33 21 16.94732 34 13 14.13400 35 11 11.78582 36 10 9.82651 37 11 8.19208 38 7 6.82895 39 9 5.69227 40 5 4.74455 41 1 3.95445 42 5 3.29581 43 3 2.74680 44 2 2.28920 45 1 1.90779 46 1 1.58991 47 0 1.32499 48 1 1.10419 49 0 0.92019 >=50 5 4.60124 Chi-square: 41.73981 For df=43: p=0.01 p=0.05 p=0.001 59.30 67.46 77.42 So...once again we aren't forced to reject the null hypothesis; there's no evidence that the dice are biased in a statistically significant way. Okay. I'm done posting columns of numbers for awhile. Just be glad I restrained the urge to post ascii plots of my phase space models of the data (the one test that I've tried that the data `fails'). -spb