Statistics for Social and Behavioral Sciences Session #16: Confidence Interval and Hypothesis Testing (Agresti and Finlay, from Chapter 5 to Chapter 6) Prof. Amine Ouazad Statistics Course Outline PART I. INTRODUCTION AND RESEARCH DESIGN Week 1 PART II. DESCRIBING DATA Weeks 2-4 PART III. DRAWING CONCLUSIONS FROM DATA: INFERENTIAL STATISTICS Weeks 5-9 Firenze or Lebanese Express’s ratings are within a MoE of each other! PART IV. : CORRELATION AND CAUSATION: REGRESSION ANALYSIS This is where we talk about Zmapp and Ebola! Weeks 10-14 Last Session • Interval estimates for a population mean (a parameter) when N is large, for any distribution of X. • Build a confidence interval for a parameter: the interval [Sample Mean – MoE ; Sample + MoE] includes the parameter with probability: 99% if MoE = 2.58 * Standard Error 95% if MoE = 1.96 * Standard Error 90% if MoE = 1.65 * Standard Error Today • What happens if N is small? – The Central Limit Theorem does not apply. – If X is normally distributed, then we have a way of getting the sampling distribution of the sample mean…. And thus build confidence intervals, standard errors. – The sample mean follows a t-distribution. • Hypothesis testing in Statistics: the Foundation of (Social) Sciences. – The Confidence Interval method of testing m=v. Outline 1. Small samples, normal distribution: t-distribution 2. Testing hypothesis: The Foundation of (Social) Sciences Next time: t test of mean and proportion Chapter 6 of A&F Central Limit Theorem • Requires a large sample size N. • This is because it applies to any distribution of X. • Example: – We had a sample of N songs, and the number of times Xi that song had been played. – The number of times Xi a song is played on Spotify does not have a normal distribution. – But we can build a confidence interval for the average number of times a song is played (m), provided we have a large enough number N of songs. – MoE = 1.96 * sX/√N for a 95% confidence interval. N is large !! The distribution of X may be different from a normal distribution. We can use our formulas to find a 95% confidence interval for m=360.63 as: • N is large. Even though X does not have a normal distribution. What if N is small? • If N is “small”, the Central Limit Theorem does not apply…. – We cannot use our formulas. • “Small” ? Less than a few hundred (from experience). • If N is very small: N=2 These sampling distributions are not normal. N=5 If N is small • sX is potentially very far from sx. • But… we can still find confidence intervals if X is normal. • The sampling distribution of the sample mean is Student’s t distribution, with degrees of freedom (df) equal to N-1, and with standard deviation sx/√N. If N is small A 95% confidence interval for the sample mean is: [Sample Mean – MoE , Sample Mean + MoE] With MoE = z * Standard Error. • z= 1.96 when the df = ∞ • z> 1.96 when the df are small. • See next table for the exact value of z. t Table Why is it called Student’s t distribution? • The t distribution was allegedly invented by a person called Student. • That “Student” was an engineer at factories in Ireland: William Sealy Gossett. • He was producing small samples of a p, seeking guidance for industrial quality control: – He was trying a small number of samples (N=2,4, perhaps 7). – And from these samples was trying to infer the quality of all containers of the product (the population). W.S. Gosset and Some Neglected Concepts in Experimental Statistics, Stephen T. Ziliak, 2011. Outline 1. Small samples, normal distribution: t-distribution 2. Testing hypothesis: The Foundation of (Social) Sciences Next time: t test of mean and proportion Chapter 6 of A&F Thinking like a statistician: Step 1 • Empirical question, type #1: “ What is an estimate of the population proportion of voters for Republicans in Colorado?” Or… • Empirical question, type #2: In Plain English “Is Cory Gardner likely to win the election?” In more formal terms: “Can we reject the hypothesis that Cory Gardner will lose the election with some confidence?” Thinking like a statistician: Step 1 • Empirical question, type #1: “ What is an estimate of the population impact of Zmapp on Ebola ?” Or… • Empirical question, type #2: In Plain English “Is Zmapp effective at treating Ebola?” In more formal terms: “Can we reject the hypothesis that Zmapp does not treat Ebola patients with some confidence?” Hypothesis testing • Hypothesis: an empirical statement about a population parameter. Usually of the shape: – “The parameter is equal to a given value” – “The parameter is greater than a given value” – “The parameter is lower than a given value” • Almost all scientific/sociological/economic statements can be reduced to one of these three types. – “The population proportion of voters for Cory Gardner is greater than 50%.” (second type of hypothesis) – “The impact of ZMapp on Ebola patients’ condition is zero.” (first type of hypothesis) Hypothesis • Fundamental principle of scientific analysis: we can only provide evidence to reject a hypothesis. We never actually accept a hypothesis… • “Science must begin with myths, and with the criticism of myths.” Karl Popper. • Scientific hypothesis are falsifiable, i.e. it is possible to bring data to test such hypothesis. • This applies to social science as well: impact of taxes on individuals’ mobility, impact of abortion on crime (Steve Levitt, Freakonomics). • Logik der Forschung, Vienna, 1935. • Translated into The Logic of Scientific Discovery, 1959. Formulating Hypothesis • H0 Null hypothesis (to be rejected by evidence): “Zmapp does not improve Ebola patients’ condition.” or “The population impact of Zmapp on Ebola is zero.” • Ha Alternative hypothesis: “Zmapp has a positive impact on the population of Ebola patients’ condition.” See that the formulation of the alternative matters. Beware of your priors. Formulating Hypothesis (simpler) • H0 Null hypothesis (to be rejected by evidence): “The fraction of men in Abu Dhabi is equal to 50%.” • Ha Alternative hypothesis: “The fraction of men in Abu Dhabi is different from 50%.” A tourist’s pic. What’s going on? See that the formulation of the alternative matters. Beware of your priors. Testing H0: m=v using confidence intervals • H0: “The fraction of men in Abu Dhabi is 50%.” equivalently “m = 0.5”. • By simple random sampling, gather N observations Xi=0,1. • Build a confidence interval for the sample mean m of Xi. – Same methods as seen in previous sessions. • If the null hypothesis is true, only 5 of the 95% confidence intervals will not include 0.5. • Thus if the null hypothesis is true, there is only a 5% probability that my confidence interval will not include 0.5. ☞ Reject the null hypothesis if the confidence interval for m does not include v. Statistical Errors: “The Truth (m) is out there” Null hypothesis is true Alternative hypothesis is true Do not reject the null hypothesis Correct decision Type II error We reject the null hypothesis Type I error Correct decision • By selecting 95% confidence intervals, what is the probability of a type I error? • This is called the significance level (a level) of the test. • It is not possible to make no type I and no type II error. Wrap up • When the sample size is small: The t-distribution gives confidence intervals … and when the distribution of X is normal. • Use z given by Table 5.1 of Agresti and Finlay for degrees of freedom N-1. Then MoE = z * Standard Error • Hypothesis testing is the foundation of (social) sciences. • Hypothesis: A parameter is equal to …. , A parameter is greater than …., A parameter is lower than …. . • We can only provide evidence to reject a null hypothesis. • Confidence interval method for the test of H0 : m = v. Ha: m ≠ v. – Reject the H0 with significance level 5% if the 95% confidence interval for the sample mean m does not include v. – Reject the H0 with significance level 10% if the 90% confidence interval for the sample mean m does not include v. Coming up: Readings: • Mid term on Tuesday, November 25. – Coverage: up to Chapter 6. • Deadlines are sharp and attendance is followed. For help: • Amine Ouazad Office 1135, Social Science building amine.ouazad@nyu.edu Office hour: Tuesday from 5 to 6.30pm. • GAF: Irene Paneda Irene.paneda@nyu.edu Sunday recitations. At the Academic Resource Center, Monday from 2 to 4pm.