Business Statistics: 41000

Similar documents
Section 2: Estimation, Confidence Intervals and Testing Hypothesis

University of Chicago Graduate School of Business. Business 41000: Business Statistics

Probability and Probability Distributions. Dr. Mohammed Alahmed

Final Exam Bus 320 Spring 2000 Russell

Expectations and Variance

Econ 325: Introduction to Empirical Economics

First we look at some terms to be used in this section.

Homework Exercises. 1. You want to conduct a test of significance for p the population proportion.

16.400/453J Human Factors Engineering. Design of Experiments II

Are data normally normally distributed?

Mock Exam - 2 hours - use of basic (non-programmable) calculator is allowed - all exercises carry the same marks - exam is strictly individual

Business Statistics: Lecture 8: Introduction to Estimation & Hypothesis Testing

CONTINUOUS RANDOM VARIABLES

Probability and Statistics

Probability Distribution. Stat Camp for the MBA Program. Debbon Air Seat Release

The t-distribution. Patrick Breheny. October 13. z tests The χ 2 -distribution The t-distribution Summary

Hypothesis testing. Data to decisions

CENTRAL LIMIT THEOREM (CLT)

z and t tests for the mean of a normal distribution Confidence intervals for the mean Binomial tests

CS 361: Probability & Statistics

Advanced Herd Management Probabilities and distributions

Exam Empirical Methods VU University Amsterdam, Faculty of Exact Sciences h, February 12, 2015

Review of Statistics 101

Business Analytics and Data Mining Modeling Using R Prof. Gaurav Dixit Department of Management Studies Indian Institute of Technology, Roorkee

Math 143: Introduction to Biostatistics

Expectations and Variance

Discrete probability distributions

Business Statistics Midterm Exam Fall 2015 Russell. Please sign here to acknowledge

Chapter 5: HYPOTHESIS TESTING

Hypothesis Testing and Confidence Intervals (Part 2): Cohen s d, Logic of Testing, and Confidence Intervals

Hypothesis tests

PHP2510: Principles of Biostatistics & Data Analysis. Lecture X: Hypothesis testing. PHP 2510 Lec 10: Hypothesis testing 1

Statistics Boot Camp. Dr. Stephanie Lane Institute for Defense Analyses DATAWorks 2018

MATH 10 INTRODUCTORY STATISTICS

SYSM 6303: Quantitative Introduction to Risk and Uncertainty in Business Lecture 4: Fitting Data to Distributions

Class 26: review for final exam 18.05, Spring 2014

STAT 4385 Topic 01: Introduction & Review

Medical statistics part I, autumn 2010: One sample test of hypothesis

STAT 135 Lab 5 Bootstrapping and Hypothesis Testing

Lecture 1: Probability Fundamentals

CSE 103 Homework 8: Solutions November 30, var(x) = np(1 p) = P r( X ) 0.95 P r( X ) 0.

Introduction and Overview STAT 421, SP Course Instructor

LECTURE 12 CONFIDENCE INTERVAL AND HYPOTHESIS TESTING

GEOMETRIC -discrete A discrete random variable R counts number of times needed before an event occurs

Statistics for IT Managers

Probability Methods in Civil Engineering Prof. Dr. Rajib Maity Department of Civil Engineering Indian Institution of Technology, Kharagpur

CS 160: Lecture 16. Quantitative Studies. Outline. Random variables and trials. Random variables. Qualitative vs. Quantitative Studies

Multiple Regression Analysis

Data Mining. CS57300 Purdue University. March 22, 2018

Example 1: Dear Abby. Stat Camp for the MBA Program

Bayesian modelling of football outcomes. 1 Introduction. Synopsis. (using Skellam s Distribution)

Statistical Inference

Samples and Populations Confidence Intervals Hypotheses One-sided vs. two-sided Statistical Significance Error Types. Statistiek I.

Last few slides from last time

Business Statistics 41000: Homework # 5

Two sample Hypothesis tests in R.

Uncertainty. Michael Peters December 27, 2013

Confidence Intervals with σ unknown

Robustness and Distribution Assumptions

Swarthmore Honors Exam 2012: Statistics

Gov 2000: 6. Hypothesis Testing

LC OL - Statistics. Types of Data

1. If X has density. cx 3 e x ), 0 x < 0, otherwise. Find the value of c that makes f a probability density. f(x) =

You may use your calculator and a single page of notes. The room is crowded. Please be careful to look only at your own exam.

AMS 132: Discussion Section 2

