* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download H - AUEB e
Bootstrapping (statistics) wikipedia , lookup
Psychometrics wikipedia , lookup
Foundations of statistics wikipedia , lookup
Taylor's law wikipedia , lookup
Omnibus test wikipedia , lookup
Statistical hypothesis testing wikipedia , lookup
Resampling (statistics) wikipedia , lookup
ECO 72 INTRODUCTION TO ECONOMIC STATISTICS Topic 9 OneSample Hypothesis Tests These slides are copyright © 2003 by Tavis Barr. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). Hypothesis Testing ● The purpose of hypothesis testing is to state the validity of a claim about a parameter of the population. – Is the population mean really, say, 10? – Is the population proportion really 25%? – Is the population stabdard deviation really 3? (We won't cover this last test.) Hypothesis Testing ● Background and Methodolgy ● OneSample Hypothesis Test for Population Mean ● ● – Large Sample – Small Sample OneSample Hypothesis Test for Population Proportion (Large Sample Only) Type I and Type II Errors Hypothesis Testing ● ● ● Hypothesis tests must be set up in a certain order to be done correctly We have to be careful that our knowledge about the data does not affect our choice of hypotheses Otherwise we can be tempted to choose hypotheses that we already know are true or false Hypothesis testing The order of a hypothesis test: 1. The null hypothesis (H0) and the alternative hypothesis (H1) is stated 2. A level of significance is decided on 3. A test statistic is selected 4. A decision rule is selected, usually involving a critical value. Usually we want to develop a confidence interval for the population parameter at the critical value. 5. A sample is collected, and the statistic and its critical value is determined The Steps of a Hypothesis Test 1. The null hypothesis (H0) and the alternative hypothesis (H1) is stated ● ● The null hypothesis is a statement that we want to test • “The population mean is zero” • “The population proportion is 40 percent” The alternative hypothesis is what is true when the null hypothesis is not true • “The population mean is not zero” • “The population proportion is not 40 percent” The Steps of a Hypothesis Test 2. A level of significance is decided on ● ● ● The level of significance: If we declare the null hypothesis false, what chance of being wrong we are willing to allow ourselves? Rarely can a hypothesis be declared certainly true or untrue. Rather, it can be declared likely or unlikely Larger data sets or less noisy data may allow us to be more stringent The Steps of a Hypothesis Test 3. A test statistic is selected – A test statistic is a number that describes how likely our null hypothesis is – The test statistic usually follows a common distribution, such as the Normal or t. – The distribution of the test statistic is independent of sample properties such as the mean or standard deviation. It may depend on the number of observations in the sample. The Steps of a Hypothesis Test 4.A decision rule is selected, usually involving a critical value. ● ● ● Because the test statistic follows a known distribution, it will be above or below a given value with a known probability if the null hypothesis is true If the value is too large or too small, the null hypothesis is improbable How large or small the statistic needs to be depends on what significance level we chose The Steps of a Hypothesis Test 5. A sample is collected, and the statistic and its critical value is determined. A decision is made. ● ● ● The key point: We have decided on all of the methodological questions (significance level, test statistic, etc.) before we look at the data This way, we know that our familiarity with the data does not influence our decision about, say, what significance level to use Note that we never choose to accept a null hypothesis, only reject it or not reject it. Test about a Population Mean ● ● First, we make a null hypothesis about what the population mean is. We call this mean (H0) Then we make a confidence interval based on the sample mean and make a decision based on where the hypothesized population mean lies: Population Mean Lies: Outside 90% Interval Outside 95% Interval Outside 99% Interval ● Decision: Reject at 10% significance level Reject at 5% significance level Reject at 1% significance level But note that we decide on significance level before looking at data Test About a Population Mean ● For large samples, the statistic is: z= ● ● X− H0 Std. Error = X− H0 s /n 2 If H0 is thetruepopulation mean,then theCLT says X isNormal with meanH 0 and standarddeviation s /n 2 So if the null hypothesis is true, then z follows the standard normal distribution P(1.645<z<1.645) =0.9 2 1 0 1 f(z) z 2 Test About a Population Mean For large samples, the statistic is: z = X− H0 Std. Error = X− H0 s /n 2 z is: (H0) is: Hypothesized mean is: Less than 1.645 More than 1.645 More than X1.645(S.E.) Less than X+1.645(S.E.) Above 90% Conf. Int. Below 90% Conf. Int. Reject at 10 percent Less than 1.96 More than 1.96 More than X1.96(S.E.) Less than X+1.96(S.E.) Above 95% Conf. Int. Below 95% Conf. Int. Reject at 5 percent Less than 2.576 More than 2.576 More than X2.576(S.E.) Less than X+2.576(S.E.) Above 99% Conf. Int. Below 99% Conf. Int. Reject at 1 percent Test About a Population Mean For large samples, the statistic is: z= X− H0 Std. Error = X− H0 s /n 2 1.645 < z < 1.645: Do not reject 1.645 < |z| < 1.96: Reject at 10% 1.96 < |z| < 2.576: Reject at 5% 3 2.576 < |z|: Reject at 1% 2 1 0 1 2 3 Test of Popn' Mean – Example ● According to a survey of 7,615 clients of the Maine Addiction Treatment System from 19901995, the average income of a client of a client is $928.30 per month, with a standard deviation of $875.80 per month. Source: http://www.bu.edu/econ/faculty/ma/Papers_Archive/interaction_JHE_March2004.pdf ● ● The federal poverty line in 1995 for a household of two was $863.33 per month Can we reject the hypothesis, at the 5 percent level, that the average income of a client was equal to the poverty line for a household of two? Test of Popn' Mean – Example 2 ● ● ● ● One hundred people in some middleincome country have their red blood cell count taken. The sample mean is 4.8 million cells per milliliter, and the sample standard deviation is 1.5 million cells/ml. Five million cells per milliliter is considered a healthy count. At a 5% significance level, can we reject the hypothesis that the blood cell count in this country is too low? Test of Pop'n Mean – Example 2 ● Sample mean is 4.8 million, std. dev. is 1.2 million, sample size is 100 ● H0: Mean is 5 million ● z statistic: [ X −H 0 ]/ s2 / n ● X − H0 =4.8mil−5 mil=−200,000 ● Standarderror : s /n= 1,200,000 /100 2 = 14,400,000,000=120,000 ● So z = 200,000/120,000 = 1.67 2 Test of Popn' Mean – Example 3 ● ● ● ● A company claims its cell phones emit 1.2 W/kg of radiation. A Consumer Reports engineer wants to test this claim and measures radiation from a sample of 300 phones. The sample mean is 1.33 W/kg, and the sample standard deviation is 0.25 W/kg. At a 5% significance level, can we reject the company's claim that the phones emit 1.2 W/kg? Test of Pop'n Mean – Example 3 ● Sample mean is 1.33, std. dev. is 0.25, sample size is 300 ● H0: Mean is 1.2 ● z statistic: ● X − H0 =1.33−1.2=0.13 ● ● [ X −H 0 ]/ s / n 2 Standarderror : s /n= 0.25 /300 = .000208=0.0144 2 So z = 0.13/0.0144 = 9.03 2 Means Test with Small Sample ● z test makes use of Central Limit Theorem ● CLT only applies to samples over 30 ● With small sample, we can use t statistic ● ● t statistic only works when original variable follows the Normal distribution We compute the t statistic exactly like the z: t= X− H0 Std. Error = X−H 0 2 s /n Means Test with Small Sample ● We compute the t statistic exactly like the z: ● ● t= X− H0 Std.Error = X−H 0 s /n 2 z statistic follows a standard normal distribution; t statistic follows a t distribution with n1 degrees of freedom This means unlike the z statistic, whose critical values are always the same (1.65, 1.96, 2.58), those of the t statistic depend on the sample size Means Test with Small Sample ● t =[ X −H 0 ]/ Std.Err. =[ X −H 0 ]/ s / n 2 ● ● ● t statistic follows a t distribution with n1 degrees of freedom Critical values depend on the sample size Use twotailed test Confidence Intervals 80% 90% 95% Level of Significance for OneTailed Test df 0.100 0.050 0.025 Level of Significance for TwoTailed Test 0.20 0.10 0.05 1 3.08 6.31 12.71 2 1.89 2.920 4.3 3 1.64 2.35 3.18 4 1.53 2.13 2.78 5 1.48 2.02 2.57 98% 99% 99.9% 0.010 0.005 0.0005 0.02 31.82 6.97 4.54 3.75 3.37 0.01 0.001 63.657 636.619 9.925 31.599 5.841 12.924 4.604 8.610 4.032 6.869 6 7 8 9 10 1.440 1.42 1.4 1.38 1.37 1.943 1.895 1.860 1.833 1.812 2.45 2.37 2.31 2.26 2.23 3.14 3 2.87 2.82 2.76 3.707 3.499 3.355 3.250 3.169 5.959 5.408 5.041 4.781 4.587 11 12 13 14 15 1.36 1.36 1.350 1.35 1.34 1.796 1.782 1.771 1.761 1.753 2.2 2.18 2.160 2.15 2.13 2.72 2.68 2.650 2.62 2.6 3.106 3.055 3.012 2.977 2.947 4.437 4.318 4.221 4.140 4.073 t Test Example ● ● ● The SAT has a mean score of 1,000 nationally. We look at a sample of 6 students from a school and want to know if they score above or below average Scores are: 1020, 970, 820, 740, 850, 930. t Test Example ● Scores are: 1020, 970, 820, 740, 850, 930. ● First step: Find sample mean and variance. X: 1020970820740850930 =888.33 6 1020−888.332970−888.332 820−888.332 2 2 2 2 740−888.33 850−888.33 930−888.3 : 5 17336.116669.4444669.44422002.781469.4441736.111 = 5 =10776.67 t Test Example ● Sample mean: 888.33 ● Sample variance: 10776.67 ● H0: = 1000 ● 6 observations, so 5 d.o.f. ● t=[ X−H 0 ]/ Std.Err. =[ X−H 0 ]/ s /n =888.33−1000/ 10776.67/6 =−111.67/42.38=−2.63 2 Confidence Intervals 80% 90% 95% Level of Significance for OneTailed Test df 0.100 0.050 0.025 Level of Significance for TwoTailed Test 0.20 0.10 0.05 1 3.08 6.31 12.71 2 1.89 2.920 4.3 3 1.64 2.35 3.18 4 1.53 2.13 2.78 5 1.48 2.02 2.57 98% 99% 99.9% 0.010 0.005 0.0005 0.02 31.82 6.97 4.54 3.75 3.37 0.01 0.001 63.657 636.619 9.925 31.599 5.841 12.924 4.604 8.610 4.032 6.869 6 7 8 9 10 1.440 1.42 1.4 1.38 1.37 1.943 1.895 1.860 1.833 1.812 2.45 2.37 2.31 2.26 2.23 3.14 3 2.87 2.82 2.76 3.707 3.499 3.355 3.250 3.169 5.959 5.408 5.041 4.781 4.587 11 12 13 14 15 1.36 1.36 1.350 1.35 1.34 1.796 1.782 1.771 1.761 1.753 2.2 2.18 2.160 2.15 2.13 2.72 2.68 2.650 2.62 2.6 3.106 3.055 3.012 2.977 2.947 4.437 4.318 4.221 4.140 4.073 Another t Test Example ● The average January temperature in New York in the 1990s was: 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 35.5 29.2 30.2 30.9 20.4 32.5 25.7 27.6 35.6 29.7 Source: http://www.ncdc.noaa.gov/oa/climate/research/cag3/Y8.html ● Can we reject at the 10% level the hypothesis that the average temperature is 32 degrees? Another t Test Example ● The average January temperature in New York in the 1990s was: 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 35.5 29.2 30.2 30.9 20.4 32.5 25.7 27.6 35.6 29.7 ● Can we reject at the 10% level the hypothesis that the average temperature is 32 degrees? – First, calculate the sample mean and variance: X: 29.73 s2: 20.57 Another t Test Example ● Sample mean: 29.73 ● Sample variance: 20.57 ● H0: = 32 ● 10 observations, so 9 d.o.f. ● t=[ X−H 0 ]/ Std.Err. =[ X−H 0 ]/ s /n =29.73−32/ 20.57/10 =−2.27/1.43=−1.58 2 Confidence Intervals 80% 90% 95% Level of Significance for OneTailed Test df 0.100 0.050 0.025 Level of Significance for TwoTailed Test 0.20 0.10 0.05 1 3.08 6.31 12.71 2 1.89 2.920 4.3 3 1.64 2.35 3.18 4 1.53 2.13 2.78 5 1.48 2.02 2.57 98% 99% 99.9% 0.010 0.005 0.0005 0.02 31.82 6.97 4.54 3.75 3.37 0.01 0.001 63.657 636.619 9.925 31.599 5.841 12.924 4.604 8.610 4.032 6.869 6 7 8 9 10 1.440 1.42 1.4 1.38 1.37 1.943 1.895 1.860 1.833 1.812 2.45 2.37 2.31 2.26 2.23 3.14 3 2.87 2.82 2.76 3.707 3.499 3.355 3.250 3.169 5.959 5.408 5.041 4.781 4.587 11 12 13 14 15 1.36 1.36 1.350 1.35 1.34 1.796 1.782 1.771 1.761 1.753 2.2 2.18 2.160 2.15 2.13 2.72 2.68 2.650 2.62 2.6 3.106 3.055 3.012 2.977 2.947 4.437 4.318 4.221 4.140 4.073 Hypothesis Test for Population Proportion ● ● ● ● In a large enough sample, sample proportion is normally distributed Expected value is population proportion (p); standard error is p1−p/ n We write population proportion as , so hypothesized proportion is written (H0) If null hypothesis is true, and proportion is really (H0), then standard error is H 0 1−H 0 / n Hypothesis Test for Population Proportion ● If null hypothesis is true, sample proportion is normally distributed with mean (H0) and standard error H 0 1−H 0 / n ● That means that the following statistic will be standard normally distributed: z= p−H 0 H 0 1− H0 / n Hypothesis Test for Proportion – Example ● According to a June, 2007 Gallup poll of 1,007 U.S. adults, 53% of Americans believe that the theory of evolution is definitely or probably true. http://www.usatoday.com/news/politics/20070607evolutionpollresults_n.htm ● At the five percent significance level, can we reject the possibility that half of U.S. adults believe that evolution is definitely or probably true? Hypothesis Test for Proportion – Example 2 ● ● Insurance fraud rate in New York is about 6%. The director of insurance investigations in Nassau County wants to figure out if fraud rate is above or below state average. ● Conducts an intensive review of 500 cases. ● Finds that in his sample, 40 cases are fraudulent. Hypothesis Test for Proportion – Example 2 ● Null hypothesis: (H0) = .06 ● Sample proportion: 40/500 = .08 ● Standard error of sample proportion if null hypothesis is true: H 0 1−H 0 /n= 0.061−0.06/500=0.0106 p−H 0 0.08−0.06 z= − =1.883 H 0 1− H0 /n 0.0106 Hypothesis Test for Proportion – Another Example ● On January 4, 2003, Slashdot readers were asked who they thought were the dumbest people in Los Angeles. Their responses: CyberCafeGang Violence Kids City Councilmen demanding cybercafe security The LAPD Who Want To Crack Down on CyberCafes The MPAA CowboyNeal hasn't been to LA TOTAL ● 1619 468 1047 6175 1328 10637 Can we reject the hypothesis that half of Slashdot readers think the MPAA are the dumbest people in LA at the 1% significance level? Hypothesis Test for Proportion – Another Example ● Null hypothesis: (H0) = .50 ● Sample proportion: 6175/10637 = .5805 ● Standard error of sample proportion if null hypothesis is true: H 0 1−H 0 /n= 0.51−0.5/10636=0.0048 p−H 0 0.5805−0.5 z= − =16.61 0.0048 H 0 1− H0 /n Type I and Type II Errors ● ● Conclusions from statstistical tests are not made with certainty We may make a mistake, either rejecting a hypothesis that is actually true, or not rejecting a hypothesis that is actually false Type I Error ● ● A Type I Error occurs when we reject a null hypothesis that is actually true The probability of doing this, known as , is just the significance level of the test: 2.5% Prob. X P[(1.96(SE) < X < 1.96(SE)] =0.95 5% test: P(|z|>1.96) = 0.05 2.5% Prob. z Type II Error ● ● A Type II Error occurs when we fail to reject a null hypothesis that is actually false The probability of this, known as , depends on the alternative hypothesis Critical values under H0 Probability of observing a value in nonrejection range if H1 is actually true (H0) z (H1) z