Hypothesis tests for comparing two propor3ons and two means

Similar documents
Understanding probability using games

CS 149: Understanding Sta2s2cs Using Baseball

Experimental Design and Data Analysis Part 2

Stat 139 Homework 3 Solutions, Spring 2015

Does the LA Galaxy Have a Home Field Advantage?

b. Graphs provide a means of quickly comparing data sets. Concepts: a. A graph can be used to identify statistical trends

Collecting, Preserving, and Curating Insects. Lab 2, 5 February 2015

Chapter 1 Test B. 4. What are two advantages of using simulation techniques instead of actual situations?

Analyzing Sports Data. Ken McAlinn Joe Futoma

Analyzing Sports Data

1. Answer this student s question: Is a random sample of 5% of the students at my school large enough, or should I use 10%?

Week 7 One-way ANOVA

Unit4: Inferencefornumericaldata 4. ANOVA. Sta Spring Duke University, Department of Statistical Science

MATH 118 Chapter 5 Sample Exam By: Maan Omran

Name May 3, 2007 Math Probability and Statistics

Warm up: At what number do you think this ruler would balance on a pencil point?

TAKE A CHANCE PART 1 UNDERSTANDING RANDOMNESS PROBABILITY COUNTING TECHNIQUES LAWS OF PROBABILITY

STATISTICS - CLUTCH CH.5: THE BINOMIAL RANDOM VARIABLE.

Running head: DATA ANALYSIS AND INTERPRETATION 1

GEOMETRY CIRCLING THE BASES PRE-VISIT - BALLPARK FIGURES - PART 2

PLEASE MARK YOUR ANSWERS WITH AN X, not a circle! 2. (a) (b) (c) (d) (e) (a) (b) (c) (d) (e) (a) (b) (c) (d) (e)...

The difference between a statistic and a parameter is that statistics describe a sample. A parameter describes an entire population.

Do Clutch Hitters Exist?

TOPIC 10: BASIC PROBABILITY AND THE HOT HAND

Lesson 2 Pre-Visit Batting Average Part 1: Fractions

Relative Value of On-Base Pct. and Slugging Avg.

Science Detective s Notebook #1: Diffusion

NCSS Statistical Software

Which On-Base Percentage Shows. the Highest True Ability of a. Baseball Player?

Model 1: Reasenberg and Jones, Science, 1989

BIOL 101L: Principles of Biology Laboratory

5.1 Introduction. Learning Objectives

Lab 8 - Continuation of Simulation Let us investigate one of the problems from last week regarding a possible discrimination suit.

Math 1040 Exam 2 - Spring Instructor: Ruth Trygstad Time Limit: 90 minutes

Unit 4: Inference for numerical variables Lecture 3: ANOVA

Student Exploration: Boyle s Law and Charles Law

Looking at Spacings to Assess Streakiness

PGA Tour Scores as a Gaussian Random Variable

Lecture 16: Chapter 7, Section 2 Binomial Random Variables

Analyzing the effec/veness of the CIDR Report. Stephen Woodrow MIT CSAIL

Math 121 Test Questions Spring 2010 Chapters 13 and 14

First Server Advantage in Tennis. Michelle Okereke

Sample Final Exam MAT 128/SOC 251, Spring 2018

South Island Titles SOUTH ISLAND R3 BMXNZ SUPERTOUR. 12 & 13 January mainland REGION 2019 BMX NEW ZEALAND SOUTH ISLAND TITLES

Internal Energy and Work

Chapter 5 ATE: Probability: What Are the Chances? Alternate Activities and Examples

2014 Tulane Baseball Arbitration Competition Eric Hosmer v. Kansas City Royals

A decade of EUV resist outgas tes2ng Lessons learned. C. Tarrio, S. B. Hill, R. F. Berg, T. B. Lucatorto NIST, Gaithersburg, MD, USA

Black Sea Bass Encounter

Assignment. To New Heights! Variance in Subjective and Random Samples. Use the table to answer Questions 2 through 7.

The MLB Language. Figure 1.

Policy Gradient RL to learn fast walk

Examples of Dependent and Independent Events

A few things to remember about ANOVA

Analysis of Variance. Copyright 2014 Pearson Education, Inc.

Math SL Internal Assessment What is the relationship between free throw shooting percentage and 3 point shooting percentages?

Section 5.1 Randomness, Probability, and Simulation

1. In a hypothesis test involving two-samples, the hypothesized difference in means must be 0. True. False

Probability & Statistics - Solutions

Introduction (2 of 2) Systematic approach should be followed

Fly Vision. Steven Parada. neuron of the fly, a neuron that picks out horizontal motion. The neuron is directionally selective

Statistical Theory, Conditional Probability Vaibhav Walvekar

Chapter 12 Practice Test

Here are the basic steps you need to do to get started. Each is covered in much more detail in their respective web pages.

Basic Pneumatics. Module 8: Pressure control valves. Academic Services PREPARED BY. April 2012