One-sample categorical data: approximate inference

Common Discrete Distributions

Content by Week Week of October 14 27

Homework 1 Solutions

Section 4.6 Simple Linear Regression

Chapter 18. Sampling Distribution Models. Copyright 2010, 2007, 2004 Pearson Education, Inc.

An introduction to biostatistics: part 1

18.05 Practice Final Exam

Chapter 23: Inferences About Means

Chapter 7. Inference for Distributions. Introduction to the Practice of STATISTICS SEVENTH. Moore / McCabe / Craig. Lecture Presentation Slides

Statistical Distribution Assumptions of General Linear Models

1 Hypothesis testing for a single mean

Chapter 3 Multiple Regression Complete Example

Stats + Homework 2 Review. CS100 TAs

23. MORE HYPOTHESIS TESTING

Carolyn Anderson & YoungShil Paek (Slide contributors: Shuai Wang, Yi Zheng, Michael Culbertson, & Haiyan Li)

Math 124: Modules Overall Goal. Point Estimations. Interval Estimation. Math 124: Modules Overall Goal.

Quantitative Introduction ro Risk and Uncertainty in Business Module 5: Hypothesis Testing

F79SM STATISTICAL METHODS

Interval estimation. October 3, Basic ideas CLT and CI CI for a population mean CI for a population proportion CI for a Normal mean

This gives us an upper and lower bound that capture our population mean.

18.05 Final Exam. Good luck! Name. No calculators. Number of problems 16 concept questions, 16 problems, 21 pages

Introduction to Statistics

Sociology 6Z03 Review II

PASS Sample Size Software. Poisson Regression

Week 6, 9/24/12-9/28/12, Notes: Bernoulli, Binomial, Hypergeometric, and Poisson Random Variables

Probability and Discrete Distributions

Lecture 18: Central Limit Theorem. Lisa Yan August 6, 2018

Probabilities & Statistics Revision

Business Statistics. Lecture 5: Confidence Intervals

Section 3: Simple Linear Regression

EXAM 4. Practice #1. There are 110 possible points on this exam. The test is out of 100.

Chapter 9. Hypothesis testing. 9.1 Introduction

Applied Regression Analysis. Section 2: Multiple Linear Regression

Null Hypothesis Significance Testing p-values, significance level, power, t-tests Spring 2017

Transcription:

Business Statistics: 41000 Week 3: Learning from Data: Estimation Nick Polson The University of Chicago Booth School of Business http://faculty.chicagobooth.edu/nicholas.polson/teaching/41000/ Suggested Reading OpenIntro Statistics, Chapters 4,5&6

Why R? R is free! All the code for the course and assignments are in Rexamples.R! Most Data Scientists are using R. R s syntax is very simple. There are a large number of add-on statistical packages that can be installed and run in R. You don t need to code anything. You can use your favorite software: Excel, Stata, Matlab.

Statistics with R You can download R and Rstudio for Windows, Linux, Mac at http://www.r-project.org/ http://www.rstudio.com/ Rstudio is a very useful front-end interface to R. Links, code for class, video tutorials are up on the course-page. A list of books on doing statistics in R is at http://www.r-project.org/doc/bib/r-books-html http://www.r-bloggers.com Start by watching R videos for Libraries and Packages/Files and Data.

Standard R Commands Given vectors x and y we can apply mean(... ) computes the sample mean median(... ) computes the median var(... sd(... cov(... cor(... ) computes the sample variance ) computes the sample standard deviation ) computes the sample covariance ) computes the sample correlation pnorm(... hist(... ) calculates normal probabilities ) makes histograms lm(... ) for linear model (a.k.a regression) summary(... ) provides a summary analysis of the output

Stats in Excel average(... median(... ) computes the sample mean ) computes the median var(... ) computes the sample variance stdev(... ) computes the sample standard deviation covar(...,... ) computes the sample covariance normsdist(... histogram(... ) calculates normal probabilities ) makes histograms Regression commands include linest(yrange,xrange) for linear model (a.k.a multiple regression) slope(yrange,xrange) provides the regression β

Google 2016 Let X be daily returns. We assume that returns are independent and identically distributed as X N (µ, σ 2) Question: What are the values of µ and σ? Let s assume that each observation in the random sample {x 1, x 2,..., x n } is independent and distributed according to the model above, X i N(µ, σ 2 ). Then we use the sample mean, x, and sample variance, s 2, x = 1 n n i=1 s 2 = 1 n 1 x i n (x i x) 2 i=1

