Upcoming SlideShare
×

# Statr session 15 and 16

1,057 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
1,057
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
25
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Statr session 15 and 16

1. 1. Learning Objectives • Know how to implement the Hypothesis, Test, Action, Business (HTAB) system to test hypotheses. • Understand the logic of Statistical Hypothesis Testing: – Know how to establish null and alternative hypotheses – Understand Type I and Type II errors – Calculate the probability of Type II error when failing to reject the null hypothesis • Understand how to test a hypothesis about a single population parameter: – Mean • when • when is known (using z-statistic) is unknown (using t-statistic)
2. 2. Types of Hypotheses 1. Research Hypothesis – a statement of what the researcher believes will be the outcome of an experiment or a study. 2. Statistical Hypothesis – a more formal structure derived from the scientific method – composed of two parts : • Null hypothesis (Ho) – the assumed value of the parameter if there is no effect/ impact. We will conclude that this could be true unless there is a small chance of getting a sample statistic (mean/proportion/variance) as extreme or more extreme than from the data (small p-value). • Alternative hypothesis (Ha) – a statement of whether the true population parameter is higher, lower, or not equal to that hypothesized in the null hypothesis.
3. 3. Types of Hypotheses 3. Substantive Hypothesis - a statistically significant difference does not imply or mean a material, substantive difference. – If the null hypothesis is rejected and the alternative hypothesis is accepted, then one can say that a statistically significant result has been obtained – With “significant” results, you reject the null hypothesis
4. 4. Using the HTAB System • H – Hypotheses – Establish the hypothesis • T – Test – Conduct the test • A – Action – Take statistical action • B – Business Implications – Determine the business implications
5. 5. CPA Salary Example Example: A survey of CPAs in the U.S., done 15 years ago, found that their average salary was \$74,914. An accounting researcher would like to test whether this average has changed over the years. A random sample of 112 CPAs produced a mean salary of \$78,695. Assume that the population standard deviation of salaries is = \$14,530 (note: this value is typically not known, but we will assume it for mathematical simplicity. Later, we will remove this assumption).
6. 6. Step 1: Hypothesis Set up the null and alternative hypotheses Always contains “=“ H0 : Ha : \$74,914 \$74,914 > or < or ≠
7. 7. Null and Alternative Hypotheses • The null and alternative hypotheses are mutually exclusive. – Only one of them can be selected. • The null hypothesis is assumed to be true. It is compared to the observed data via either a critical value (critical value method) or by calculating a p-value (p-value method) • The burden of proof falls on the alternative hypothesis. Thus, you either reject the null in favour of the alternative or you fail to reject the null in favour of the alternative. The latter statement does not imply that the null is true.
8. 8. Examples: One-tailed and Two-tailed Tests • One-tailed Test - Means 40 Ha : - Proportions H0 : 40 H 0 : p 0.18 H a : p 0.18 • Two-tailed Test H0 : 12 Ha : 12
9. 9. Step 2: Determine Appropriate Test • The z-statistic can be used to test when the following three conditions are met: – The data are a random sample from the population – The sample standard deviation ( ) is known – At least one of the following conditions are met: • The sample size (n) is at least 30 • The underlying distribution is normal • The value of z-statistic can be calculated using the following formula z x n
10. 10. Finite Population Correction • If the sample is drawn from a finite population of size N, the formula for z-statistic becomes… z X N n n N 1
11. 11. Step 3: Set significance level ( ) • Significance level ( ) or Type I error rate – Committed by rejecting a true null hypothesis – If the null hypothesis is true, any value that falls in a rejection region will represent a Type I error. – The probability of committing a Type I error is referred to as , the level of significance. • The significance level is usually set at 0.05. Other common values are 0.1, 0.01, or 0.001.
12. 12. Type II Errors • Type II Error – Committed when a researcher fails to reject a false null hypothesis – The probability of committing a Type II error is referred to as . Some refer to power, or 1- (the chance of rejecting the null when it is false), instead. • In practice, we do not know whether the null hypothesis is true. • Type I and Type II error rates are inversely related, if you reduce one, you increase the other. • One way of reducing both Type I and Type II error rates is to increase the sample size, but that requires more time and money.
13. 13. Decision Table for Hypothesis Testing State of Null (Truth) Decision: Null True Null False Fail to reject null Correct Decision Type II error ( ) Reject null Type I error ( ) Correct Decision (Power)
14. 14. Step 4: Decision Rule • A decision rule has to be made about when the difference between the sample and hypothesized population mean (under the null hypothesis) is small or large. • The rejection region is the area on the curve where the null hypothesis is rejected. Here the value of the sample mean is too far from the hypothesized population mean to conclude that they are the same. • The nonrejection region is the area where the null hypothesis is not rejected. Here the sample mean is close enough to the hypothesized population mean to conclude that the null hypothesis could be true.
15. 15. Rejection and Non-rejection Regions Rejection Region Rejection Region Non Rejection Region =\$74,914 Critical Value Critical Value
16. 16. Decision rule – CPA Example Rejection Region Rejection Region Non Rejection Region =\$74,914 Z /2 = Z0.025 = -1.96 Z1- Z=0 /2 = Z0.975 = +1.96
17. 17. Critical Z values: Level of significance = 0.05 Non-rejection Region 95% .025 .4750 .025 .4750 X -1.96 0 1.96 Z
18. 18. Values of z for common Levels of Confidence Confidence Level 90% 95% 98% 99% Z Value 1.645 1.96 2.33 2.575
19. 19. Decision Rule – CPA Example Thus, we will reject H0 if Z > 1.96 or Z < -1.96 or reject H0 if |Z| > 1.96
20. 20. Critical Value Based on Sample Mean Alternatively, you could calculate a critical value based not on Z, but on x-bar. zc xc or xc so n 1.96 xc 74,914 14,530 112 14,530 74,914 2,691 74,914 1.96 112 lower xc 72,223 and upper xc 77,605 Thus, we would reject the null if the sample mean is above \$77,605 or below \$72,223.
21. 21. One-tailed Tests Depending on the problem, one-tailed tests are sometimes appropriate. H0 : 40 H0 : 40 Ha : 40 Ha : 40 Rejection Region Non Rejection Region =40 oz Critical Value Rejection Region Non Rejection Region =40 oz Critical Value
22. 22. Step 5 (Gather Data) and Step 6 (Compute Test Statistic) z X 78695 74914 2.75 / n 14530 / 112
23. 23. Step 7: Statistical Action (Decision)
24. 24. Step 8: Business Decision Statistically, the researcher has enough evidence to reject the figure of \$74,914 as the true average salary for CPAs. Based on the evidence gathered, it suggests that the average has increased over the 15-year period.
25. 25. Alternative Method: the p-value • p-value – another way to reach statistical conclusion in hypothesis testing If the null hypothesis is true, the p value is the probability of getting a sample mean as extreme or more extreme than what you observed. If the sample mean is in the rejection region, the p-value will be small. These two methods are always consistent. • p-value < reject H0, p-value do not reject H0 • For two tailed test, /2 is used in each region The p value is then compared to α/2 instead of to determine statistical significance. Some statisticians (and packages) double the p-value for a two sided test instead and compare to .
26. 26. p-value for CPA Example Px \$78,695 | \$74,914 P x n P( Z 2.75) 0.003 \$78,695 \$74,914 \$14,530 112
27. 27. Review of 8 Steps of Hypothesis Testing 1 – Establish the null and alternative hypotheses 2 – Determine the appropriate statistical test 3 – Set , the Type I error rate / significance level 4 – Establish the decision rule 5 – Gather sample data 6 – Analyze the data 7 – Reach a statistical conclusion 8 – Make a business decision
28. 28. The U.S. Farmers’ Production Company (USFPC) builds large harvesters. For a harvester to be properly balanced when operating, a 25-pound plate is installed on its side. The machine that produces these plates is set to yield plates that average 25 pounds. The distribution of plates produced from the machine is normal. However, the shop supervisor is worried that the machine is out of adjustment and is producing plates that do not average 25 pounds. To test this, he randomly selects 20 of the plates from the day before and weighs them.
29. 29. • Establish the null and alternative hypotheses H0: =25 pounds (where mean weight of all plates) Ha: ≠25 • Determine the appropriate statistical test. Recall from earlier session, the conditions for the tdistribution: 1. The sample was randomly selected from the population 2. The population standard deviation ( ) is unknown 3. One of these conditions are met: The sample size (n) is at least 30 OR the underlying distribution is normal These conditions are met! The degrees of freedom are n-1 = 20-1 = 19 in this example
30. 30. Recap: t Distribution A family of distributions - a unique distribution for each value of its parameter using degrees of freedom (d.f.), every sample size having a different distribution t x s n
31. 31. t19 t /2 t19 t0.025 t19 2.093 X 25.51 25 1.04 t n 1 s / n 2.1933/ 20
32. 32. 7 – Reach a statistical conclusion Since |t| = 1.04 < tc = 2.093, do not reject H0 8 – Make a business decision There is not enough evidence to show that the plates are different from 25 pounds. (Note: Is this because the true population mean is close to 25 pounds, or is there a large chance that we have suffered from a Type II error? Good question – more on calculating type II error rates later.)
33. 33. R: Lower Tail Test of Population Mean when Population Variance is known. Problem: Suppose a manufacturer claims that the mean lifetime of a light bulb is more than 10,000 hours. In a sample of 30 light bulbs, it was found that they only last 9,900 hours on average. Assume the population standard deviation is 120 hours. At .05 significance level, can we reject the claim by the manufacturer? Go to http://www.r-tutor.com/elementary-statistics/hypothesis-testing
34. 34. R: Upper Tail Test of Population Mean when Population Variance is known. Problem: Suppose the food label on a cookie bag states that there is at most 2 grams of saturated fat in a single cookie. In a sample of 35 cookies, it is found that the mean amount of saturated fat per cookie is 2.1 grams. Assume that the population standard deviation is 0.25 grams. At .05 significance level, can we reject the claim on food label? Go to http://www.r-tutor.com/elementary-statistics/hypothesis-testing
35. 35. R: Two-tailed Test of Population Mean when Population Variance is known. Problem: Suppose the mean weight of King Penguins found in an Antarctic colony last year was 15.4 kg. In a sample of 35 penguins same time this year in the same colony, the mean penguin weight is 14.6 kg. Assume the population standard deviation is 2.5 kg. At .05 significance level, can we reject the null hypothesis that the mean penguin weight does not differ from last year? Go to http://www.r-tutor.com/elementary-statistics/hypothesis-testing
36. 36. R: Lower Tail Test of Population Mean when Population Variance is unknown Problem: Suppose the same manufacturer claims that the mean lifetime of a light bulb is more than 10,000 hours. In a sample of 30 light bulbs, it was found that they only last 9,900 hours on average. Assume the sample standard deviation is 125 hours. At 0.05 significance level, can we reject the claim by the manufacturer? Go to http://www.r-tutor.com/elementary-statistics/hypothesis-testing
37. 37. R: Upper Tail Test of Population Mean when Population Variance is unknown Problem: Suppose the same food label on a cookie bag states that there is at most 2 grams of saturated fat in a single cookie. In a sample of 35 cookies, it is found that the mean amount of saturated fat per cookie is 2.1 grams. Assume that the sample standard deviation is 0.3 gram. At 0.05 significance level, can we reject the claim on food label? Solution Go to http://www.r-tutor.com/elementary-statistics/hypothesis-testing
38. 38. R: Two Tail Test of Population Mean when Population Variance is unknown Problem: Suppose the mean weight of King Penguins found in an Antarctic colony last year was 15.4 kg. In a sample of 35 penguins same time this year in the same colony, the mean penguin weight is 14.6 kg. Assume the sample standard deviation is 2.5 kg. At 0.05 significance level, can we reject the null hypothesis that the mean penguin weight does not differ from last year? Go to http://www.r-tutor.com/elementary-statistics/hypothesis-testing
39. 39. R: Two Tail Test of Population Mean when Population Variance is unknown Go to http://ww2.coastal.edu/kingw/statistics/Rtutorials/index.html Enter Single Sample t test and practice the t.test() command with the temperature data given