MAT2377. Rafa l Kulik. Version 2015/November/23. Rafa l Kulik

Similar documents
[ z = 1.48 ; accept H 0 ]

Hypothesis testing for µ:

AP Statistics Ch 12 Inference for Proportions

CHAPTER 9: HYPOTHESIS TESTING

Chapter 9. Hypothesis testing. 9.1 Introduction

Midterm 1 and 2 results

MAT 2377C FINAL EXAM PRACTICE

Chapter 9 Inferences from Two Samples

ST Introduction to Statistics for Engineers. Solutions to Sample Midterm for 2002

Hypothesis for Means and Proportions

LECTURE 12 CONFIDENCE INTERVAL AND HYPOTHESIS TESTING

Probability and Statistics Notes

Problem Set 4 - Solutions

CIVL /8904 T R A F F I C F L O W T H E O R Y L E C T U R E - 8

Two-Sample Inferential Statistics

Chapter 22. Comparing Two Proportions. Bin Zou STAT 141 University of Alberta Winter / 15

Statistics 301: Probability and Statistics 1-sample Hypothesis Tests Module

MAT 2379, Introduction to Biostatistics, Sample Calculator Questions 1. MAT 2379, Introduction to Biostatistics

Statistics 251: Statistical Methods

ME3620. Theory of Engineering Experimentation. Spring Chapter IV. Decision Making for a Single Sample. Chapter IV

MATH 333: Probability & Statistics. Final Examination (Fall 2004) Must show all work to receive full credit. Total. Score #1 # 2 #3 #4 #5 #6 #7 #8

AMS7: WEEK 7. CLASS 1. More on Hypothesis Testing Monday May 11th, 2015

Comparing Means from Two-Sample

Section 9.4. Notation. Requirements. Definition. Inferences About Two Means (Matched Pairs) Examples


Name: Exam: In-term Two Page: 1 of 8 Date: 12/07/2018. University of Texas at Austin, Department of Mathematics M358K - Applied Statistics TRUE/FALSE

M(t) = 1 t. (1 t), 6 M (0) = 20 P (95. X i 110) i=1

The point value of each problem is in the left-hand margin. You must show your work to receive any credit, except on problems 1 & 2. Work neatly.

Practice Questions: Statistics W1111, Fall Solutions

Confidence Intervals with σ unknown

Chapter 15 Sampling Distribution Models

The Components of a Statistical Hypothesis Testing Problem

STAT 201 Assignment 6

SMAM 314 Exam 49 Name. 1.Mark the following statements true or false (10 points-2 each)

# of 6s # of times Test the null hypthesis that the dice are fair at α =.01 significance

5.2 Tests of Significance

Chapter 22. Comparing Two Proportions 1 /29

MATH220 Test 2 Fall Name. Section

Chapter 24. Comparing Means. Copyright 2010 Pearson Education, Inc.

their contents. If the sample mean is 15.2 oz. and the sample standard deviation is 0.50 oz., find the 95% confidence interval of the true mean.

Chapitre 3. 5: Several Useful Discrete Distributions

Confidence intervals and Hypothesis testing

Sign test. Josemari Sarasola - Gizapedia. Statistics for Business. Josemari Sarasola - Gizapedia Sign test 1 / 13

Point Estimation and Confidence Interval

The point value of each problem is in the left-hand margin. You must show your work to receive any credit, except in problem 1. Work neatly.

Statistics for IT Managers

Lecture 14. Analysis of Variance * Correlation and Regression. The McGraw-Hill Companies, Inc., 2000

Lecture 14. Outline. Outline. Analysis of Variance * Correlation and Regression Analysis of Variance (ANOVA)

Relax and good luck! STP 231 Example EXAM #2. Instructor: Ela Jackiewicz

Hypothesis testing. Data to decisions

Tentative solutions TMA4255 Applied Statistics 16 May, 2015

Lecture 11 - Tests of Proportions

Extra Exam Empirical Methods VU University Amsterdam, Faculty of Exact Sciences , July 2, 2015

Math 101: Elementary Statistics Tests of Hypothesis

1 Binomial Probability [15 points]

HYPOTHESIS TESTING. Hypothesis Testing

CH.9 Tests of Hypotheses for a Single Sample