Google 2018 Prices and Returns

Google 2018 Assume that I invest all my money in Google! Your job is to tell me the following: 1. What is my expected one year return? 2. How about the risk? 3. What s the probability that I lose 3% in a day?

Google 2018 We can use our model and R to answer our questions >mean(ret) [1] 0.0007078 >sd(ret) [1] 0.01864 Annual expected return 0.0007078 252 = 17.8% a year Daily risk or volatility of 1.86% How about losing money? >pnorm(-0.03,0.0007078,0.01864) [1] 0.049 There s a 4.9% chance I can lose 3% in a day

Sampling Distribution of Sample Mean Consider the mean for an iid sample of n observations of a random variable, denoted by {x 1,..., x n } If n is large enough ) X N (µ, σ2 n This is called the sampling distribution of the mean... Also known as the Central Limit Theorem (CLT)

Sampling Distribution of Sample Mean The sampling distribution explains how much our estimate X will vary over different datasets of size n We ll use s 2 to estimate σ 2 and use ) X N (µ, s2 n The quantity s 2 X = s2 n defines the standard deviation s X = s n.

Confidence Intervals In summary, our best guess at µ is x How large a mistake can we make? ( ) The distribution is X N µ, s 2 X [ X ± 1.96s X ] give us a 95% range of plausible values for µ We call it a 95% Confidence Interval.

Prediction intervals 1. A confidence interval estimates the mean, µ. 2. A prediction interval answers the question: What range of values are plausible for a single future observation? 100(1 α%) of the data lie in the interval x ± z α/2 s 1 + 1/n. For example, if α = 0.05, we have z 0.05/2 = 1.96.

Standard Error and Confidence Interval for a Proportion Suppose that we have a proportion ˆp = X /n rather than a mean We can compute the standard error for the proportion: ˆp(1 ˆp) sˆp = n Then we can calculate a 95% Confidence Interval ˆp ± 1.96 sˆp

Example: Google Search Algorithm Google is testing a new search algorithm. They experiment with 2, 500 searches and check how often people clicked through. Here s our data: Table: Google Search Algorithm Algo1 Algo2 success 1755 1818 failure 745 682 2500 2500 The probability of success is estimated to be ˆp 1 = 0.702 for the current algorithm and ˆp 2 = 0.727 for the new algorithm. Is the new algorithm better? For sure??

Example: Google Search We could calculate 95% confidence intervals separately For Algo 1: For Algo 2: 0.702 0.298 0.702 ± 1.96 = (0.693, 0.711) 2500 0.727 0.273 0.727 ± 1.96 = (0.718, 0.735) 2500 What do you think? Maybe its more accurate to do the difference!!

Standard Error for the Difference in Means Suppose that we have two samples We can compute the standard error for the difference in means: s X1 X2 = s 2 X1 n 1 + s2 X2 n 2 We can compute the standard error for the difference in proportions: sˆp1 ˆp 2 = ˆp 1 (1 ˆp 1 ) n 1 + ˆp 2(1 ˆp 2 ) n 2

Confidence Interval for the Difference in Means & Proportions We can now compute the confidence interval for the difference in means: ( ˆX1 ˆX2 ) ± 1.96 s X1 X2 or the confidence interval for the difference in proportions: (ˆp 1 ˆp 2 ) ± 1.96 sˆp1 ˆp 2

Example: Google Search Now we get 0.702 0.298 sˆp1 ˆp 2 = + 2500 0.727 0.273 2500 = 0.0128 The Confidence Interval becomes (0.702 0.727) ± 1.96 0.0128 = ( 0.05, 0.00) What s our conclusion now?

Let s revisit the Patriots example... The data tells us that the Patriots have won 19 out 25 tosses. Assume they were using the same coin the entire time and that the Patriots always choose heads... What is the data telling us about the probability of heads in this coin?

Patriots and Coin Tosses Our best guess at p is ˆp = 19 25 = 0.76 We have a 95% Confidence Interval given by 0.76 0.24 0.76 ± 1.96 25 = 0.76 ± 1.96 0.0854 The interval is (0.592, 0.927). Why so wide? What do we conclude??

Conclusions There s a number of things: 1. Estimates are based on random samples and therefore random (uncertain) themselves We need to account for this uncertainty! 2. Standard Error measures the uncertainty of an estimate 3. We construct 95% Confidence Intervals This provides us with a plausible range for the quantity we are trying to estimate.

Poisson Distribution The Poisson distribution counts the occurrence of events Given the rate λ we calculate probabilities as follows P(X = x) = e λ λ x x! where x = 0, 1, 2, 3,... The Poisson Mean and Variance are: Poisson Distribution Parameters Expected value µ = E(X) = λ Variance σ 2 = Var(X) = λ λ is the rate of occurrence of an event.

Poisson Distribution Frequency 0 5 10 15 20 lambda=5 lambda=2 Distn 1 2 0 4 8 Poisson 0 4 8 Poisson Figure: Comparing Poisson Distributions

Poisson Probabilities Suppose that there are 1.5 homicides a week. The parameter λ is the rate, so λ = 1.5 Poisson distribution tells us that there is a still a 1.4% chance of seeing 5 homicides in a week P(X = 5) = e 1.5 (1.5) 5 5! = 0.014 On average this will happen once every 1/0.014 = 71 weeks

Poisson Probabilities What s the chance of having no homicides in a week? Poisson distribution gives P(X = 0) = e 1.5 (1.5) 0 0! = 0.22 So the probability is as high as 22 % You shouldn t be surprised to see this happening The underlying rate is still 1.5 per week. In R: dpois(x,lambda) and rpois(1000,lambda)

English Premier League (EPL) How do we calculate odds for the possible scores in a match? 0 0, 1 0, 0 1, 1 1, 2 0,... Let X = Goals scored by Arsenal and Y = Goals scored by Liverpool What s the odds of a team winning? P (X > Y ) Odds s of a draw? P (X = Y ) z1 = rpois(100,0.6) z2 = rpois(100,1.4) sum(z1<z2)/100 sum(z1=z2)/100 # Team 2 wins # Draw

Chelsea EPL 2014 Let s take a historical set of data on scores Then estimate λ with the sample mean 1 Chelsea 2 0 Hull City 2 Chelsea 2 1 Aston Villa 3 Manchester United 0 0 Chelsea 4 Everton 1 0 Chelsea 5 Chelsea 2 0 Fulham 6 Tottenham Hotspur 1 1 Chelsea...

EPL Chelsea Figure: Poisson Distribution for Goals Scored Our Poisson model fits the empirical data!!

EPL Chelsea Figure: Poisson Distribution for Goals Against Chelsea has a great defence Again our model fits the outcomes

EPL: Poisson Distribution Given λ the average number of goals scored

EPL Attack and Defence Strength Each team gets an attack strength and defence weakness rating Adjust home and away average goal estimates

Modeling Hull vs ManU Poisson Distribution ManU Average away goals = 1.06. Prediction: 1.06 1.46 1.37 = 2.12 Attack strength times Hull s defense weakness times average Hull Average home goals = 1.36. Prediction: 1.36 0.85 0.52 = 0.60. Simulation

EPL Predictions A model is only as good as its predictions

Business Statistics: 41000 Week 4: A/B Testing Nick Polson http://faculty.chicagobooth.edu/nicholas.polson/teaching/41000/

A/B Testing Scientific Testing is the underpinning of many things... Controlled experiment (designed) or observational study 1. A Statistic. Sample mean, proportion, difference in means,... 2. A Null hypothesis: H 0 : µ = µ 0, H 0 : p = p 0,... A level of significance α 3. Sampling distribution: The probability distribution of the statistics values (Normal, t)

Sampling distribution of a Proportion Suppose the r.v. X is the number of successes in a binomial sample of n trials, whose probability of success is p. The sample proportion is ˆp = X /n 1. E(ˆp) = p 2. It has standard error s.e.( ˆp) = p(1 p) n. 3. If n is large (np(1 p) > 9 or roughly n 40), ˆp N(p, σ 2ˆp ) = N(p, p(1 p)/n).

Z and T-Score How many standard deviations are you away from the mean? We ll address this with a Z or T -score If σ is unknown, we ll use s instead Z = X µ σ/ n T = X µ s/ n For small samples, Student s t distribution with (n 1) degrees of freedom. Guinness: Testing the quality of beer in 1908.

Coke versus Pepsi The most famous hypothesis test in history in whether people can decide the difference between Coke and Pepsi Double Blind: neither the experimenter or subject know the allocation Pepsi claimed that more than 1 2 of Diet Coke drinkers said they preferred to drink Diet Pepsi Suppose we take a random sample of 100 drinkers and find that 56 favor Pepsi?

Coke versus Pepsi This is a hypothesis test about the proportion of drinkers who prefer Pepsi H 0 : p = 1 2 and H 1 : p > 1 2 ˆp = X /n = 56/100 = 0.56 This is my best estimate of the true p se(ˆp) The standard error of my statistic ˆp(1 ˆp)/n = 0.0496. The 95% confidence interval is then 0.56 ± 1.96(0.0496) = 0.56 ± 0.098 = (0.463, 0.657) p = 0.5 lies inside the confidence interval. Conclusion?

Testing The Z -score now with sˆp = p 0 (1 p 0 )/n = 0.05 Let s take the usual α = 0.05 Z = ˆp p 0 0.56 0.5 = = 1.2 < 1.64 sˆp 0.05 Don t reject H 0 for a one-sided test at 5% level. We need a larger n to come to a more definitive conclusion. Common to take n = 1000, 2000 As a Hypothesis test: prop.test(56,100,alternative=''greater'', conf.level = 0.95)

A/B Testing The key elements of hypothesis testing are: 1. Setting Up a Hypothesis Test 2. Significance Levels 3. p-values 4. Testing a Mean and Difference in Means 5. Testing a Proportion 6. Tests for Small Samples

What is Hypothesis Testing? A hypothesis is a statement about a population developed for the purpose of testing with data Step 1: Null Hypothesis (H 0 ): assume to be true unless there is sufficient evidence to the contrary. Alternative Hypothesis (H 1 ): test against the null. If there is evidence that H 0 is false, we accept H 1. Step 2: Select the significance level α. α = 0.05 (the 5% level) is the most commonly used. α = 0.01 (the 1% level) is prevalent in medical and quality assurance examples.

Hypothesis Testing Making a decision Step 3: Compute the Test Statistic (Z or T ) Step 4: Formulate the Decision Rule For example, reject the Null hypothesis if Z > 1.96 Step 5: Make a Decision, Compute the p-value. p-value: The smallest significance level at which a null hypothesis can be rejected.

Type I and II Errors There are two types of errors you can make when testing 1. Type I Error: Rejecting a true H 0. 2. Type II Error: Not rejecting a false H 0. Significance Level: P(rejectH 0 H 0 true) = P(type I error).

Type I and II Errors Economist

Scientific Reporting Higgs Boson The five-sigma concept is somewhat counter-intuitive. It has to do with a one-in-3.5-million probability. That is not the probability that the Higgs boson doesn t exist. It is, rather, the inverse: If the particle doesn t exist, one in 3.5 million is the chance an experiment just like the one announced this week would nevertheless come up with a result appearing to confirm it does exist. In other words, one in 3.5 million is the likelihood of finding a false positive a fluke produced by random statistical fluctuation that seems as definitive as the findings released by two teams of researchers at the CERN laboratory in Geneva. p-value one-in-3.5-million and Z-score Z = 5.

Biogen and Avonex Biogen made the following assertion: Avonex delivers the highest rate of satisfaction: 95% among patients 1. The U.S. Food and Drug Administration (FDA) on October 30th, 2002 informed the biotech company Biogen to stop publishing misleading promotions for its multiple sclerosis drug Avonex. 2. The FDA found that in a random sample of 75 patients surveyed, only 60% said they were very satisfied with Avonex. Who is Right?

Setting up a Hypothesis Test Step 1: The null hypothesis: H 0 : p = 0.95 = p 0. The alternative hypothesis: H 1 : p < 0.95. A 1-sided alternative. Step 2: We ll use a small significance level, 1%. Step 3: The appropriate test statistic is where ˆp = 0.60, p 0 = 0.95 and n = 75. Hence Z = 0.6 0.95 0.95 0.05 75 = 14. Z = ˆp p 0 p 0 (1 p 0 ) n

Critical Region Now lets find the critical region and p-value Step 4: The critical region is Z < 2.32. As the observed test statistic Z falls well within the rejection region. We reject H 0 at the 1% level. Step 5: The p-value of the test is P(Z < 14) = 0.0000. Again the statistical evidence is that the FDA is right and Biogen is not.

Avonex: Testing Proportions in R Null Hypothesis: Biogen is innocent prop.test(45,75,0.95) data: 45 out of 75, null probability 0.95 95 percent confidence interval: 0.4802630 0.7094213 sample estimates: p 0.6 The p-value is 2.2 10 16!

Pfizer Pfizer introduced Viagra in early 1998 During 1998 of the 6 million Viagra users 77 died from coronary problems such as heart attacks. Pfizer claimed that this rate is no more than the general population. A clinical study found 11 out of 1, 500, 000 men who were not on Viagra died of coronary problems during the same length of time as the 77 Viagra users who died in 1998. Is this statistically significant?

Confidence Interval A 95% confidence interval for a difference in proportions p 1 p 2 is (ˆp 1 ˆp 2 ) ± 1.96 ˆp 1 (1 ˆp 1 ) n 1 + ˆp 2(1 ˆp 2 ) n 2 1. Can do a confidence interval or a Z -score test. 2. With Viagra, ˆp 1 = 77/6000000 = 0.00001283 and without Viagra ˆp 2 = 11/1500000 = 0.00000733. 3. Need to test whether these are equal.

Confidence Interval With a 95% confidence interval for (p 1 p 2 ) you get an interval (0.00000549, 0.0000055) This doesn t contain zero. The evidence is that the proportion is higher. 1. Measured very accurately as n is large even though p is small. 2. With testing might use a one-sided test and an α of 0.01.

Viagra Difference of proportions: prop.test(x=c(11,77), n=c(1500000,6000000), alternative= greater,conf.level=.95) 2-sample test for equality of proportions with continuity correction data: c(11, 77) out of c(1500000, 6e+06) X-squared = 2.6428, df = 1, p-value = 0.948 95 percent confidence interval: -1.027715e-05 1.000000e+00 sample estimates: prop 1 prop 2 7.333333e-06 1.283333e-05

Discovering Argon Lord Rayleigh won the Nobel Prize for discovering Argon. This discovery occurred when he noticed a small discrepancy between two sets of measurements on nitrogen gas that he had extracted from the air and one he had made in the lab. 1. First, he removed all oxygen from a sample of air. He measured the density of the remaining gas in a fixed volume at constant temperature and pressure. 2. Second, he prepared the same volume of pure nitrogen by the chemical decomposition of nitrous oxide (N 2 O) and nitric oxide NO. Here s the results

Data Lord Rayleigh''s Measured Masses of Nitrogen Lord Rayleigh s data... Mass (g) 2.298 2.302 2.306 2.310 Nitrogen from Air Nitrogen from Chemical Decomposition From air From chemical decomposition 2.31017 2.30143 2.30986 2.29890 2.31010 2.29816 2.31001 2.30182 2.31024 2.29869 2.31010 2.29940 2.31028 2.29849 2.29889 average 2.31011 2.29947 st dev 0.00014 0.00138

Discovering Argon in R t.test(a,b,var.equal=t) t = 20.2137, df = 13, p-value = 3.321e-11 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.009499327 0.011772816 sample estimates: mean of x mean of y 2.310109 2.299473 There s a T = 20.21! We ve found Argon!

Electronic Arts EA SimCity 5, one of EA s most popular video games, sold 1.1 million copies in the first two weeks of its launch last year. 50% of digital sales due to a A/B testing strategy. Promotion banner or not? Surprising results: The variation with no offer messaging whatsoever drove 43.4% more purchases. Confounding variables?

R: abtest Examine whether a black or pink background results in more purchases Run experiment for one week: Pink background: 40% purchase rate with 500 visitors Black background: 30% purchase rate with 550 visitors abtest to see which is more effective

R: abtest CI: conversion rates for each variation of site abtestfunc function calculates CIs (80% significance, Z = 1.28) site1 = c(.40, 500) # pink site2 = c(.30, 550) # black abtestfunc <- function(ad1, ad2){ sterror1 = sqrt( ad1[1] * (1-ad1[1]) / ad1[2] ) sterror2 = sqrt( ad2[1] * (1-ad2[1]) / ad2[2] ) minmax1 = c((ad1[1] - 1.28*sterror1) * 100, (ad1[1] + 1.28*sterror1) * 100) minmax2 = c((ad2[1] - 1.28*sterror2) * 100, (ad2[1] + 1.28*sterror2) * 100) print( round(minmax1,2) ) print( round(minmax2,2) ) } abtestfunc(site1, site2) Purchase rate for the pink background is significantly higher

Google Google offers A/B Testing Figure: Steps to create A/B testing on Google

Netflix Netflix Every product change Netflix considers goes through a rigorous A/B testing process before becoming the default user experience. Team of data scientists constantly A/B test their innovations to adjust adaptive streaming and content delivery network algorithms.

Summary Learning from Data Estimating Parameters and Fitting Distributions Confidence and Prediction Intervals Means, Proportions, Differences A/B Testing