Hacker Statistics & Simulation Case Study.

In this blog, you will get an overview with a simple case study of what hacker statistics is.

Hacker statistics use simulated measurements to gather more data. The goal is instead of literally repeating the data acquisition over and over again, we can simulate those repeated measurements using Python.

Let us see what that means in practice.

Imagine the following:

You're walking up a building to your apartment and you're playing a game with a friend. You throw a die one hundred times.

  • If it's 1 or 2 you'll go one step down.
  • If it's 3, 4, or 5, you'll go one step up.
  • If you throw a 6, you'll throw the die again and will walk up the resulting number of steps.
  • You can not go lower than step number 0.
  • You have a chance of 0.1% falling down the stairs when you make a move.
  • Falling down means that you have to start again from step 0.

Capture.JPG

With all of this in mind, you bet with your friend that you'll reach 60 steps high.

What is the chance that you will win this bet?

We can do either the following to answer this question.

  • Calculating the chance analytically using equations.
  • Simulating this process thousands of times, and see in what fraction of the simulations that you will reach 60 steps. This is a form of -hacker statistics-.

We are going to use simulation to answer our question.

1. Simulating dice rolling

We need random generators, so we can simulate the die. We need to import NumPy, and inside NumPy, we have the random package.

import numpy as np

You can check the rest of the case study on Github in a Jupyter notebook which is better to follow along with the output of the code as well.

github.com/ezzaddeentru/Hacker-Statistics-C..