CHAPTER 8. Test Procedures is a rule, based on sample data, for deciding whether to reject H 0 and contains:

The t-statistic. Student s t Test

The t-test: A z-score for a sample mean tells us where in the distribution the particular mean lies

Difference Between Pair Differences v. 2 Samples

SL - Binomial Questions

Hypothesis Tests and Estimation for Population Variances. Copyright 2014 Pearson Education, Inc.

One-Sample and Two-Sample Means Tests

Data Analysis and Statistical Methods Statistics 651

Purposes of Data Analysis. Variables and Samples. Parameters and Statistics. Part 1: Probability Distributions

The Chi-Square Distributions

10.4 Hypothesis Testing: Two Independent Samples Proportion

Chapter 20 Comparing Groups

QUEEN S UNIVERSITY FINAL EXAMINATION FACULTY OF ARTS AND SCIENCE DEPARTMENT OF ECONOMICS APRIL 2018

UNIVERSITY OF TORONTO. Faculty of Arts and Science APRIL - MAY 2005 EXAMINATIONS STA 248 H1S. Duration - 3 hours. Aids Allowed: Calculator

The Chi-Square Distributions

Hypothesis tests for two means

Lecture 14: Introduction to Poisson Regression

Modelling counts. Lecture 14: Introduction to Poisson Regression. Overview

Chapter 22. Comparing Two Proportions 1 /30

Lecture 10: Comparing two populations: proportions

HYPOTHESIS TESTING II TESTS ON MEANS. Sorana D. Bolboacă

An inferential procedure to use sample data to understand a population Procedures

Interpretation of results through confidence intervals

hypotheses. P-value Test for a 2 Sample z-test (Large Independent Samples) n > 30 P-value Test for a 2 Sample t-test (Small Samples) n < 30 Identify α

Sampling Distributions: Central Limit Theorem

Inferences Based on Two Samples

CHAPTER 10 HYPOTHESIS TESTING WITH TWO SAMPLES

Chapter 7: Hypothesis Testing - Solutions

Examination paper for TMA4255 Applied statistics

Chapter. Hypothesis Testing with Two Samples. Copyright 2015, 2012, and 2009 Pearson Education, Inc. 1

Ch. 7. One sample hypothesis tests for µ and σ

Last two weeks: Sample, population and sampling distributions finished with estimation & confidence intervals

STA Module 10 Comparing Two Proportions

Chapter 5: HYPOTHESIS TESTING

You may not use your books/notes on this exam. You may use calculator.

Exam 2 (KEY) July 20, 2009

Sampling, Confidence Interval and Hypothesis Testing

Test of Hypothesis for Small and Large Samples and Test of Goodness of Fit

Difference between means - t-test /25

STAT 135 Lab 5 Bootstrapping and Hypothesis Testing

Two Sample Problems. Two sample problems

Inferences About Two Proportions

Population 1 Population 2

Transcription:

MAT2377 Rafa l Kulik Version 2015/November/23 Rafa l Kulik

Rafa l Kulik 1

Rafa l Kulik 2

Rafa l Kulik 3

Rafa l Kulik 4

The Z-test Test on the mean of a normal distribution, σ known Suppose X 1,..., X n is a random sample from a population with mean µ and variance σ 2, and let X = 1 n n i=1 X i denote the sample mean. If the population is normal, then X exact N (µ, σ 2 /n) ; Even if the population is not normal, if n is large enough then by the approx Central Limit Theorem X N (µ, σ 2 /n). We will assume that the population variance σ 2 is known, but the hypothesis concerns the unknown population mean µ. Rafa l Kulik 5

We are going to test H 0 : µ = µ 0, where µ 0 is a constant. Step 1: H 0 : µ = µ 0 Step 2: Choose H A as one of 1. H A : µ < µ 0 (one-sided test) 2. H A : µ > µ 0 (one-sided test) 3. H A : µ µ 0 (two-sided test) The form of hypotheses will depend on what we try to show or to conclude. As alternative, we choose what we try to demonstrate by data. Rafa l Kulik 6

