Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hyp Test II: 1 Hypothesis Testing: Additional Applications In this lesson we consider a series of examples that parallel the situations we discussed for.

Similar presentations


Presentation on theme: "Hyp Test II: 1 Hypothesis Testing: Additional Applications In this lesson we consider a series of examples that parallel the situations we discussed for."— Presentation transcript:

1 Hyp Test II: 1 Hypothesis Testing: Additional Applications In this lesson we consider a series of examples that parallel the situations we discussed for confidence interval estimation. We will also focus on computer analysis for conducting hypothesis tests

2 Hyp Test II: 2 Applications we will consider: 1. One population,  2 known – test of the mean, . 2.One Normal population,  2 Unknown, test of mean,  (We have already done several examples of 1&2). 3.3.Paired, Normally distributed data – test of the mean within subject difference,  d. 4.Two Independent Normal populations, test of equality of  1 and  2 : a. UNknown Variances, assumed equal:  1 2   2 2 b. UNknown Variances, assumed UNequal:  1 2   2 2

3 Hyp Test II: 3 Applications continued: 5.One Normal population – test of the variance,  2. 6.Two Independent Normal distributions, test of equality of variances,  1 2 and  2 2. 7.One Binomial Distribution – test of proportion, 

4 Hyp Test II: 4 Application 3: Paired Normally Distributed Data: Test of  d 1.Research Question Ten patients participated in a study to determine if a diet low in fat is effective in “reducing cholesterol.” Cholesterol levels were measured prior to and following treatment. Is there a mean decrease in cholesterol level after the diet?

5 Hyp Test II: 5 This is paired data: ID PrePost 1200192 2178170 ……… 10222195 We are interested in whether the within- subject difference, post-pre, is close to zero, indicating no change, or far from zero, indicating a real change. 2. Assumptions The change in cholesterol levels are a random sample from a normal distribution with unknown variance.

6 Hyp Test II: 6 3. Specify H o and H a H o :  d = 0 H a :  d  0 While a one-sided test might be of interest, it is possible that cholesterol could increase so we are interested in change in either direction. 4. Test statistic: Variance UNknown suggests we use a t-statistic:

7 Hyp Test II: 7 5. Decision Rule Compare p-value to type I error set at .05. Reject H o for p<.05. 6. Calculations We have n=10, and after computing a difference for each subject find: x d = -15.1s d = 13.34  se = 4.22

8 Hyp Test II: 8 Achieved Significance (P-value): 7. Statistical Decision Since.006 <.05  p-value < type I error REJECT H o 8. Conclusion This sample suggests that the low fat diet was effective in lowering cholesterol – since a negative change indicates a decreased level post-diet.

9 Hyp Test II: 9 9.95% Confidence Interval Estimate x  t 9;.975 (se) = -15.1  2.26(4.22) = (-24.6, -5.6). This agrees with our conclusion in step 8: The confidence interval does not include zero in fact the upper limit of the interval is less than zero, indicating we are “confident” that there is a true mean decrease

10 Hyp Test II: 10 Notes: In this example, we wanted to test whether the within-subject mean difference was equal to zero. This type of test is known as a PAIRED t-TEST. Some computer packages offer a special computation of a paired t-test. In other software you must first compute the within-subject differences, and then conduct a one-sample t-test, with  0 = 0 Both strategies are available in Minitab

11 Hyp Test II: 11 Change in Cholesterol Data in Minitab To compute within subject differences use: Calc  Calculator Name new variable Type in expression to compute using variables and operators:

12 Hyp Test II: 12 Change in Cholesterol Data in Minitab with computed within-subject difference

13 Hyp Test II: 13 Using Minitab: 1-Sample t-test on Differences: Stat  Basic Statistics  1-Sample t Select Difference Variable Test Mean is Zero

14 Hyp Test II: 14 T-Test of the Mean Test of mu = 0.00 vs mu not = 0.00 Variable N Mean StDev SE Mean T P Post_Pre 10 -15.10 13.34 4.22 -3.58 0.0059

15 Hyp Test II: 15 Using Minitab: Paired t-test: Stat  Basic Statistics  Paired t Select the 2 variables Options lets you set mean and confidence level.

16 Hyp Test II: 16 Paired T-Test and Confidence Interval Paired T for Post - Pre N Mean StDev SE Mean Post 10 196.90 18.72 5.92 Pre 10 212.00 19.78 6.25 Difference 10 -15.10 13.34 4.22 95% CI for mean difference: (-24.64, -5.56) T-Test of mean difference = 0 (vs not = 0): T-Value = -3.58 P-Value = 0.006

