December 12, 2018
In [ ]: # Homework 6: Testing Hypotheses
Reading: Textbook chapter 11.
Please complete this notebook by filling in the cells provided. Before you begin, execute the
following cell to load the provided tests. Each time you start your server, you will need to execute
this cell again to load the tests.
Homework 6 is due Friday, 11/2 at 11:59pm. Start early so that you can come to office hours if
you’re stuck. Check the website for the office hours schedule. Late work will not be accepted as
per the policies of this course.
Directly sharing answers is not okay, but discussing problems with the course staff or with
other students is encouraged. Refer to the policies page to learn more about how to learn cooper-
atively.
For all problems that you must write our explanations and sentences for, you must pro-
vide your answer in the designated space. Moreover, throughout this homework and all future
ones, please be sure to not re-assign variables throughout the notebook! For example, if you use
max_temperature in your answer to one question, do not reassign it later on.
In [ ]: # Don't change this cell; just run it.
! pip install -U okpy
import numpy as np
from datascience import *
# These lines do some fancy plotting magic.
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
import warnings
warnings.simplefilter('ignore', FutureWarning)
from client.api.notebook import Notebook
ok = Notebook('hw06.ok')
_ = ok.auth(inline=True)
0.1 1. Catching Cheaters
Suppose you are a casino owner, and your casino runs a very simple game of chance. The dealer
flips a coin. The customer wins 9 dollars from the casino if it comes up heads and loses 10 dollars
1
,if it comes up tails.
2
, Question 1. Assuming no one is cheating and the coin is fair, if a customer plays twice, what
is the chance they make money?
In [ ]: p_winning_after_two_flips = 0.5 * 0.5
In [ ]: _ = ok.grade('q1_1')
_ = ok.backup()
A certain customer plays the game 20 times and wins 13 of the bets. You suspect that the
customer is cheating! That is, you think that their chance of winning is higher than the normal
chance of winning.
You decide to test your hunch using the outcomes of the 20 games you observed.
3