Examples: 1. Suppose that an old method of production yields 100 articles/day on average. We want to introduce a new method which is supposed to be more effective (in other words, the average daily production will be bigger than 100). The appropriate test is H 0 : µ = 100 vs. H A : µ > 100. 2. Suppose that a manufacturer states that the mean lifetime of tires is 60,000km. A group of customers believes that the mean is lower than 60,000km. The appropriate test is H 0 : µ = 60, 000 vs. H A : µ < 60, 000. Rafa l Kulik 7

3. A physician is interested whether a particular drug has significant effect on a blood pressure. He measures blood pressure after the treatment and compares with the usual one of 110. The appropriate test is H 0 : µ = 110 vs. H A : µ 110. In the first case we may reject H 0 only if a sample mean is much bigger than 100. In the second, only if a sample mean is much smaller than 60,000. In the last case, we may reject H 0 if a sample mean is much smaller or much bigger than 110. In the first case, if we reject H 0, we have strong evidence that the new method improves. If we formulate H A in the first case as H A : µ 100, then me may reject H 0 if the sample mean is small. If we reject H 0, then the only meaning of it is that the new method is different. Rafa l Kulik 8

Step 3: Choose α - probability of type I error: α = P (reject H 0 H 0 is true). Typically α = 0.01, 0.05. Step 4: Computation of the test statistics X. Step 5: Calculation of p-value by comparing the test statistics with the observed value of the test statistics. Rafa l Kulik 9

Examples 1. Components are manufactured to have strength normally distributed with mean µ = 40 units and standard deviation σ = 1.2 units. A modification have been tried, for which an increase in mean strength is claimed (the standard deviation remains the same). A random sample of n = 12 components produced using the modified process had strength 42.5, 39.8, 40.3, 43.1, 39.6, 41.0, 39.9, 42.1, 40.7, 41.6, 42.1, 40.8, Do the data provide strong evidence that the mean strength exceeds 40 units? (Use α = 0.05) Rafa l Kulik 10

Step 1 H 0 : µ = 40 Step 2 H A : µ > 40 Computation of p-value: Observed value of the sample mean is x = 41.125. Hence p-value = P ( X 41.125) = P ( X 41.125) ( X µ0 = P σ/ n 41.125 µ ) 0 σ/ = P (Z 3.25) 0.006. n So, p-value is smaller than α - reject H 0. If the model µ = 40 is true, the event { X 41.125} is very unlikely. Rafa l Kulik 11

2. A set of scales is working acceptably if the measurement differs from the true weight by a normally distributed random error with sd σ = 0.007 grams. It is suspected that the scale is over-reading. To test it, 10 measurements are made on a 1.0 gram gold-standard weight, giving a set of measurements which average out to 1.0038g. Is this the evidence that the scale is over-reading? (Use α = 0.05 and then α = 0.01) Step 1 and 2 H 0 : µ = 1.0 vs. H A : µ > 1.0 Computation of p-value: Observed value of the sample mean is x = 1.0038. Hence p-value = P ( X 1.0038) = P = P ( Z 0.0038 0.007/ 10 ( X µ0 σ/ n 1.0038 µ 0 σ/ n Do not reject H 0 for α = 0.01, do reject H 0 for α = 0.05. ) ) 1 Φ(1.7166) 0.043. Rafa l Kulik 12

3. In the previous example, let s assume that we are interested whether the scales work properly (which means that both under-reading and over-reading are not acceptable). Step 1 H 0 : µ = 1.0; Step 2 H A : µ 1.0 Computation of p-value: Observed value of the sample mean is x = 1.0038. Hence p-value = 2 P ( X 1.0038) = 2 P = 2 P ( Z 0.0038 ) 0.007/ 10 ( X µ0 σ/ n 1.0038 µ ) 0 σ/ n 0.086 Do not reject H 0 for α = 0.01, do not reject H 0 for α = 0.05. Rafa l Kulik 13

4. An average class marks are normally distributed with mean µ = 60 and variance σ 2 = 100. Nine students are selected from the class and their average mark was 55. Test, whether this class is below average. Solution: Step 1 H 0 : µ = 60 Step 2 H A : µ < 60 Computation of p-value P ( X 55) = P ( Z ) 55 60 10/ 9 = 0.07. There is not enough evidence to reject the claim that the class is average, regardless whether we use α = 0.05 or α = 0.01. Rafa l Kulik 14