17 Hyp Test II: 17 Application 4: Two Independent Normal Populations Test of Equality of Means a. Unknown (EQUAL) variances 1.Research Question In the ICU study, data was collected on 25 consecutive patients, on the type of admission, elective or emergency, and on patient age at admission. Is the mean patient age the same for emergency as for elective admission patients?

18 Hyp Test II: 18 2.Assumptions Independent samples from normal distributions This is equivalent to taking 2 separate independent samples of consecutive emergency admissions and consecutive elective admissions. Assume  1 2  0 2   2 is unknown. 3.Specify H o and H a H o :  1    0  0 (There is no difference in mean age) H a :  1    0  0 (The mean ages differ)

19 Hyp Test II: 19 4. Test statistic: Variance UNknown  t-statistic Variances assumed equal  pooled variance est. 5.Decision Rule Calculate achieved significance (P-value) Reject H o when p-value is less than type I error of.05

20 Hyp Test II: 20 6.Calculations Statistics on Age: Admit N Mean StDev 0.Elective 14 60.29 19.83 1.Emergency 11 52.64 25.17 Pooled Variance: Test Statistic:

21 Hyp Test II: 21 Achieved Significance (P-value): 7.Statistical Decision Since p-value >.05 There is insufficient evidence to reject the null hypothesis: do NOT reject 8.Conclusion The data do not indicate a statistically significant difference in the mean age between elective and emergency patients.

22 Hyp Test II: 22 9.95% Confidence Interval Estimate (x 1 – x 0 )  t 23;.975 (se) = - 7.65  2.069 (8.99) = (-26.24, 10.95). This agrees with our conclusion in step 8: The confidence interval includes zero While the sample means differ by almost 8 years, the variability in age is large, so this difference is not significant. If you feel 8 years is an important difference – failing to find this significant may be an issue of inadequate power

23 Hyp Test II: 23 In MINITAB: Enter data with 2 variables: Admit: admission status, 1=Emergency, 0=Elective Age: patient age in years

24 Hyp Test II: 24 Using MINITAB: Stat  Basic Stats  2-Sample t Samples: analysis variable Subscripts: variable defining groups Check to use pooled variance estimate

25 Hyp Test II: 25 Two-Sample T-Test and CI: Two-sample T for age admit N Mean StDev SE Mean 0 14 60.3 19.8 5.3 1 11 52.6 25.2 7.6 Difference = mu (0) - mu (1) Estimate for difference: 7.65 95% CI for difference: (-10.94, 26.24) T-Test of difference = 0 (vs not =): T-Value = 0.85 P-Value = 0.404 DF = 23 Both use Pooled StDev = 22.3

26 Hyp Test II: 26 Application 4: Two Independent Normals Test of Equality of Means b.UNknown (UNEQUAL) Variances 1.Research Question In the ICU study, data collected on these patients included the hospital length of stay (LOS) in days. Is the mean length of stay the same for emergency admission as for elective admission patients?

27 Hyp Test II: 27 2.Assumptions Independent samples from normal distributions This is equivalent to taking 2 separate independent samples of consecutive emergency admissions and consecutive elective admissions. Assume  1 2  2 2 unknown. 3.Specify H o and H a H o :  1    o  0 (No difference in means) H a :  1    o  0 (Means are different)

28 Hyp Test II: 28 4.Test statistic: use separate estimates of the variances of each sample Satterthwaite’s degrees of freedom

29 Hyp Test II: 29 5.Decision Rule Calculate achieved significance (P-value) Reject H o for p less than type I error of.05 6.Calculations straight to the computer analysis – tricky to do by hand – that degrees of freedom computation is a nightmare with a hand calculator!

30 Hyp Test II: 30 Using Minitab: Stats  Basic Stats  2-sample t Samples: analysis variable Subscripts: variable defining groups Do NOT Check to use separate variance estimates

31 Hyp Test II: 31 Two Sample T-Test and Confidence Interval Two sample T for LOS Admit N Mean StDev SE Mean 0 14 8.8 10.9 2.9 1 11 5.55 4.16 1.3 95% CI for mu (0) - mu (1): ( -3.5, 9.9) T-Test mu (0) = mu (1) (vs not =): T = 1.02 P = 0.32 DF = 17

