planetwater

ground- water, geo- statistics, environmental- engineering, earth- science

What are Random Numbers?

with one comment

I did a wonderful #statistics experiment with students in stats class the other day on random numbers:

I divided the class into two groups. I gave a coin to one group and told them to flip this coin 20 times and record the resulting sequence of heads and tails. I asked the other group to come up with sequence of heads and tails in their heads and record the best sequence they can come up with. I told them I would leave the room and come back after five minutes, look at both sequences, and tell them which was created by the coin and which one in the heads of the other group.

These are the two sequences they came up with

HTTTTHHTHHHHTTHHHHTT

and

HTHTHTHTHTHTTHTHTTTH

missing
Two “random” sequences created during statistics-class. Which one was created by a coin-flipping experiment?

Can you guess which sequence was constructed by what group?

Here is some background:

Written by Claus

June 24th, 2019 at 4:25 pm

Posted in Uncategorized

One Response to 'What are Random Numbers?'

Subscribe to comments with RSS

  1. I believe that magical thinking is prevalent when it comes to randomness: “If I got tails, the next result will most likely be heads, because getting a head or a tail is equally probable and it should balance out.” But there is no higher power that counts outcomes and guides the coin to produce equal frequencies of heads and tails. See: https://en.wikipedia.org/wiki/Markov_property

    The short python snippet below counts transitions from one result to the next. The second sequence is far more extreme than the first in this regard, as a head is always followed by a tail and a tail is most often followed by a head.

    import numpy as np

    r1 = “HTTTTHHTHHHHTTHHHHTT” r2 = “HTHTHTHTHTHTTHTHTTTH”

    def transition_freqs(rr): rr = np.where(np.array(list(rr)) == “H”, 1, 0) freqs = np.zeros((2, 2), dtype=float) for last, cur in zip(rr[:-1], rr[1:]): freqs[last, cur] += 1 return freqs / freqs.sum(0)[None, :]

    print(transition_freqs(r1).round(2)) print(transition_freqs(r2).round(2))

    [[0.56 0.3 ] [0.44 0.7 ]] [[0.27 1. ] [0.73 0. ]]

    So my bet is on the second sequence to be the one made up.

    Dirk

    26 Jun 19 at 12:39 pm

Leave a Reply