5. An average class marks have mean µ = 60 and variance σ 2 = 100. 100 students are selected from the class and their average mark was 55. Test, whether this class is below average. Solution: Step 1 H 0 : µ = 60 Step 2 H A : µ < 60 Computation of p-value P ( X 55) = P ( Z 55 60 10/ 100 ) = 0 We reject the claim that the class is average for either choice of α. Rafa l Kulik 15

Tests and confidence intervals If α is given, then we reject H 0 : µ = µ 0 in favor of H A : µ µ 0 only if µ is not in the (1 α) confidence interval for µ 0. Example: A manufacturer claims that a particular type of an engine uses 20 gallons of fuel to operate for one hour. From previous studies it is known that the amount of fuel used per hour is normally distributed with variance σ 2 = 25. A sample of size n = 9 has been taken and the following value has been obtained: x = 23. Should we accept the manufacturer s claim? Use α = 0.05. Step 1 H 0 : µ = 20 Step 2 H A : µ 20 Rafa l Kulik 16

Computation of p-value p-value = 2 P ( X 23) = 2 P ( X 23) = 2 P ( X µ0 σ/ n 23 µ ) 0 σ/ n = 2 P (Z 1.8) 2 0.036 = 0.072. Do not reject H 0 since p-value is bigger than α. Confidence interval: x ± z α/2 σ/ n = 23 ± 1.96 5/ 9 = (19.73; 26.26). We will not reject the claim that µ = 20, µ = 19.74, µ = 26.20 etc. Indeed, let s consider H 0 : µ = 26.20 vs. H A : µ 26.20. Then the observed value of z 0 = x µ 0 σ/ n = 1.92. Now, z 0 < 1.96 = z α/2. Rafa l Kulik 17

Example: We are interested in the mean burning rate of a solid propellant used to power aircrew escape systems. We want to determine whether or not the mean burning rate is 50 cms/second. The sample of 10 specimens is tested and we observe x = 48.5. Assume normality and σ = 2.5. Solution: Step 1 H 0 : µ = 50 Step 2 H A : µ 50 Step 5 p-value = 2 P ( X 48.5) = 2 P ( X 48.5) = 2 P Do not reject H 0 for α = 0.01, reject for α = 0.05. ( X µ0 σ/ n x µ ) 0 σ/ n = 2 P (Z 2.4) 2 0.0082 = 0.0164. Rafa l Kulik 18

t-test If data are normal and σ is unknown we can estimate it by S = 1 n 1 n ( Xi X ) 2 i=1 Then we use the following test statistics: T = X µ S/ n t n 1 and say T has Student s t-distribution with n 1 degrees of freedom. Rafa l Kulik 19

How does it works: We have the following data 18.0 17.4 15.5 16.8 19.0 17.8 17.4 15.8 17.9 16.3 16.9 18.6 17.7 16.4 18.2 18.7 from N (µ, σ 2 ) with completely unknown µ and σ 2. Test H 0 : µ = 16.6 against H A : µ > 16.6. Use α = 0.05. Rafa l Kulik 20

Step 1 H 0 : µ = 16.6 Step 2 H A : µ > 16.6 Computation of p-value The observed value of the sample mean is x = 17.4. Hence P ( X 17.4) = P ( X µ0 S/ n = P (T 0 > 3.081) ) 17.4 16.6 > S/4 where T 0 t 15. From the t-tables we see that = P ( T 0 17.4 ) 16.6 S/4 P (T 0 2.947) 0.005 and P (t 15 3.286) 0.0025. Hence the p-value is somewhere between these, i.e. in the interval (0.0025, 0.005), in particular it is 0.05, strong evidence against H 0 : µ = 16.6. Rafa l Kulik 21

Test on proportion Example: A group of 100 adult American Catholics have been asked: Do you favor allowing women to be priests?. 60 of them answered YES. Is this the strong evidence that more than half American Catholics favor allowing women to be priests? Solution Model: X-number of people who answered YES, X B(100, p). H 0 : p = 0.5, H A : p > 0.5, Under H 0, X B(100, 0.5) Rafa l Kulik 22

p-value: P (X 60): P (X 60) = 1 P (X < 60) = 1 P (X 59) ( ) X np 59 np = 1 P np(1 p) np(1 p) = 1 P (Z 1.9) = 0.0287. Reject H 0 for α = 0.05, don t reject for α = 0.01. Rafa l Kulik 23