Basic Pneumatics. Module 9: Time delay valve. Academic Services PREPARED BY. April 2012

Ppolf Adapted as a flicking game for piecepack by Mark A. Biggar

Introduction to Analysis of Variance (ANOVA) The Structural Model, The Summary Table, and the One- Way ANOVA

Junior Cycle Science - First Year

b) A child is selected at random and is found to be a girl. What is the probability that the other child of the family is a girl?

Intersec(ons of the Future: Using Fully Autonomous Vehicles

Activity: the race to beat Ruth

George F. Will, Men at Work

THE KNOWLEDGE NETWORKS-ASSOCIATED PRESS POLL SPORTS POLL (BASEBALL) CONDUCTED BY KNOWLEDGE NETWORKS July 6, 2009

PREDICTING the outcomes of sporting events

download.file(" destfile = "kobe.rdata")

Using Multi-Class Classification Methods to Predict Baseball Pitch Types

Section 3: Displacements and Vectors

Major League Baseball Offensive Production in the Designated Hitter Era (1973 Present)

Level 3 Mathematics and Statistics (Statistics), 2013

Master of Arts In Mathematics

S.CP.B.9: Binomial Probability 4

Section I: Multiple Choice Select the best answer for each problem.

arxiv: v2 [stat.ap] 4 Nov 2017

Exploring the Properties of Gases

One-way ANOVA: round, narrow, wide

An Investigation: Why Does West Coast Precipitation Vary from Year to Year?

8 th grade. Name Date Block

Robust specification testing in regression: the FRESET test and autocorrelated disturbances

(JUN10SS0501) General Certificate of Education Advanced Level Examination June Unit Statistics TOTAL.

Palythoa Abundance and Coverage in Relation to Depth

Is lung capacity affected by smoking, sport, height or gender. Table of contents

Basic Pneumatics. Module 7: Time delay valve and sequence control systems. Academic Services PREPARED BY. January 2013

Do Steph Curry and Klay Thompson Have Hot Hands?

Lab 2: Probability. Hot Hands. Template for lab report. Saving your code

Why We Should Use the Bullpen Differently

Overview. League financials will be tiered and are discussed on our Financials page.

Select Boxplot -> Multiple Y's (simple) and select all variable names.

Tie Breaking Procedure

An Empirical Comparison of Regression Analysis Strategies with Discrete Ordinal Variables

Transcription:

Hypothesis tests for comparing two propor3ons and two means

Outline for today Be#er know a player Masanori Murakami Review of hypothesis tests for two propor8ons Hypothesis tests for two means Worksheet 9

Be:er know a player Masanori Murakami

MLBAM @ 2014 MIT Sloan Analy3cs Conference Big Data Baseball Page 174 Analyzing a catch by Jason Heyward

Steps for doing a hypothesis test 1. State the null and alterna8ve hypothesis 2. Calculate the observed sta8s8c 3. Create a null distribu8on Typical sta8s8cs you would expect to get if the null hypothesis was true 4. Create a p-value calculate the probability of gepng a sta8s8cs as great or greater than the observed from the null distribu8on

Five steps of hypothesis tes3ng 1. Assume innocence: H 0 is true State H 0 and H A 2. Gather evidence Calculate the observed sta8s8c 3. Create a distribu8on of what evidence would look like if H 0 is true Null distribu8on 4. Assess the probability that the observed evidence would come from the null distribu8on p-value 5. Make a judgement Assess whether the results are sta8s8cally significant

Tes3ng whether two propor3ons differ Ques8on: Is Alex Rodriguez s OBP ability higher than Mario Mendoza s? i.e., if they had infinite plate appearances, who is be#er? A-Rod and Mendoza s performance through the 2014 season is: Mendoza A-Rod On-base 345 4348 Plate appearances (minus SH) 1407 11328 OBP 0.245 0.384

Is A-Rod s OBP ability be:er than Mendoza s We can do a hypothesis test whether A-Rod s OBP ability is be#er than Mendoza s ability 1. State the null and alterna8ve hypotheses in symbols and words H 0 : π ARod = π M or π ARod - π M = 0 H A : π ARod > π M or π ARod - π M > 0 What do we do next? 2. Observed sta8s8c is:.384 -.245 =.139 Now what do we do?

Is A-Rod s OBP ability be:er than Mendoza s How can we create a null distribu3on of this sta8s8c that is consistent with the null hypothesis? We can use simula8ons! Mendoza A-Rod On-base 345 4348 Plate appearances (minus SH) 1407 11328 OBP 0.245 0.384 Total On-base = 4693 Total PA = 12736 Total OBP =.378 Simula8on: 1. Flip a coin 1407 8mes for Mendoza and 12505 for A-Rod 2. Compute difference in propor8on of on-base events 3. Repeat 10,000 8mes

Is A-Rod s OBP ability be:er than Mendoza s Results of the simula8on What do we do next?

Is A-Rod s OBP ability be:er than Mendoza s Results of the simula8on The observed difference in propor8ons was. 139 Where is this.139 on this plot?

Is A-Rod s OBP ability be:er than Mendoza s 0 of the 10,000 different in simulated propor8ons were greater than the observed different in OBP propro8ons so the p-value is p-value = 0 Conclusion?

Crea3ng the null (randomized) distribu3on in R Mendoza A-Rod On-base 345 4348 Plate appearances (minus SH) 1407 11328 OBP.245.384 ARod.PA <- 11328 Mendoza.PA <- 1407 Total.PA <- 11328 + 1407 Total.OB <- 345 + 4348 total.obp <- Total.OB/Total.PA obs.diff.obp <-.384 -.245 # total PA for both players # total 8mes on-base for both players # OBP if both players had the same ability # observed sta8s8c of interest

Crea3ng the null distribu3on in R sim.arod.obp <- rbinom(10000, ARod.PA, total.obp)/arod.pa sim.mendoza.obp <- rbinom(10000, Mendoza.PA, total.obp)/mendoza.pa null.dist.vec <- sim.arod.obp - sim. Mendoza.OBP p.value <- sum(null.dist.vec >= obs.diff.obp)/10000

Comparing two means Have baseball games go#en longer in the past 50 years? How could we examine this? Compare mean lengths of games in 1964 to those in 2014 See Moodle: load("/home/shared/all.game.logs.rda") game.logs$year <- substr(game.logs$date, 1, 4) game.logs54 <- filter(game.logs, LengthInOuts == 54) game.logs.54.out.1964 <- filter(game.logs54, year == 1964) game.logs.54.out.2014 <- filter(game.logs54, year == 2014) What would be a good first thing to do?

Plot the data Average game length 1964 is: x 1964 (based on n = 684 games with 54 outs) Average game length 2014 is: x 2014 (based on n = 1021 games with 54 outs) = 154.21 minutes = 187.64 minutes

1. Null and Alterna3ve Hypotheses 1a. State the null and alterna8ve hypotheses in words Null hypothesis: Baseball games are the same length in 1964 as they are in 2014 Alterna>ve hypothesis: Baseball games are longer in 2014 than in 1964 1b. State the null and alterna8ve hypotheses using symbols H 0 : μ 2014 = μ 1964 or μ 2014 - μ 1964 = 0 H A : μ 2014 > μ 1964 or μ 2014 - μ 1964 > 0 What do we do next? 2. Compute the sta8s8c of interest What is the sta8s8c of interest?

2. Compute the sta3s3c of interest Average game length 1964 is: (based on n = 684 games with 54 outs) Average game length 2014 is: (based on n = 1021 games with 54 outs) x 1964 x 2014 = 154.21 minutes = 187.64 minutes So the sta8s8c of interest is? observed.stat <- 187.64-154.21 = 33.42 minutes What do we do next? 3. Create a null distribu8on

Hypothesis tests for two means 3. Calculate the null distribu>on How can we create a null distribu8on??? One way: under the null hypothesis all games lengths from 1964 and 2014 are equally likely Thus combine all the games lengths from the 1964 and 2014 seasons into one vector We can then randomly select 684 games to simulate the 1964 season and take the remaining 1021 to simulate the 2014 season The difference in these means of these 684 and 1021 games gives us one point in the null distribu8on If we repeat this 10,000 8mes we will get a full null distribu8on

Hypothesis tests for two means Do the results seem sta8s8cally significant? Observed difference of 33 minutes is not even close to being on this figure Conclusions?

Implemen3ng this permuta3on test in R # game dura8ons for 1964 and 2014 game.dura8on.1964 <- game.logs.54.outs.1964$dura8on game.dura8on.2014 <- game.logs.54.outs.2014$dura8on # number of games in 1964 and 2014 num.games.1964 <- length(game.dura8on.1964) num.games.2014 <- length(game.dura8on.2014) # the observed sta8s8c obs.diff <- mean(game.dura8on.2014) - mean(game.dura8on.1964) # combine data from both seasons together combined.dura8ons <- c(game.dura8on.1964, game.dura8on.2014)

Implemen3ng this permuta3on test in R null.dist <- NULL for (i in 1:10000) { # shuffle the combined game dura8ons shuffled.dura8ons <- sample(combined.dura8ons) # get the random dura8ons for 1964 and 2014 shuff.1964 <- shuffled.dura8ons[1:num.games.1964] shuff.2014 <- shuffled.dura8ons[(num.games.1964 +1) :length(shuffled.dura8ons)] } # calculate the observed sta8s8c under the null hypothesis null.dist[i] <- mean(shuff.2014) - mean(shuff.1964) hist(null.dist, n = 100, main = 'Null Dist', xlab = 'Mean diff')) p.value <- sum(null.dist >= obs.diff)/10000 # display the null distribu8on

Worksheet 9 > source('/home/shared/baseball_stats/baseball_class_func8ons.r') > get.worksheet(9)