640 likes | 829 Vues
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. Applications we will consider:
E N D
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
Applications we will consider: • 1. One population, s2 known – test of the mean, m. • One Normal population, s2 Unknown, test of mean, m. (We have already done several examples of 1&2). • 3. Paired, Normally distributed data – test of the mean within subject difference, md. • 4. Two Independent Normal populations, test of equality of m1 and m2: • a. UNknown Variances, assumed equal: s12 s22 • b. UNknown Variances, assumed UNequal: s12 s22
Applications continued: 5. One Normal population – test of the variance, s2 . 6. Two Independent Normal distributions, test of equality of variances, s12 and s22. 7. One Binomial Distribution – test of proportion, p.
Application 3: Paired Normally Distributed Data: • Test of md • 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?
This is paired data: • IDPre Post • 1 200 192 • 2 178 170 • … … … • 10 222 195 • 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.
3. Specify Ho and Ha • Ho: md = 0 • Ha: md 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:
5. Decision Rule Compare p-value to type I error set at a = .05 . Reject Ho for p<.05 . 6. Calculations We have n=10, and after computing a difference for each subject find: xd = -15.1 sd = 13.34 se = 4.22
Achieved Significance (P-value): 7. Statistical Decision Since .006 < .05 p-value < type I error REJECT Ho 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.
95% Confidence Interval Estimate • x t9; .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
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 m0 = 0 • Both strategies are available in Minitab
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:
Change in Cholesterol Data in Minitab with computed within-subject difference
Using Minitab: 1-Sample t-test on Differences: • Stat Basic Statistics 1-Sample t Select Difference Variable Test Mean is Zero
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
Using Minitab: Paired t-test: • Stat Basic Statistics Paired t Options lets you set mean and confidence level. Select the 2 variables
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
Application4: 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?
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 s12= s02s2 is unknown. • Specify Ho and Ha • Ho: m1 -m0= 0 (There is no difference in mean age) • Ha: m1 -m0 0 (The mean ages differ)
4. Test statistic: • Variance UNknown t-statistic • Variances assumed equal pooled variance est. 5. Decision Rule Calculate achieved significance (P-value) Reject Ho when p-value is less than type I error of .05
CalculationsStatistics on Age: • Admit N Mean StDev • 0.Elective 14 60.29 19.83 • 1.Emergency 11 52.64 25.17 • Pooled Variance: • Test Statistic:
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.
95% Confidence Interval Estimate • (x1 – x0) t23; .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
In MINITAB: Enter data with 2 variables: • Admit: admission status, 1=Emergency, 0=Elective • Age: patient age in years
Using MINITAB: Stat Basic Stats 2-Sample t Samples: analysis variable Subscripts: variable defining groups Check to use pooled variance estimate
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
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?
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 s12 s22unknown. • Specify Ho and Ha • Ho: m1 -mo= 0 (No difference in means) • Ha: m1 -mo 0 (Means are different)
Test statistic: • use separate estimates of the variances of each sample • Satterthwaite’s degrees of freedom
5. Decision Rule • Calculate achieved significance (P-value) • Reject Ho 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!
Using Minitab: Stats Basic Stats 2-sample t Samples: analysis variable Subscripts: variable defining groups Do NOT Check to use separate variance estimates
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
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.
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).
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
Application 5: One Normal distribution: Test of s2 • 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.
Research Question: • Is the variance of drug in the capsules greater than (.5)2 = 0.25 mg2? • Assumptions: • The data are a random sample from a normal distribution. • Specify Hypotheses: • Ho: s2£ 0.25 • Ha: s2 > 0.25 (One-sided)
Test Statistic: • For a confidence interval for s2: • We used a chi-squared statistic, so our test statistic will be: • Where so2 is specified by Ho.
Decision Rule: • Calculate the achieved significance (p-value) and compare to a = .05. Reject Ho 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 Ho for large values of observed s2. Chi-squared Distribution, n-1 df
Calculations: (Our sample gives: • x = 2.00, s = .787, n=20 ) • To compute achieved significance (p-value) for 1-sided test: 47.07
Statistical Decision: • Our achieved significance (p-value) is less than .05: we will therefore reject Ho. • Conclusion: • The variance of amount of drug per capsule, estimated at s2=.62 mg2, is significantly greater than 0.25 mg2. The company should adjust it’s machines.
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 mg2 . (which is greater than 0.25 !) area = .05 c2.95 = 30.14
Not directly available in Minitab (V12, 13) • Use strategy of • Obtain descriptive stats s2 • Compute test statistic, y = (n-1)s2/so2 • Obtain achieved significance: Pr[cn-12 > y] = 1 – Pr[y cn-12] CalcProb DistChisq Cumulative Dist Function Chi-Square with 19 DF x P( X <= x ) 47.0700 0.9997
Using Minitab to get Confidence Interval: • Stat Basic Stats Display Descriptive Stats 3. Check graphical summary and set confidence level 1. Select variable 2. Select Graph menu
Graphical Summary Results include: • Use this to get lower bound for 95% 1-sided confidence interval for variance: • (.625)2 = 0.39 area = .05 area = .05 .90 c2.05 c2.95 area past c2.05 = .95
Application 6: Two Independent Normal Distributions: Test of Equality of Variances • 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?”
2. Assumptions Independent simple random samples from normal distributions. 3. Specify Ho and Ha:
4. Test Statistic: • For comparing two variances we use the F-statistic: • By convention: use larger value of s2 in numerator when computing F-statistic 5. Decision Rule We’ll use a type I error = .05, and reject Ho for p<.05.
Computations: Descriptive Stats for LOS • Admit N Mean StDev Var • 0.Elective 14 8.79 10.91 119.10 • 1.Emergency 11 5.55 4.16 17.27 • Here, use s02 in numerator, as larger of 2 values:
Achieved Significance: • This is a 2-sided test • Ho, Ha specified only equality of variances, not direction
Statistical Decision • The achieved significance is less than .05. • We therefore reject Ho 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.