Gamblers Fallacy

Well, I decided to do an analysis of the Gamblers Fallacy by simulating it.

http://en.wikipedia.org/wiki/Gambler%27s_fallacy

So, I ran a randomly played game of Rock, Paper, Scissors, running 600 sets of games. The number of rounds per game increases by one per set, and I run 100 games per set.

The data I plot was :

red: A line graph of the ratio wins to losses in the last game of the set

yellow: A line graph of the average difference between the number of wins and losses per set played

white dots: A scatter plot of the difference between the number of wins and losses, with one dot being one game

blue histogram: Shows the distribution of the white dots in the set. The x axis is the the difference between wins and losses, and goes from least to greatest from the left. The yellow line displays the average difference, same as the yellow line described above.

-----
Now...
The red line stabilizes as the number of rounds get greater, as expected. The average difference also gets greater as the number of rounds get greater(seems to be logarithmic growing). This seems to support that the fallacy is really a fallacy.

However, when one looks at the histogram and the white dots, you notice that the distribution tends to prefer having a lower difference. Would this not suggest that the fallacy is not a fallacy and actually exists?


Below, my code written in Turing (shameful :( )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
colorback (black)
cls
var preva : int := 0
var prevr : int := 0
const f1 : int := 5
const f2 : int := 100
const ofs : int := 300
const bn : int :=50
const ts : int := 600
const trs : int := 100
const hscl:int :=3
const hred:int :=5
for n : 1 .. ts
    var buckets : array 1 .. bn of int
    for i : 1 .. bn
        buckets (i) := 0
    end for
    var ad : real := 0
    var ratio : real := 0
    for t : 1 .. trs %100 trials
        var mcount : int := 1
        var ncount : int := 1
        for i : 1 .. n %play n number of games in trial
            var m, nn : int
            m := Rand.Int (1, 3)
            nn := Rand.Int (1, 3)
            if m = 1 and nn = 2 then
                ncount := ncount + 1
            elsif m = 2 and nn = 3 then
                ncount := ncount + 1
            elsif m = 3 and nn = 1 then
                ncount := ncount + 1
            elsif nn = 1 and m = 2 then %backwards
                mcount := mcount + 1
            elsif nn = 2 and m = 3 then
                mcount := mcount + 1
            elsif nn = 3 and m = 1 then
                mcount := mcount + 1
            end if
        end for
        drawdot (n, f1 * abs (ncount - mcount), white)
        for k : 1 .. bn
            if (abs (ncount - mcount) < k * ((ts/hred) / bn) and (abs (ncount - mcount) > (k - 1) * ((ts/hred) / bn))) then
                buckets (k) := buckets (k) + hscl
            end if
        end for
        ad := ad + (abs (ncount - mcount) / 100)
        ratio := mcount / ncount
    end for
    drawline (n, round (f2 * ratio) + ofs, n - 1, prevr, brightred)
    drawline (n, f1 * round (ad), n - 1, preva, yellow)
    preva := round (f1 * ad)
    prevr := round (f2 * ratio) + ofs
    drawfillbox (0, 500, 200, 700, blue)

    for i : 1 .. bn
        drawfillbox (0, 500, round ((i) * (200 / bn)), 500 + buckets (i), white)
    end for
    
    drawline(round (ad*200/(ts/hred)),500,round (ad*200/(ts/hred)),700,yellow)

    View.Update ()
end for

Would this not suggest that the fallacy is not a fallacy and actually exists?


It suggests that your random generator sucks, or your analysis is flawed. :)
I'm commenting just so that you don't think Moschops is a troll. He is right, the flaw is with your random number generator. This is an issue that exists because a computer is a procedural device and cannot be told to do anything randomly.
I'm commenting just so that you don't think Moschops is a troll.

Surely that's totally covered by the :) :)

Not necessarily, because it could be a sarcastic smiley face.

Also, one way to get truly random data is to detect the CMB.
OK. I modified it to use pregenerated random binary files from RANDOM.ORG.

I still found the same result. The difference between wins and losses had a tendency to be small.
The difference between wins and losses had a tendency to be small.


I think you either don't understand the fallacy or don't know how to interpret your data.

The difference between wins and losses should be small. There is an equal chance of winning or losing between two opponents, so you would expect the number of wins and losses to be close. The gambler's fallacy would be to believe they could influence the number of wins favorably by basing current selections on past results.
ahhh. I see. I was under the assumption that the gamblers fallacy referred to when playing a fair game, the likeliness of winning back you losses does not increase with number of games played.

-blueberry
Topic archived. No new replies allowed.