Download (right-click, save target as ...) this page as a jupyterlab notebook from: ES-23


Exercise Set 23: "Confidence Intervals | AB Testing"

LAST NAME, FIRST NAME

R00000000

ENGR 1330 ES-23 - Homework

Exercise 1 (Interval Estimate):

From a normally distributed population, we randolmy took a sample of 200 dogs with a mean weight of 70 pounds. Suppose the standard deviation of the population is 20:

  • What is the estimated true population mean for the 95% confidence interva?
  • How about 90% confidence interval?
  • How about 99% confidence interval?
In [1]:
# 95% confidence interval
In [2]:
# 90% confidence interval
In [3]:
# 99% confidence interval

Exercise 2 (Interval Estimate):

Download the data frame DogWeights. Describe the dataframe; how many rows?; what is the mean dog weight?; what is the standard deviation?; make a histogram of the dataframe

Assuming the dataframe is the entire population evaluate the value of your confidence interval estimates:

  • For the 95% confidence interval simulate 20 random samples of size 200 from the population, from those samples estimate the mean (20 estimates). Then determine how many of your 20 estimates produce a mean value within the confidence interval you determine in Exercise 1 above.

  • Repeat for the 99% confidence interval, but simulate 100 random samples of size 200. Again how many of the 100 estimates fall within the confidence interval you determined in Exercise 1 above.

In [4]:
# download the file
######### CODE TO AUTOMATICALLY DOWNLOAD THE DATABASE ################
#! pip install requests #install packages into local environment
import requests # import needed modules to interact with the internet
# make the connection to the remote file (actually its implementing "bash curl -O http://fqdn/path ...")
remote_url = 'http://54.243.252.9/engr-1330-webroot/8-Labs/Lab23/DogWeights.csv' # a csv file
response = requests.get(remote_url) # Gets the file contents puts into an object
output = open('DogWeights.csv', 'wb') # Prepare a destination, local
output.write(response.content) # write contents of object to named local file
output.close() # close the connection

# describe the dataframe

# how many rows?
# what is the mean dog weight?
# what is the standard deviation?
# make a histogram of the dataframe
In [5]:
# 95% confidence interval
In [6]:
# 99% confidence interval

Exercise 3 (A/B Test):

Amazon is considering changing the color of their logo. The smile will be green instead of orange!

Let us assume out of 5000 users, they have directed 2500 to site A with the previous logo, and the rest to site B with the new logo. In the first group, 1863 users made a purchase. In the second group, 1904 users made a purchase. Is this a statistically significant result? Should Amazon change their logo in order to make more sells?

In [28]: