Hyp Test II: 1 Hypothesis Testing

advertisement

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

Hyp Test II: 1

Applications we will consider:

1. One population, s

2 known – test of the mean, m

.

2. One Normal population, s

2 Unknown, test of mean, m.

(We have already done several examples of 1&2).

3. 3. Paired, Normally distributed data – test of the mean within subject difference, m d

.

4. Two Independent Normal populations, test of equality of m

1 and m

2

: a. UNknown Variances, assumed equal: s

1

2

 s

2

2 b. UNknown Variances, assumed UNequal: s

1

2

 s

2

2

Hyp Test II: 2

Applications continued:

5. One Normal population – test of the variance, s

2 .

6. Two Independent Normal distributions, test of equality of variances, s

1

2 and s

2

2 .

7. One Binomial Distribution – test of proportion, p.

Hyp Test II: 3

Application 3: Paired Normally Distributed Data:

Test of m 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?

Hyp Test II: 4

This is paired data:

ID Pre Post

1 200 192

2 178 170

… … …

10 222 195

• We are interested in whether the withinsubject 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.

Hyp Test II: 5

3. Specify H o

H o

: m d and H a

= 0

H a

: m 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: t n

1

 x d

 m do s / n d

Hyp Test II: 6

5. Decision Rule

Compare p-value to type I error set at a 

.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.1

s d

= 13.34

 se = 4.22

t

 x d

 m do s / n d

15.1 0

 

3.58

4.22

Hyp Test II: 7

Achieved Significance (P-value): p

(2) Pr[ t

9

 

3.58]

2(.0030)

.006

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.

Hyp Test II: 8

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

Hyp Test II: 9

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 m

0

= 0

• Both strategies are available in Minitab

Hyp Test II: 10

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:

Hyp Test II: 11

Change in Cholesterol Data in Minitab with computed within-subject difference

Hyp Test II: 12

Using Minitab: 1-Sample t-test on Differences:

Stat

Basic Statistics

1-Sample t

Select Difference

Variable

Test Mean is Zero

Hyp Test II: 13

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

Hyp Test II: 14

Using Minitab: Paired t-test:

Stat

Basic Statistics

Paired t

Options lets you set mean and confidence level.

Select the 2 variables

Hyp Test II: 15

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

Hyp Test II: 16

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?

Hyp Test II: 17

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 s

1

2

 s

0

2

 s

2 is unknown.

3. Specify H o and H a

H o

: m

1

 m

0

0 (There is no difference in mean age)

H a

: m

1

 m

0

0 (The mean ages differ)

Hyp Test II: 18

4. Test statistic:

• Variance UNknown  t-statistic

• Variances assumed equal  pooled variance est.

t

( n

1

1) ( n

0

1)

( x

1

 x

0

) ( m m

1

0

) o s

2 p  s n n

1 0

2 p

5. Decision Rule

Calculate achieved significance (P-value)

Reject H o when p-value is less than type I error of

.05

Hyp Test II: 19

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: s

2 p

( n

1

1) s

1

2

( n

0

1) s

2

0

10(25.17)

2 

13(19.83)

( n

1

  n

0

1)

2

497.71

Test Statistic: t

( x

1

 x

0

) ( m m

1 0 s

2 s p  n n

1 0

2 p

) o

 

497.71

497.71

11 14

 

.851

Hyp Test II: 20

Achieved Significance (P-value): df

( n

1

  n

0

   

23 p

(2) Pr[ t

23

 

0.851]

2(.2018)

.4036

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.

Hyp Test II: 21

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

Hyp Test II: 22

In MINITAB: Enter data with 2 variables:

• Admit: admission status,

1=Emergency, 0=Elective

• Age: patient age in years

Hyp Test II: 23

Using MINITAB: Stat  Basic Stats  2-Sample t

Samples: analysis variable

Subscripts: variable defining groups

Check to use pooled variance estimate

Hyp Test II: 24

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

Hyp Test II: 25

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?

Hyp Test II: 26

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 s

1

2

 s

2

2 unknown.

3. Specify H o and H a

H o

: m

1

 m o

0 (No difference in means)

H a

: m

1

 m o

0 (Means are different)

Hyp Test II: 27

4. Test statistic:

• use separate estimates of the variances of each sample

• Satterthwaite’s degrees of freedom t

( x

1

 x

0

) ( m m

1

0 s

1

2

 s n n

1 0

2

0

) o f

 s

1

2 n n

1

 s 2

2

2

2

 n

1 s

1 n

2

1

1

2

 n s

2 n

2

2

2

1

2

Hyp Test II: 28

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!

Hyp Test II: 29

Using Minitab: Stats  Basic Stats  2-sample t

Samples: analysis variable

Subscripts: variable defining groups

Do NOT Check to use separate variance estimates

Hyp Test II: 30

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

Hyp Test II: 31

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.

Hyp Test II: 32

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 – nonparametric methods.

(beyond the scope of this course).

Hyp Test II: 33

• 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

Hyp Test II: 34

Application 5: One Normal distribution: Test of s

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.

Hyp Test II: 35

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

H o a

:

: s

2

0.25 s

2 > 0.25 (One-sided)

Hyp Test II: 36

4. Test Statistic:

For a confidence interval for s

2 :

• We used a chi-squared statistic, so our test statistic will be:

Y

( n

1) s

2 s o

2

• Where s o

2 is specified by H o

.

Hyp Test II: 37

5. Decision Rule:

Calculate the achieved significance (p-value) and compare to a

= .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

Hyp Test II: 38

6. Calculations: (Our sample gives: x = 2.00, s = .787, n=20 )

( n

 s

1) s

2

19(.787)

2

Y n

1

2

47.07

.25

o

To compute achieved significance (p-value) for

1-sided test:

Pr( Y

47.07)

 

Y

47.07)

.0003

47.07

Hyp Test II: 39

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.

Hyp Test II: 40

9. Confidence Interval Estimate:

• In this case, for a 1-sided test,

• want a 95% Lower confidence bound:

LL

( n

1) s n

2

1,1 a

2

19(.787)

30.14

2

.39

I am 95% “confident” that the true variance is greater than 0.39 mg 2 . (which is greater than 0.25 !) area = .05

2

.95

= 30.14

Hyp Test II: 41

Not directly available in Minitab (V12, 13)

• Use strategy of

• Obtain descriptive stats  s 2

• Compute test statistic, y = (n-1)s 2 / s o

2

• Obtain achieved significance:

Pr[

 n

1

2 > y] = 1 – Pr[y   n

1

2 ]

Calc  Prob Dist  Chisq

Cumulative Dist Function

Chi-Square with 19 DF x P( X <= x )

47.0700 0.9997

Hyp Test II: 42

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

Hyp Test II: 43

Graphical Summary Results include:

Use this to get lower bound for 95% 1-sided confidence interval for variance:

(.625) 2 = 0.39

area = .05

2

.05

.90

area = .05

2

.95

area past

2

.05

= .95

Hyp Test II: 44

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?”

Hyp Test II: 45

2. Assumptions

Independent simple random samples from normal distributions.

3. Specify H o

H o

: and H a

: s

2 s

1

 2 

0

H o

: s

1 s

2

2

0

1

H a

: s

2 s

1

 2 

0

H a

: s

1 s

2

2

0

1

Hyp Test II: 46

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

F n num

1; n den

1

2 s larger

2 s smaller

5. Decision Rule

We’ll use a type I error = .05, and reject H o for p<.05.

Hyp Test II: 47

6. Computations: Descriptive Stats for LOS

Admit N Mean StDev Var

0.Elective 14 8.79 10.91

1.Emergency 11 5.55 4.16

119.10

17.27

• Here, use s

0

2 in numerator, as larger of 2 values:

F n

0

1; n

1

1

 s

0

2 s

1

2 or F

13;10

119.10

17.27

6.92

Hyp Test II: 48

Achieved Significance: p

(2) Pr( F

13;10

6.92)

F

13;10

6.92)

  

.0042

• This is a 2-sided test

• H o

, H a specified only equality of variances, not direction

Hyp Test II: 49

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.

Hyp Test II: 50

9. Confidence Interval:

LL :

 s s

1

2

0

2

F

1 n

0

1, n

1

1;(1

 a

/ 2)

 

119.10

17.27

1

F

13,10;.975

 

6.92

 1

3.583

1.93

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.

Hyp Test II: 51

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)

Or Stat  ANOVA  Test for Equal Variances

Or Stat  ANOVA  Homogeneity of Variances

(depends upon version – test is the same)

Hyp Test II: 52

Stat  Basic Statistics  2 Variances (not in V.12)

Samples: analysis variable

Subscripts: group variable

Hyp Test II: 53

Stat  ANOVA  Test for Equal Variances

Response: analysis variable

Factors: group variable

Hyp Test II: 54

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

Hyp Test II: 55

Hyp Test II: 56

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

Hyp Test II: 57

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%?

Hyp Test II: 58

1. ASSUMPTIONS

• A random sample of patients (over time)

• The outcome of mortality follows a Binomial

Distribution: Bin( p

, 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: p ~ N p

, p

(1

 p

) n

Hyp Test II: 59

3. Specify H o and H a

H o

: p 

0.25

vs H a

: p 

0.25

4. Test Statistic: z

 p

 p o p

1 p o

 o

 n

5. Decision Rule:

We will reject H o than a

= 0.05 .

for achieved significance less

Hyp Test II: 60

6. Computations

Sample estimate: p = 40/200 = .20

Test Statistic: z

 p

 p o p

1 p o

 o

 n

Achieved Significance:

200

 

1.63

(2) Pr[ z

 

1.63]

2(.051)

.102

.25

-1.63 0 z

1.63

Hyp Test II: 61

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: p

 z

1

 a

/ 2

( )(1

 p )

.20 (1.96) n

(.2)(.8)

200

.20 (1.96)

(.2)(.8)

.20 .055

(.145,.255)

200

Hyp Test II: 62

Using Minitab: Stat  Basic Stats  1 Proportion p n p o

Check to use Normal approx.

Hyp Test II: 63

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

Hyp Test II: 64

Download