Paired test Assumptions: X 11,..., X 1n is a random sample from population 1 X 21,..., X 2n is a random sample from population 2 Two populations are not independent and normal with means µ 1 and µ 2, respectively. Variances are unknown We want to test H 0 : µ 1 = µ 2, H A : µ 1 µ 2. Rafa l Kulik 24

Solution: Compute differences D i = X 1i X 2i and consider t-test from page 36. The test statistics is T 0 = D S D / n t n 1, where D = 1 n S 2 D = 1 n 1 n 1 i=1 n D i, i=1 (D i D) 2 Note: You can also consider one-sided alternatives for both two-sample and paired test. Rafa l Kulik 25

Example Ten engineers knowledge of basic statistical concepts was measured on a scale of 100 before and after a short course in statistical quality control. The result are as follows: Engineer 1 2 3 4 5 6 7 8 9 10 Before X 1i 43 82 77 39 51 66 55 61 79 43 After X 2i 51 84 74 48 53 61 59 75 82 48 Let µ 1 and µ 2 be the mean mean score before and after the course. Test H 0 : µ 1 = µ 2 against µ 1 < µ 2. Rafa l Kulik 26

Solution: The differences D i = X 1i X 2i are: Engineer 1 2 3 4 5 6 7 8 9 10 Before X 1i 43 82 77 39 51 66 55 61 79 43 After X 2i 51 84 74 48 53 61 59 75 82 48 Difference D i -8-2 3-9 -2 5-4 -14-3 -5 so that the observed sample mean is -2.9, the observed sample variance is SD 2 = 31.21. The test statistic is T 0 = D S D / n t n 1. Rafa l Kulik 27

We compute P ( D 2.9) = P ( ) D 0 S D / n 2.9 31.21/10 = P (t 9 < 1.64) = P (t 9 > 1.64) (0.05, 0.1) Do not reject H 0 when α = 0.05 or α = 0.01. Rafa l Kulik 28

Assumptions: Two Sample Test X 11,..., X 1n1 is a random sample from population 1 X 21,..., X 2n2 is a random sample from population 2 Two populations are independent We want to test H 0 : µ 1 = µ 2, H A : µ 1 µ 2. Let X 1 = 1 n 1 n 1 i=1 X 1i, X2 = 1 n 2 n 2 i=1 X 2i. Rafa l Kulik 29

Case 1: Known variances σ 2 1 and σ 2 2 Example: A researcher is interested to assess whether an income in Alberta is higher than in Ontario. A sample of 100 people from Alberta has been interviewed yielding the sample mean x 1 = 33000. A sample of 80 people from Ontario yields the sample mean x 2 = 32000. Do we have enough evidence that people in Alberta get more on average than in Ontario? From the previous studies it is known that the population standard deviations are respectively, σ 1 = 5000 and σ 2 = 2000. Solution: H 0 : µ 1 = µ 2 ; H 1 : µ 1 > µ 2. The observed difference is 1000. To compute P ( X1 X 2 > 1000 ) X 1 = P X 2 0 1000 0 > σ1 2/n 1 + σ2 2/n 50002 /100 + 2000 2 /80 2 = P (Z > 1.82) = 0.035 Reject H 0 when α = 0.05, do not reject when α = 0.01. Rafa l Kulik 30

Case 2: Unknown variances σ 2 1 = σ 2 2; small sample size Example: A researcher wants to test that on average a new fertilizer yields taller plants. Plants were divided into two groups: a control group treated with an old fertilizer and a study group treated with the new fertilizer. The following data are obtained: Test H 0 : µ 1 = µ 2 vs. H 1 : µ 1 < µ 2. Sample size Sample Mean Sample Variance n 1 = 8 x 1 = 43.14 s 2 1 = 71.65 n 2 = 8 x 2 = 47.79 s 2 2 = 52.66 Rafa l Kulik 31