32 Hyp Test II: 32 7.Statistical Decision Since p-value >.05 There is insufficient evidence to reject the null hypothesis: do NOT reject 8.Conclusion The data do not provide statistically significant evidence that LOS differs between elective and emergency patients.

33 Hyp Test II: 33 Note: A difference in hospital length of stay of 3 days is actually quite large. This difference as non-significant means we should probably consider: Are our assumptions met? Is the underlying distribution of LOS for each group really normal? LOS often has a very skewed distribution, with a few large outliers. We might want to consider other statistical methods – non- parametric methods. (beyond the scope of this course).

34 Hyp Test II: 34 Is our sample size large enough? Do we have adequate power to find what is clearly a clinically meaningful difference statistically significant? Since the variances were rather large, we probably need a much larger sample to address this question. See notes on sample size in context of hypothesis testing for further discussion of this point

35 Hyp Test II: 35 Application 5: One Normal distribution: Test of  2 Example: In drug manufacturing it is important that the amount of drug in the capsules be a particular value on the average that the variation around that value be very small. The drug company will consider its machine accurate enough if the capsules are filled within ± 1 SD =.5 mg of the desired amount of the drug. A sample of 20 capsules are taken, and contents weighed.

36 Hyp Test II: 36 1.Research Question: Is the variance of drug in the capsules greater than (.5) 2 = 0.25 mg 2 ? 2.Assumptions: The data are a random sample from a normal distribution. 3.Specify Hypotheses: H o :  2  0.25 H a :  2 > 0.25 (One-sided)

37 Hyp Test II: 37 4.Test Statistic: For a confidence interval for  2 : We used a chi-squared statistic, so our test statistic will be: Where  o 2 is specified by H o.

38 Hyp Test II: 38 5.Decision Rule: Calculate the achieved significance (p-value) and compare to  =.05. Reject H o for p<.05 We are interested only in a one-sided test: We want the probability for only one tail of the distribution, for a 1-sided test. In this case the upper tail, to reject H o for large values of observed s 2. Chi-squared Distribution, n-1 df

39 Hyp Test II: 39 6.Calculations: (Our sample gives: x = 2.00, s =.787, n=20 ) To compute achieved significance (p-value) for 1-sided test: 47.07

40 Hyp Test II: 40 7.Statistical Decision: Our achieved significance (p-value) is less than.05: we will therefore reject H o. 8.Conclusion: The variance of amount of drug per capsule, estimated at s 2 =.62 mg 2, is significantly greater than 0.25 mg 2. The company should adjust it’s machines.

41 Hyp Test II: 41 9.Confidence Interval Estimate: In this case, for a 1-sided test, want a 95% Lower confidence bound: I am 95% “confident” that the true variance is greater than 0.39 mg 2. (which is greater than 0.25 !)  2.95 = 30.14 area =.05

42 Hyp Test II: 42 Not directly available in Minitab (V12, 13) Use strategy of Obtain descriptive stats  s 2 Compute test statistic, y = (n-1)s 2 /  o 2 Obtain achieved significance: Pr[  n  2 > y] = 1 – Pr[y   n  2 ] Calc  Prob Dist  Chisq Cumulative Dist Function Chi-Square with 19 DF x P( X <= x ) 47.0700 0.9997

43 Hyp Test II: 43 Using Minitab to get Confidence Interval: Stat  Basic Stats  Display Descriptive Stats 1. Select variable 2. Select Graph menu 3. Check graphical summary and set confidence level

44 Hyp Test II: 44 Graphical Summary Results include: Use this to get lower bound for 95% 1-sided confidence interval for variance: (.625) 2 = 0.39  2.05  2.95 area =.05.90 area past  2.05 =.95

45 Hyp Test II: 45 Application 6: Two Independent Normal Distributions: Test of Equality of Variances 1.Research Question In the example on LOS of Emergency and Elective case ICU patients, we assumed that the variances in LOS of the two patient groups were different. Now I would like to test that assumption. My research question is, “Does the variability of LOS differ between emergency and elective patients?”

46 Hyp Test II: 46 2. Assumptions Independent simple random samples from normal distributions. 3.Specify H o and H a :

47 Hyp Test II: 47 4. Test Statistic: For comparing two variances we use the F-statistic: By convention: use larger value of s 2 in numerator when computing F-statistic 5. Decision Rule We’ll use a type I error =.05, and reject H o for p<.05.

