Lecture 1.2 Confidence Interval Estimation 2. Introduction to
Transcription
Lecture 1.2 Confidence Interval Estimation 2. Introduction to
CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Lecture 1.2 “… The greater part of our happiness or misery depends upon our disposition, and not upon our circumstances.” … Martha Washington (1732-1802) 1. 2. 3. 4. 5. Point Estimation and Confidence Interval Estimation Introduction to Hypothesis Testing One-Sample Test for Population Proportion (large n) Two-Sample Test for Difference in Population Proportions Binomial Distribution. One-Sample Test for Population Proportion (large n) Introduction to Point Estimation and Confidence Interval Estimation Recall that population of interest represents the entire group of items (individuals), that we would like to make an inference about. Statistical inference is the process of drawing conclusions about a population parameter based on data, or statistic – an estimate or a summary computed from the observations. Population versus Sample Parameter versus Statistic Population Parameter(s) Inference Parameter Estimation Statistic(s) Sample Definitions: There are two types of estimates for population parameter: confidence interval estimates and point estimates. A confidence interval estimate is a range of values for the population parameter with a predefined level of confidence (e.g., 95% confidence interval). A point estimate for a population parameter is the statistic and can be considered the “best” (available) single-number estimate of that parameter. 1 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Examples: 1) Based on a random sample of the 100 patients visiting ER this weekend, the average waiting time is estimated to be 37.85 minutes. 37.85 minutes is a point estimate of the average waiting time Question: How far is the sample mean of 37.85 minutes is from true (population) average waiting time at ER (means for all weekends for all patients)? 2) Based on a random sample of the 100 patients visiting ER this weekend, the average waiting time is estimated to be between 32.65 minutes and 42.10 minutes. (37.65, 42.10) minutes is a confidence interval estimate of the average waiting time Confidence Interval Estimates provide a researcher with the range of possible, or acceptable, values of the true, unknown population parameter. The basic structure for any confidence interval is: point estimate ± multiplier * standard error, where “multiplier * standard error” = the margin of error. Note that: • The margin of error is a build in component that addresses how close (or how far) the point estimates are from the true, unknown parameter. • The (estimated) variance in point estimates (e.g., 𝜎! , 𝑜𝑟 𝑠! ), is called the standard error. • The standard error depends on the sample size and the true population standard deviation (i.e., standard error goes down as the sample size goes up). • Standard error interpretation: If repeated samples of (sample size) are obtained from this same population, we would estimate the resulting sample (statistic) to be about (value of standard error) away from the true (population parameter) on average. • The multiplier depends on the confidence level and the population parameter, but not the sample size deviation (i.e., multiplier is higher for higher values of confidence level). 2 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Confidence Intervals for Decision Making Principle 1: A value not in a CI can be rejected as possible value of the population parameter. A value in a CI is an “acceptable” or “reasonable” possibility for the value of a population parameter. Principle 2: When the CIs for parameters for two different population parameters do not overlap, it is reasonable to conclude that the parameters for the two populations are different. 1. The probability that the true parameter falls in a particular, already computed, confidence interval is either 0 or 1. The interval is now fixed and the parameter is NOT random, so the parameter is either in that particular interval or it is not. 2. A 95% Confidence Interval Interpretation: We are 95% confident that the true parameter value lies inside the confidence interval. The interval provides a range of reasonable values for the population parameter. 3. The 95% Confidence Level Interpretation: If the procedure were repeated many times (that is, if we repeatedly took a random sample of the same size and computed the 95% confidence interval for each sample), we would expect 95% of the resulting confidence intervals to contain the true population parameter. Confidence Intervals for Population Proportion The assumptions required for CI for a population proportion to be valid: (1) the sample size n is large enough (check: npˆ ≥ 5 and n(1 − pˆ ) ≥ 5), and (2) the data are a random sample from that population. Type of the Formula Formula for Approximate Confidence Interval for the Population Proportion p Formula for Conservative Confidence Interval for the Population Proportion p Note: here 𝒑=0.5 is used to compute the standard error: Formula pˆ ± Z1−(α / 2) pˆ ± Z1−(α / 2) SE ( pˆ ) = pˆ (1 − pˆ ) n 1 2 n pˆ (1 − pˆ ) 0.5(1 − 0.5) 1 = = n n 2 n Formula for the Sample Size required to produce an estimate for the population proportion p Formula for the Approximate Sample Size. If the population parameter p is unknown, the sample estimate 𝒑 can be used instead ⎛ Z ⎞ n = p(1 − p)⎜⎜ 1−(α / 2) ⎟⎟ ⎝ E ⎠ 2 ⎛ Z ⎞ n = pˆ (1 − pˆ )⎜⎜ 1−(α / 2) ⎟⎟ ⎝ E ⎠ 2 Formula for the Conservative Sample Size (p=0.5) ⎛ Z ⎞ n = 0.25⎜⎜ 1−(α / 2) ⎟⎟ ⎝ E ⎠ 3 2 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Exercise (D’Agostino, Example 7.1, 7.2): Testing Population Proportion of Patients with Osteoarthritis The medical records of a random sample of 200 patients are reviewed for the diagnostics of arthritis. Suppose that 38 patients are observed with diagnosed osteoarthritis. Sample proportion pˆ (a point estimate for the population proportion p) was computes as: pˆ = 38 / 200 = 0.19 , or 19%. a) Compute a 95% confidence interval for the population proportion p of all patients in the physician’s practice with diagnosed osteoarthritis. First, we have to check if the main conditions for using CI formula are satisfied. It is given that the sample of 200 patients is a random sample, so we only need to check if the sample size is large enough. A large sample is defined as one that satisfies the following: npˆ ≥ 5 and n(1 − pˆ ) ≥ 5 In our case, n=200, pˆ = 0.19 and both conditions are satisfied npˆ = 200 * 0.19 = 38 > 5 and n(1 − pˆ ) = 200 * 0.81 = 162 > 5 The standard error of the sample proportion is computed as: ˆ = s.e.( p) ˆ ˆ p(1− p) = n For 95% confidence interval Z 1−(α / 2 ) = Z 1−( 0.05 / 2 ) = 1.96 and the appropriate formula is the following: pˆ ± Z1−(α /2) ˆ ˆ p(1− p) = n b) Based on the computed interval, could you conclude that the proportion of all patents with osteoarthritis in the clinic is significantly lower than 50%? Explain. c) Compute the number patients required to estimate the population proportion p of all patients in the physician’s practice with diagnosed osteoarthritis with precision of 1% (E=0.01) at 95% confidence level. Since the true population proportion p is unknown, we will the formula for approximate sample size n with Z 1−(α / 2 ) = Z 1−( 0.05 / 2 ) = 1.96 2 ⎛ Z1−(α / 2) ⎞ ⎟⎟ = n = pˆ (1 − pˆ )⎜⎜ E ⎝ ⎠ Answer: 5913 4 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Introduction to Hypothesis Testing Recall that Hypothesis Testing uses the point estimate to attempt to reject/accept a hypothesis about the population. Usually researchers want to reject the notion that chance alone can explain the sample results. ü Hypothesis testing is applied to population parameters by specifying a null hypothesis (H0) that contains a null value for the population parameter—a value that would indicate a baseline, or that nothing of interest is happening: “old news”, “no difference”, etc. In most cases, the researchers are trying to show that the null value is not correct. ü Hypothesis testing proceeds by obtaining a sample, computing a point estimate (sample statistic), and assessing how unlikely to obtain this sample statistic if the null parameter value were correct. Basic Steps in Hypothesis Test Step 1: Determine the null (H0) and alternative (Ha) hypotheses. Note: Hypotheses are statements ABOUT population parameters NOT ABOUT sample statistics. Step 2: Verify necessary data conditions (assumptions), and if met, summarize the data into an appropriate test statistic (using appropriate data summary, or sample statistic). Step 3: Assuming the null (H0) hypothesis is true, find either rejection region or the p-value. Step 4: Decide whether or not the result is statistically significant based on rejection region or based on the p-value, the probability of getting a test statistic as extreme or more extreme (in the direction of Ha) than the observed value of the test statistic, assuming H0 is true. Decision based on the rejection region: --- If the test statistic falls into the rejection region, then we reject, then the result IS statistically significant, the decision is to reject H0; otherwise the result IS NOT statistically significant, the decision is to fail to reject H0. Decision based on the p-value: If the p-value ≤ α, then the result IS statistically significant, the decision is to reject H0. If the p-value >α, then the result IS NOT statistically significant, the decision is to fail to reject H0. Step 5: Report the conclusion in the context of the problem (question of interest). 5 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 One-Sample Hypothesis Test for Population Proportion (Large n) Test Scenario Population Proportion Data 1 Sample Population Parameter 𝑝 Sample Statistics Response 𝑥 𝑝 = 𝑛 # 𝑠𝑢𝑐𝑒𝑠𝑠𝑒𝑠 = 𝑛 Explanatory Variable ________ Categorical (YES/NO, Success/Failure, True/False) Is the true population proportion of adults who believe in life after death is more than 70%? Large Sample Hypothesis Test for Population Proportion H0: p=p0 Required assumptions: • Sample size n is large enough (check: 𝑛𝑝! ≥ 5 and 𝑛(1 − 𝑝! ) ≥ 5 ) • Data are a random sample from Binomial population. pˆ − p0 ! # !"#$!!$! Test Statistics: Z = where 𝑝 = ! = ! p0 (1 − p 0 ) n Decision Rule: Ha: p>p0 𝒁 ≥ 𝒁𝟏!𝜶 Ha: p≠p0 𝒁 ≥ 𝒁𝟏!𝜶/𝟐 Ha: p<p0 𝒁 ≤ −𝒁𝟏!𝜶 Example (D’Agostino, Example 7.3): Testing Proportion of Cases with Abnormality Correctly Detected Against a Referent. Suppose that a diagnostic test has been shown to be 80% effective in detecting a genetic abnormality in human cells. An investigator modifies the diagnostic testing protocol and wishes to test if the new protocol has a detection rate that is significantly different from 80% in specimens known to possess the abnormality. The new protocol is applied to 300 independent specimens of human cells known to possess the abnormality. The abnormality is detected in 222 specimens. Run the appropriate test at a 5% level of significance. Step1: Define parameter of interest and state the hypothesis. Parameter: p = true detection rate H0: p = 0.8 Ha: p ≠ 0.8 Significance level α = 0.05 Step2: Verify necessary data conditions and if met, summarize the data into an appropriate test statistic: pˆ = x = n n (1− p0 ) = np 0 = Both conditions are satisfied, so we will use Z as our test statistic: Z= pˆ − p0 = p0 (1− p0 ) n 6 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Step3: Assuming the H0 is true, define decision rule: Reject Ho if 𝒁 ≥ 𝒁𝟏!𝜶/𝟐 , 𝒐𝒓 𝒁 ≥ 𝟏. 𝟗𝟔 Step 4: Decide whether or not the result is statistically significant based on rejection region: Step 5: Report the conclusion in the context of the problem (question of interest). Based on the sample of n =______ abnormal specimens, there _________ significant evidence, at ______ level, to conclude that the modified protocol has a significantly different detection rate than 80% (the rate for original diagnostic test). Exercise: (D’Agostino, Example 7.3): Testing Proportion of Cases with Flu Following Vaccination Against Referent. Step 1: Define parameter of interest and state the hypothesis. Parameter: _________________________________________________________ H0: _____________ Ha: _________________ Significance level α =_______ Step 2: Verify necessary data conditions and if met, summarize the data into an appropriate test statistic: Check: 𝑛𝑝! ≥ 5 and 𝑛(1 − 𝑝! ) ≥ 5 Test statistic is: Z= pˆ − p 0 p 0 (1 − p 0 ) n = Step 3: Assuming the H0 is true, define decision rule: Reject Ho if _______________________________ Step 4: Decide whether or not the result is statistically significant based on rejection region: Step 5: Report the conclusion in the context of the problem (question of interest). Based on the sample of n=___________, there is ________ significant evidence, at level α=________, to conclude that ________________________________________________ 7 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Two-Sample Hypothesis Test for Difference in Population Proportions Assumptions Large n1, n2 𝒏𝟏 𝒑𝟏 ≥ 𝟓 and 𝒏𝟏 (𝟏 − 𝒑𝟏 ) ≥ 𝟓 and 𝒏𝟐 𝒑𝟐 ≥ 𝟓 𝒏𝟐 (𝟏 − 𝒑𝟐 ) ≥ 𝟓 Test Statistic pˆ 1 − pˆ 2 Z= ⎛ 1 1 ⎞ pˆ (1 − pˆ )⎜⎜ + ⎟⎟ ⎝ n1 n2 ⎠ Confidence Interval ( pˆ 1 − pˆ 2 ) ± Z1−(α / 2) where p ˆ 1 = X 1 / n1 , pˆ 2 = X 2 / n2 pˆ = X1 + X 2 n1 + n2 pˆ 1 (1 − pˆ 1 ) pˆ 2 (1 − pˆ 2 ) + n1 n2 ⎛ pq 2Z1−(α / 2) + p1 q1 + p 2 q 2 Z1− β ni = ⎜ ⎜ ES ⎝ ⎞ ⎟ ⎟ ⎠ 2 where ES=|p2-p1| (under Ha) p1 + p 2 ,q = 1− p 2 Note: when test for (p1-p2) or construct confidence interval for (p1-p2) necessary conditions are the same. p= Example (D’Agostino, Chapter 7, Problem 20): Suppose an observational study is conducted to investigate the smoking behaviors of male and female patients with a history of coronary heart disease. Among 220 men surveyed, 80 were smokers. Among 190 women surveyed, 95 were smokers. a. Construct a 95% confidence interval for the difference in the proportions of males and females who smoke. -What do we have? Categorical Variable: Yes = “smoke”, No = “does not smoke” Two groups: group 1 - male and group 2 – female, n1=220 x1=80 and n2=190 x2=95 - We can compute the corresponding sample proportions: 80 95 = 0.36 and pˆ2 = = 0.5 pˆ1 = 220 190 - The formula for a corresponding 95% CI for (p1 - p2) is pˆ (1 - pˆ1) pˆ2 (1 - pˆ2) (pˆ1 - pˆ2) ± Z1− α 1 + 2 n1 n2 In order to use it, we have to check if both samples are sufficiently large: min(n1 pˆ 1,n1(1- pˆ 1))=min(220(0.36),220(0.64))=79 > 5 min(n2 pˆ 2,n2(1- pˆ 2))=min(190(0.50),190(0.50))=95 >5 - Both conditions are satisfied, so we can use the formula and compute a 95% CI for (p1 - p2) (recall that for 95% confidence Z1− α = 1.96 ): 2 (0.36 - 0.50) + (1.960) 0.36(1 - 0.36) 0.50(1 - 0.50) = + 220 190 8 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 b. Based on part a), would you reject H0:p1=p2 (equivalent to H0:p1-p2=0)? ______________________________________ c. Perform an appropriate test of hypothesis to test if the proportion of female who smoke is significantly higher than the proportions of males who smoke at 5% significance level. Step 1: Define parameter of interest and state the hypothesis. Parameter: p1 – p2, true population difference in proportions of male and female smokers H0:___ p1-p2=0 ____ Ha:___ p1-p2<0________ Significance level α =0.05 Step 2: Verify necessary data conditions and if met, summarize the data into an appropriate test statistic: Check: 𝑛! 𝑝! ≥ 5 and 𝑛! (1 − 𝑝! ) ≥ 5 and 𝑛! 𝑝! ≥ 5 and 𝑛! (1 − 𝑝! ) ≥ 5. min(n1 pˆ 1,n1(1- pˆ 1))=min(220(0.36),220(0.64))=79 > 5 min(n2 pˆ 2,n2(1- pˆ 2))=min(190(0.50),190(0.50))=95 >5 Test statistic is: pˆ 1 − pˆ 2 Z= ⎛ 1 1 pˆ (1 − pˆ )⎜⎜ + ⎝ n1 n2 , where p ˆ 1 = X 1 / n1 , pˆ 2 = X 2 / n2 and pˆ = X1 + X 2 n1 + n2 ⎞ ⎟⎟ ⎠ X + X2 80 95 80 + 95 = 0.36 , pˆ2 = = 0.5 , and pˆ = 1 = = 0.4268 pˆ1 = 220 190 n1 + n2 220 + 190 pˆ 1 − pˆ 2 0.36 − 0.5 − 0.14 Z= = = = −2.8 0 . 05 0 . 43 ( 1 − 0 . 43 )( 1 / 220 + 1 / 190 ) ⎛ 1 1 ⎞ pˆ (1 − pˆ )⎜⎜ + ⎟⎟ ⎝ n1 n2 ⎠ Step 3: Assuming the H0 is true, define decision rule: ____________________________________________________________________ Step 4: Decide whether or not the result is statistically significant based on rejection region: _______________________________________________________________ Step 5: Report the conclusion in the context of the problem (question of interest). Based on two samples of male n1=220 and female n2=195, there is a significant evidence, at level α = 0.05,to conclude that the proportion of female who smoke is significantly higher than the proportion of males who smoke. Exercise: Go over examples in the D’Agostino’s book, Example 7.7 and Example 7.8. 9 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Sample Size Determination in Tests for Differences in Proportions Example (D’Agostino, Example 7.17, Chapter7): Suppose we wish to design a study to compare two treatments with respect to the proportion of successes in each. A two-sided test is planned at a 5% level of significance. Based on a review of the literature, p1=0.20. How many subjects would be required per group to detect p2=0.10 with 90% power? The formula to determine sample size is given by: ⎛ pq 2Z1−(α / 2) + p1 q1 + p 2 q 2 Z1− β ni = ⎜ ⎜ ES ⎝ 2 ⎞ ⎟ , where ES=|p2-p1| and p = p1 + p 2 , q = 1 − p ⎟ 2 ⎠ The ES (the effect size) is: ES=|p2-p1| = |0.2-0.1| = 0.1 Since α = 0.05, Z1-α/2 = Z0.975 = 1.96. Similarly, for the power = 0.90, β = 1 – power = 1-0.9 = 0.1, and Z1-β =Z0.90= 1.282 p1 + p 2 0.1 + 0.2 = = 0.15, 2 2 q = 1 − p = 1 − 0.15 = 0.85 p= Substituting, ⎛ pq 2 Z 1−(α / 2 ) + p1 q1 + p 2 q 2 Z 1− β ni = ⎜ ⎜ ES ⎝ = 265.9 ≈ 266 2 2 ⎞ ⎟ = ⎛⎜ 0.15 * 0.85 * 2 *1.96 + 0.2 * 0.8 + 0.1 * 0.9 *1.282 ⎞⎟ = ⎜ ⎟ ⎟ 0.1 ⎝ ⎠ ⎠ Thus, we need at least 266 subjects in each group. 10 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Binomial Distribution An important class of discrete variables is called the Binomial random variables. The Binomial distribution model has specific attributes: There are n trials (performances of the binomial experiment), where n is determined in advance and is not random. Each trial results in only one of the two possible outcomes, which we call either a success or a failure. The probability of a success on each trial is constant, denoted p, with 0≤p≤1. The probability of a failure on each trial is also constant, denoted q=1-p, with 0≤q≤1. The trials are independent. X~ Binomial (n, p) = “number of successes in the n trials of a binomial experiment” The Binomial Distribution X~ Binomial (n, p) Probability of exactly k successes in trials: 𝑃 𝑋 = 𝑘 = 𝐶!! 𝑝! 1 − 𝑝 where 𝑛 !! = !! !!! !. 𝑘 !!! = 𝑛 ! 𝑝 1−𝑝 𝑘 !!! Mean (Expected value) of X is 𝜇 = 𝑛𝑝 Standard Deviation of X is 𝜎 = 𝑛𝑝(1 − 𝑝) If 𝑛𝑝 ≥ 5 and 𝑛 1 − 𝑝 ≥ 5 , X is approximately 𝑁(𝜇 = 𝑛𝑝, 𝜎 = , 𝑛𝑝 1 − 𝑝 ) Exercise (Priority of Information) According to a national survey, 25% of teenagers can correctly name the city where the US Constitution was written. Assume a random sample of eight teenagers. a) Find the probability that none of the teenagers can name the city. b) Find the probability that at most two of the teenagers can name the city. 11 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 One-Sample Hypothesis Test for Population Proportion (small n) Small Sample Hypothesis Test for Population Proportion H0: p=p0 Required assumption: Data are a random sample from Binomial population. Test Statistics: X (observed # successes), X ~ Binomial(n, p0) Decision rule is based on p-value: Ha: p>p0 p-value = P(X≥x) = P(X=x)+P(X=x+1) +...+ P(X=n) Ha: p<p0 p-value = P(X≤x) = P(X=0)+P(X=1) +...+ P(X=x) Ha: p≠p0 p-value = P(X≠x) =1- P(X=x) If the p-value ≤ α, then reject H0. If the p-value >α, then fail to reject H0. Recall Probability of exactly k successes in trials: 𝑛 ! 𝑛 !! 𝑃 𝑋 = 𝑘 = 𝐶!! 𝑝!! 1 − 𝑝! !!! = 𝑝! 1 − 𝑝! !!! , where = !! !!! ! 𝑘 𝑘 Example: Kudzu Vine and Curbing Binge Drinking The hardy, invasive kudzu vine (shown in the picture at the right), introduced to this country decades ago to control soil erosion, could have what it takes to curb binge drinking, new research suggests. A researcher recruited 10 people in their 20s to spend two 90minute sessions consuming beer and watching TV. Researchers selected people who said they regularly consumed three to four drinks per day. After the first session, subjects received capsules of kudzu. None of the subjects had any side effects from mixing kudzu with beer. Findings showed that 80% of the subjects decreased their amount of beer intake (as compared to the first session levels). Question of interest: Can the researcher conclude that a majority of users of kudzu would decrease their beer intake? Step1. Parameter: p, true proportion of the subjects who decreased their beer intake H0: p=0.5 Ha: p>0.5 Significance level α = 0.10 (choose and fix in advance) Step 2: Verify necessary data conditions and compute an appropriate test statistic: np 0 = 10 * 0.5 = 5 n(1 − p0 ) = 5 Both conditions are met on the boundary, so we may, but would better not use Z statistics, instead we will use the observed number of successes x = 10*0.8 =8 as our test statistics. Step 3: Instead of definition of the rejection region, we will compute p-value and compare it to 10% significance level: 12 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 Step 4: Since p-value < .10 we reject H0. Step 5: Conclusion. Based on a study of n=10 people, there is significant evidence that a majority of users of kudzu would decrease their beer intake. Exercise: A multiple choice test has 10 questions each with 4 possible choices. A particular student claims he has a ‘gift’ and without even looking at the questions can do better than just guessing. This leads to the following hypotheses H0: p = 0.25 versus Ha: p > 0.25 where p = the probability of correctly guessing any question; note that p > ¼ implies the student is better than random guessing, supporting he has this ‘gift’. His test results come back and he got 8 out of 10 answers correct. Perform small sample hypothesis test for p. Step1. Determine the null (H0) and alternative (Ha) hypotheses. Parameter______________________________________________ H0:_______________ Ha:_________________ Significance level α =_________ Step 2: Verify necessary data conditions, and compute an appropriate test statistic Test statistic is: Step 3: Assuming H0 is true, define decision rule (based on rejection region or p-value) The decision rule: Reject Ho if ______________ Do not reject Ho if __________________________ Step 4: Decide whether or not the result is statistically significant (reject or fail to reject H0): Step 5: Report the conclusion in the context of the problem (question of interest). Based on the sample of n=____________________, there is________ significant evidence, at level α = ________________,to conclude that ____________________ ____________________________________________________________________ 13 CAS MA 116 • Statistics II • Summer 2, 2012 • Lecture 1.2 14