Solution: H 0 : µ 1 = µ 2 ; H 1 : µ 1 < µ 2. The observed difference is 4.65. To compute P ( X1 X 2 < 4.65 ) X 1 = P X 2 0 4.65 0 < s 1 p n + 1 7.88 1/8 + 1/8 1 n 2 = P (t n1 +n 2 2 < 1.18) = P (t 14 < 1.18) = P (t 14 > 1.18) (0.1, 0.2). Here, s 2 p is the pooled variance which is computed as follows: s 2 p = (n 1 1)s 2 1 + (n 2 1)s 2 2 n 1 + n 2 2 = 62.155. Do not reject H 0 when α = 0.05, do not reject when α = 0.01. Rafa l Kulik 32

Case 3: Unknown variances σ 2 1, σ 2 2; large sample size Example: A researcher wants to test that on average a new fertilizer yields taller plants. Plants were divided into two groups: a control group treated with an old fertilizer and a study group treated with the new fertilizer. The following data are obtained: Sample size Sample Mean Sample Variance n 1 = 100 x 1 = 43.14 s 2 1 = 71.65 n 2 = 100 x 2 = 47.79 s 2 2 = 52.66 Test H 0 : µ 1 = µ 2 vs. H 1 : µ 1 < µ 2. Rafa l Kulik 33

Solution: H 0 : µ 1 = µ 2 ; H 1 : µ 1 < µ 2. The observed difference is 4.65. To compute P ( X1 X 2 < 4.65 ) = P X 1 X 2 0 < s 2 1 n 1 + s2 2 n 2 = P (Z < 4.18) = 0. 4.65 0 71.65 100 + 52.66 100 Reject H 0 when α = 0.05, reject when α = 0.01. Rafa l Kulik 34

Difference of two proportions We consider a proportion of recaptured moths in the light-coloured (p 1 ) and the dark colorued (p 2 ) populations. Among the n 1 = 137 light-coloured moths, y 1 = 18 were recaptured; among the n 2 = 493 light-coloured moths, y 2 = 131 were recaptured. Is there a significant difference between the proportion of recaptured moths? Solution: H 0 : p 1 = p 2 ; H 1 : p 1 p 2. The observed proportions are ˆp 1 = y 1 n 1 = 0.131; ˆp 2 = y 2 n 2 = 0.266; ˆp 1 ˆp 2 = 0.135 Rafa l Kulik 35

We compute p-value as 2 P (ˆp 1 ˆp 2 0.135): 2 P ( ˆp 1 ˆp 2 0 ˆp(1 ˆp) 1/n1 + 1/n 2 ) 0.135 0. 0.2365(1 0.2365) 1/137 + 1/493 We get 2 P (ˆp 1 ˆp 2 0.135) = 2P (Z < 3.29) 0. Here, ˆp is the pooled proportion: ˆp = n 1 n 1 + n 2 ˆp 1 + n 2 n 1 + n 2 ˆp 2. Rafa l Kulik 36

R-commands t.test(x,mu=5) is the command for H 0 : µ = 5 against H 1 : µ 5 when σ is unknown (t-test) t.test(x,mu=5,alternative="greater") is the command for H 0 : µ = 5 against H 1 : µ > 5 when σ is unknown (t-test) t.test(x,mu=5,alternative="less") is the command for H 0 : µ = 5 against H 1 : µ < 5 when σ is unknown (t-test) t.test(x,y,paired=true) is the command for H 0 : µ 1 = µ 2 against H 1 : µ 1 = µ 2 in case of paired samples, when variances are unknown. t.test(x,y,paired=true,alternative="greater") is the command for H 0 : µ 1 = µ 2 against H 1 : µ 1 > µ 2 in case of paired samples, when variances are unknown. Rafa l Kulik 37

t.test(x,y,paired=true,alternative="less") is the command for H 0 : µ 1 = µ 2 against H 1 : µ 1 < µ 2 in case of paired samples, when variances are unknown. t.test(x,y,var.equal=true) is the command for H 0 : µ 1 = µ 2 against H 1 : µ 1 = µ 2 in case of two independent samples, when variances are unknown (Case 2). t.test(x,y,var.equal=true,alternative="greater") is the command for H 0 : µ 1 = µ 2 against H 1 : µ 1 > µ 2 in case of two independent samples, when variances are unknown (Case 2). t.test(x,y,var.equal=true,alternative="less") is the command for H 0 : µ 1 = µ 2 against H 1 : µ 1 < µ 2 in case of two independent samples, when variances are unknown (Case 2). Rafa l Kulik 38