48 Hyp Test II: 48 6.Computations:Descriptive Stats for LOS Admit N Mean StDevVar 0.Elective 14 8.79 10.91 119.10 1.Emergency 11 5.55 4.16 17.27 Here, use s 0 2 in numerator, as larger of 2 values:

49 Hyp Test II: 49 Achieved Significance: This is a 2-sided test H o, H a specified only equality of variances, not direction

50 Hyp Test II: 50 7.Statistical Decision The achieved significance is less than.05. We therefore reject H o in favor of the alternative. 8. Conclusion It appears that the variances of LOS among elective and emergency patients differ significantly. The standard deviation of elective patients is 10.9 days, while it is only 4.2 days for emergency patients.

51 Hyp Test II: 51 9.Confidence Interval: I am 95% “confident” that the true variance ratio is bounded away from zero. Note: Only need a lower limit. Since we always put the larger variance in the numerator, it will always be > 1. Therefore we only need to know if the lower limit is also >1.

52 Hyp Test II: 52 Test for equality of 2 variances is known as: Variance Ratio Test or F-test for Equality of Variances or F-test for Homogeneity of Variances In Minitab, this is available under: Stat  Basic Statistics  2 Variances (the above is not available in Version 12) OrStat  ANOVA  Test for Equal Variances OrStat  ANOVA  Homogeneity of Variances (depends upon version – test is the same)

53 Hyp Test II: 53 Stat  Basic Statistics  2 Variances (not in V.12) Samples: analysis variable Subscripts: group variable

54 Hyp Test II: 54 Stat  ANOVA  Test for Equal Variances Response: analysis variable Factors: group variable

55 Hyp Test II: 55 Test for Equal Variances (or Homogeneity of Variances) Response LOS Factors Admit ConfLvl 95.0000 Bonferroni confidence intervals for standard deviations Lower Sigma Upper N Factor Levels 7.57485 10.9135 18.9659 14 0(Emergency) 2.76712 4.1560 7.9877 11 1(Elective) F-Test (normal distribution) Test Statistic: 6.896 P-Value : 0.004 Levene's Test (any continuous distribution) Test Statistic: 1.526 P-Value : 0.229

56 Hyp Test II: 56

57 Hyp Test II: 57 Notes on Minitab Results: 95% Confidence intervals on the standard deviation for each sample are displayed – computations are done on variances, and square roots taken of the limits Note little overlap 2 tests for the equality of the variances: F-test assumes a normal distribution for LOS for each group Levene’s test does not require that we assume underlying normality

58 Hyp Test II: 58 Application 7: Test of Proportion - One Binomial Distribution 1. Research Question: In the ICU study, data was collected on 200 consecutive patients. 40 of the patients died in the hospital. Is there evidence that the in-hospital mortality rate differs from 25%?

59 Hyp Test II: 59 1.ASSUMPTIONS A random sample of patients (over time) The outcome of mortality follows a Binomial Distribution: Bin( , n). - 2 outcomes: live, die (success) - Probability of dying – constant - Independence of outcome across patients For large n, the sample proportion, p, follows a Normal distribution:

60 Hyp Test II: 60 3.Specify H o and H a 4.Test Statistic: 5.Decision Rule: We will reject H o for achieved significance less than  = 0.05.

61 Hyp Test II: 61 6. Computations Sample estimate: p = 40/200 =.20 Test Statistic: Achieved Significance:.25 -1.63 0 1.63 z

62 Hyp Test II: 62 7.Statistical Decision: Since p=.102 >.05  Fail to reject H o. 8.Conclusion: The observed mortality rate of 20% for ICU patients seen at this hospital is not inconsistent with the hypothesized rate of 25%. The difference is not statistically significant. 9.Confidence Interval Estimate:

63 Hyp Test II: 63 Using Minitab: Stat  Basic Stats  1 Proportion n p oo Check to use Normal approx.

64 Hyp Test II: 64 Test and CI for One Proportion (Normal Approximation) Test of p = 0.25 vs p not = 0.25 X N Sample p 95.0% CI Z-Value P-Value 40 200 0.200000 (0.144564, 0.255436) -1.63 0.102 Test and CI for One Proportion (Exact Binomial) Test of p = 0.25 vs p not = 0.25 Exact X N Sample p 95.0% CI P-Value 40 200 0.200000 (0.146894, 0.262226) 0.103


Download ppt "Hyp Test II: 1 Hypothesis Testing: Additional Applications In this lesson we consider a series of examples that parallel the situations we discussed for."

Similar presentations


Ads by Google