Section 1.1 — Introduction to data#

This notebook contains all the code from Section 1.1 Introduction to data of the No Bullshit Guide to Statistics.

Definitions#

Study design and randomization#

Random selection#

import random
population = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
sample = random.sample(population, 3)
sample
[1, 9, 2]

Random assignment#

def flip_coin():
    r = random.random()
    if r < 0.5:
        print("intervention")
    else:
        print("control")

flip_coin()
control

Discussion#