lecture 13 - Állatorvostudományi egyetem · lecture 13 testing the difference between means and...

79
© The McGraw-Hill Companies, Inc., 2000 Lecture 13 Lecture 13 Testing the Difference between Testing the Difference between Means and Variances Means and Variances * * Chi Chi - - square tests square tests

Upload: others

Post on 10-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

Lecture 13Lecture 13Testing the Difference between Testing the Difference between

Means and VariancesMeans and Variances**

ChiChi--square testssquare tests

Page 2: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

OutlineOutline

� 10-1 Introduction

� 10-2 Testing the Difference between Two Means: Large Samples

� 10-3 Testing the Difference between Two Variances

Page 3: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

OutlineOutline

� 10-4 Testing the Difference between Two Means: Small Independent Samples

� 10-5 Testing the Difference between Two Means: Small Dependent Samples

Page 4: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

10-1 Introduction

� Researchers wish to compare two sample means using experimental and control groups.

� Example: two brands of cough syrup might be tested to see whether one brand is more effective than the other.

Page 5: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

10-1 Introduction

� When comparing two means using the t test, the researcher must decide if the two samples are independent or dependent.

� When the samples are independent, there are two different formulas that can be used depending on whether or not the variances are equal (F test).

Page 6: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--2 Testing the Difference between 2 Testing the Difference between Two Means:Two Means:Large Samples

� Assumptions for this test:� Samples are independent.� The sampling populations must

be normally distributed.� Standard deviations are known

or samples must be at least 30.

Page 7: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--2 Testing the Difference between 2 Testing the Difference between Two Means:Two Means:Large Samples

µ σ1

2, 1

n s2

2, 2n s

1

2, 1

µ σ2

2, 2

Page 8: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

Situation 1

Page 9: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

Situation 2

Page 10: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--2 Formula for the 2 Formula for the zz Test for Comparing Test for Comparing Two Means from Independent PopulationsTwo Means from Independent Populations

( ) ( )z

X X

n n

=− − −

+

1 2 1 2

1

2

1

2

2

2

µ µσ σ

Page 11: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--22 zz Test for Comparing Two Means Test for Comparing Two Means

from Independent Populations from Independent Populations --Example

� A survey found that the average hotel room rate in New Orleans is $88.42 and the average room rate in Phoenix is $80.61. Assume that the data were obtained from two samples of 50 hotels each and that the standard deviations were $5.62 and $4.83 respectively. At αααα = 0.05, can it be concluded that there is no significant difference in the rates?

Page 12: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 1:Step 1: State the hypotheses and identify the claim.

� H0: µµµµ1111 = = = = µµµµ2222 (claim) H1: µµµµ1111 ≠ ≠ ≠ ≠ µµµµ2222

�� Step 2:Step 2: Find the critical values. Since αααα = 0.05 and the test is a two-tailed test, the critical values are z = ±±±±1.96.

�� Step 3: Step 3: Compute the test value.

1010--2 2 zz Test for Comparing Two Means Test for Comparing Two Means

from Independent Populationsfrom Independent Populations-- Example

Page 13: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--22 zz Test for Comparing Two Means Test for Comparing Two Means

from Independent Populationsfrom Independent Populations-- Example

( ) ( )

( )

zX X

n n

=− − −

+

= − −

+=

1 2 1 2

1

2

1

2

2

2

2 2

88 42 80 61 05 62

50

4 83

50

7 45

µ µσ σ

. .. .

.

Page 14: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 4:Step 4: Make the decision. Reject the null hypothesis at αααα = 0.05, since 7.45 > 1.96.

�� Step 5:Step 5: Summarize the results. There is enough evidence to reject the claim that the means are equal. Hence, there is a significant difference in the rates.

1010--22 zz Test for Comparing Two Means Test for Comparing Two Means

from Independent Populationsfrom Independent Populations-- Example

Page 15: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--2 2 PP--ValuesValues

� The P-values for the tests can be determined using the same procedure as shown in Section 9-3.

� The P-value for the previous example will be: P-value = 2 ××××P(z > 7.45) ≈ ≈ ≈ ≈ 2(0) = 0.

� You will reject the null hypothesis since the P-value = 0 < αααα = 0.05.

Page 16: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--2 Formula for Confidence Interval for2 Formula for Confidence Interval forDifference Between Two Means : Difference Between Two Means : Large

Samples

( )

( )

X Xn n

X Xn n

1 2

1

2

1

2

2

2

1 2

1 2

1

2

1

2

2

2

− − +

< − <

− + +

σ σ

µ µσ σ

z 2α )(

z 2α )(

Page 17: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--22 Confidence Interval for Difference of Two Confidence Interval for Difference of Two

Means: Large SamplesMeans: Large Samples-- Example

� Find the 95% confidence interval for the difference between the means for the data in the previous example.

� Substituting in the formula one gets (verify) 5.76 < µµµµ1111 − − − − µµµµ2222 < 9.86.

� Since the confidence interval does not contain zero, one would reject the null hypothesis in the previous example.

Page 18: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--3 Testing the Difference Between 3 Testing the Difference Between Two VariancesTwo Variances(F test)

� For the comparison of two variances or standard deviations, an F test is used.

� The sampling distribution of the variances is called the F distribution .

Page 19: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--3 Characteristics of the 3 Characteristics of the FF DistributionDistribution

� The values of F cannot be negative.� The distribution is positively skewed.� The mean value of F is approximately

equal to 1.� The F distribution is a family of curves

based on the degrees of freedom of the variance of the numerator and denominator.

Page 20: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--3 Curves for the 3 Curves for the FF DistributionDistribution

Page 21: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--3 Formula for the 3 Formula for the FF TestTest

.

Fs

s

where s is the larger of the two

numerator of freedom n

denominator of freedom n

n is the sample size from which the larger

was obtained

=

= −= −

1

2

2

2

1

2

1

2

1

1

1

variances

degrees

degrees

variance

.

Page 22: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The populations from which the samples were obtained must be normally distributed.

� The samples must be independent of each other.

1010--3 Assumptions for Testing the 3 Assumptions for Testing the Difference between Two VariancesDifference between Two Variances

Page 23: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� A researcher wishes to see whether the variances of the heart rates (in beats per minute) of smokers are different from the variances of heart rates of people who do not smoke. Two samples are selected, and the data are given on the next slide. Using αααα = 0.05, is there enough evidence to support the claim?

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

Page 24: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� For smokers n1 = 26 and = 36; for

nonsmokers n2 = 18 and = 10.�� Step 1:Step 1: State the hypotheses and

identify the claim. H0: = = = = H1: ≠ ≠ ≠ ≠ (claim)

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

s11

s22

σσσσ 21 σσσσ 2

2 σσσσ 21 σσσσ 2

2

Page 25: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 2:Step 2: Find the critical value. Since αααα = 0.05 and the test is a two-tailed test, use the 0.025 table. Here d.f. N. = 26 – 1 = 25, and d.f.D. = 18 – 1 = 17. The critical value is F = 2.56.

�� Step 3: Step 3: Compute the test value. F = / = 36/10 = 3.6.

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

s22s

21

Page 26: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 4:Step 4: Make the decision. Reject the null hypothesis, since 3.6 > 2.56.

�� Step 5:Step 5: Summarize the results. There is enough evidence to support the claim that the variances are different.

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

Page 27: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

2.562.562.562.56

3.63.63.63.6

Page 28: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� An instructor hypothesizes that the standard deviation of the final exam grades in her statistics class is larger for the male students than it is for the female students. The data from the final exam for the last semester are: males n1 = 16 and s1 = 4.2; females n2 = 18 and s2 = 2.3.

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

Page 29: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Is there enough evidence to support her claim, using αααα = 0.01?

�� Step 1:Step 1: State the hypotheses and identify the claim. H0: ≤≤≤≤ H1: > > > > (claim)

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

σσσσ 21 σσσσ 2

2 σσσσ 21 σσσσ 2

2

Page 30: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 2:Step 2: Find the critical value. Here, d.f.N. = 16 –1 = 15, and d.f.D. = 18 –1 = 17. For αααα = 0.01 table, the critical value is F = 3.31.

�� Step 3: Step 3: Compute the test value.F = (4.2)2/(2.3)2 = 3.33.

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

Page 31: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 4: Step 4: Make the decision. Reject the null hypothesis, since 3.33 > 3.31.

�� Step 5:Step 5: Summarize the results. There is enough evidence to support the claim that the standard deviation of the final exam grades for the male students is larger than that for the female students.

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

Page 32: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--3 3 Testing the Difference between Testing the Difference between Two VariancesTwo Variances -- Example

3.313.313.313.31

3.333.333.333.33

Page 33: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� When the sample sizes are small (< 30) and the population variances are unknown, a t test is used to test the difference between means.

� The two samples are assumed to be independent and the sampling populations are normally or approximately normally distributed.

1010--4 Testing the Difference between 4 Testing the Difference between Two Means:Two Means:Small Independent Samples

Page 34: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� There are two options for the use of the t test.

� When the variances of the populations are equal and when they are not equal.

� The F test can be used to establish whether the variances are equal or not.

1010--4 Testing the Difference between 4 Testing the Difference between Two Means:Two Means:Small Independent Samples

Page 35: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

( ) ( )t

X X

s

n

s

n

d f smaller of n or n

=− − −

+

= − −

1 2 1 2

1

2

1

2

2

2

1 21 1

µ µ

. .

1010--4 Testing the Difference between 4 Testing the Difference between Two Means:Two Means:Small Independent Samples -Test Value Formula

Unequal VariancesUnequal Variances

Page 36: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1010--4 Testing the Difference between 4 Testing the Difference between Two Means:Two Means:Small Independent Samples -Test Value Formula

Equal VariancesEqual Variances

( ) ( )t

X X

n s n sn n n n

d f n n

=− − −

− + −+ −

+

= + −

1 2 1 2

1 1

2

2 2

2

1 2 1 2

1 2

1 12

1 1

2

µ µ( ) ( )

. . .

Page 37: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The average size of a farm in Greene County, PA, is 199 acres, and the average size of a farm in Indiana County, PA, is 191 acres. Assume the data were obtained from two samples with standard deviations of 12 acres and 38 acres, respectively, and the sample sizes are 10 farms from Greene County and 8 farms in Indiana County. Can it be concluded at αααα = 0.05 that the average size of the farms in the two counties is different?

1010--4 Difference between Two Means: 4 Difference between Two Means: Small Independent Samples Small Independent Samples -- Example

Page 38: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Assume the populations are normally distributed.

� First we need to use the F test to determine whether or not the variances are equal.

� The critical value for the F test for αααα = 0.05 is 4.20.

� The test value = 38 2/122 = 10.03.

1010--4 Difference between Two Means: 4 Difference between Two Means: Small Independent Samples Small Independent Samples -- Example

Page 39: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Since 10.03 > 4.20, the decision is to reject the null hypothesis and conclude the variances are not equal.

�� Step 1:Step 1: State the hypotheses and identify the claim for the means.

� H0: µµµµ1111 = = = = µµµµ2 2 2 2 H1: µµµµ ≠ ≠ ≠ ≠ µµµµ2 2 2 2 (claim)

1010--4 Difference between Two Means: 4 Difference between Two Means: Small Independent Samples Small Independent Samples -- Example

Page 40: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 2:Step 2: Find the critical values. Since αααα = 0.05 and the test is a two-tailed test, the critical values are t = –2.365 and +2.365 with d.f. = 8 – 1 = 7.

�� Step 3:Step 3: Compute the test value. Substituting in the formula for the test value when the variances are not equal gives t = 0.57.

1010--4 Difference between Two Means: 4 Difference between Two Means: Small Independent Samples Small Independent Samples -- Example

Page 41: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 4: Step 4: Make the decision. Do not reject the null hypothesis, since 0.57 < 2.365.

�� Step 5: Step 5: Summarize the results. There is not enough evidence to support the claim that the average size of the farms is different.

�� Note:Note: If the the variances were equal -use the other test value formula.

1010--4 Difference between Two Means: 4 Difference between Two Means: Small Independent Samples Small Independent Samples -- Example

Page 42: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� When the values are dependent, employ a t test on the differences.

� Denote the differences with the symbol D, the mean of the population of differences with µµµµD, and the sample standard deviation of the differences with sD.

1010--5 Testing the Difference between 5 Testing the Difference between Two Means:Two Means:Small Dependent Samples

Page 43: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

tD

s n

where

D sample mean

of freedom n

D

D

= −

== −

µ

degrees 1

1010--5 Testing the Difference between Two 5 Testing the Difference between Two Means:Means:Small Dependent Samples -Formula for the test value.

Page 44: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Note:Note: This test is similar to a one sample t test, except it is done on the differences when the samples are dependent.

1010--5 Testing the Difference between Two 5 Testing the Difference between Two Means:Means:Small Dependent Samples -Formula for the test value.

Page 45: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

ChiChi--Square TestsSquare Tests

Page 46: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

OutlineOutline

� 12-1 Introduction

� 12-2 Test for Goodness of Fit

� 12-3 Tests Using Contingency Tables

Page 47: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

Introduction

� Chi-square distribution� test for frequency distributions, such as

“If a sample of buyers is given a choice of automobile colors, will each color be selected with the same frequency?”

Page 48: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

Introduction

� Test the independence of two variables. � For example, “Are senators’ opinions

on gun control independent of party affiliations?”

Page 49: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

Chi-square distribution

� It is a family of curves.� Each curve depends on a degree of

freedom.� A chi-square variable cannot be

negative.� Curves are asymmetric.

Page 50: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

Chi-square distribution

Page 51: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1212--2 Test for Goodness of Fit2 Test for Goodness of Fit

� When one is testing to see whether a frequency distribution fits a specific pattern, the chichi --square square goodnessgoodness --ofof --fit testfit test is used.

Page 52: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Suppose a market analyst wished to see whether consumers have any preference among five flavors of a new fruit soda. A sample of 100 people provided the following data:

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Cherry Straw-berry

Orange Lime Grape

32 28 16 14 10

Page 53: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� If there were no preference, one would expect that each flavor would be selected with equal frequency.

� In this case, the equal frequency is 100/5 = 20.

� That is, approximately 20 people would select each flavor.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 54: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The frequencies obtained from the sample are called observed observed frequenciesfrequencies .

� The frequencies obtained from calculations are called expected expected frequenciesfrequencies .

� Table for the test is shown next.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 55: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Freq. Cherry Straw-berry

Orange Lime Grape

Observed 32 28 16 14 10

Expected 20 20 20 20 20

Page 56: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The observed frequencies will almost always differ from the expected frequencies due to sampling error.

� Question: Are these differences significant, or are they due to chance?

� The chi-square goodness-of-fit test will enable one to answer this question.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 57: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The appropriate hypotheses for this example are:

� H0: Consumers show no preference for flavors of the fruit soda.

� H1: Consumers show a preference.� The d. f. for this test is equal to the

number of categories minus 1.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 58: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Formula

( )χ 2

2

1

= −∑

= −==

O E

E

d f number of categories

O observed frequency

E frequency

. .

expected

Page 59: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Is there enough evidence to reject the claim that there is no preference in the selection of fruit soda flavors? Let αααα = 0.05.

�� Step 1:Step 1: State the hypotheses and identify the claim.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 60: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� H0: Consumers show no preference for flavors (claim).

� H1: Consumers show a preference.�� Step 2:Step 2: Find the critical value. The d. f.

are 5 – 1 = 4 and αααα = 0.05. Hence, the critical value = 9.488.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 61: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 3:Step 3: Compute the test value. χχχχ2222 = (32 – 20)2/20 + (28 is – 20) 2/20 + … + (10 – 20)2/20 = 18.0.

�� Step 4:Step 4: Make the decision. The decision is to reject the null hypothesis, since 18.0 > 9.488.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 62: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 5:Step 5: Summarize the results. There is enough evidence to reject the claim that consumers show no preference for the flavors.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 63: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

9.488

18.018.018.018.0

Page 64: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The advisor of an ecology club at a large college believes that the group consists of 10% freshmen, 20% sophomores, 40% juniors, and 30% seniors. The membership for the club this year consisted of 14 freshmen, 19 sophomores, 51 juniors, and 16 seniors. At αααα = 0.10, test the advisor’s conjecture.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 65: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 1:Step 1: State the hypotheses and identify the claim.

� H0: The club consists of 10% freshmen, 20% sophomores, 40% juniors, and 30% seniors (claim)

� H1: The distribution is not the same as stated in the null hypothesis.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 66: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 2:Step 2: Find the critical value. The d. f. are 4 – 1 = 3 and αααα = 0.10. Hence, the critical value = 6.251.

�� Step 3:Step 3: Compute the test value.χχχχ 2222 = (14 – 10)2/10 + (19 – 20)2/20 + … + (16 – 30)2/30 = 11.208.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 67: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

�� Step 4:Step 4: Make the decision. The decision is to reject the null hypothesis, since 11.208 > 6.251.

�� Step 5:Step 5: Summarize the results. There is enough evidence to reject the advisor’s claim.

1212--2 Test for Goodness of Fit 2 Test for Goodness of Fit --Example

Page 68: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� When data can be tabulated in table form in terms of frequencies, several types of hypotheses can be tested using the chi-square test.

� Two such tests are the independence of independence of variablesvariables test and the homogeneity of homogeneity of proportionsproportions test.

1212--3 Tests Using Contingency Tables3 Tests Using Contingency Tables

Page 69: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The test of independence of variablestest of independence of variables is used to determine whether two variables are independent when a single sample is selected.

� The test of homogeneity of proportionstest of homogeneity of proportions is used to determine whether the proportions for a variable are equal when several samples are selected from different populations.

1212--3 Tests Using Contingency Tables3 Tests Using Contingency Tables

Page 70: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Suppose a new postoperative procedure is administered to a number of patients in a large hospital.

�� Question:Question: Do the doctors feel differently about this procedure from the nurses, or do they feel basically the same way?

� Data is on the next slide.

1212--3 Test for Independence 3 Test for Independence --Example

Page 71: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1212--3 Test for Independence 3 Test for Independence --Example

Group Prefernew

procedure

Preferold

procedure

Nopreference

Nurses 100 80 20

Doctors 50 120 30

Group Prefernew

procedure

Preferold

procedure

Nopreference

Nurses 100 80 20

Doctors 50 120 30

Page 72: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The null and the alternative hypotheses are as follows:

� H0: The opinion about the procedure is independentindependent of the profession.

� H1: The opinion about the procedure is dependentdependent on the profession.

1212--3 Test for Independence 3 Test for Independence --Example

Page 73: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� If the null hypothesis is not rejected, the test means that both professions feel basically the same way about the procedure, and the differences are due to chance.

� If the null hypothesis is rejected, the test means that one group feels differently about the procedure from the other.

1212--3 Test for Independence 3 Test for Independence --Example

Page 74: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Note: The rejection of the null hypothesis does not mean that one group favors the procedure and the other does not.

� The test value is the χχχχ 2 value (same as the goodness-of-fit test value).

� The expected values are computed from: (row sum) ××××(column sum)/(grand total) .

1212--3 Test for Independence 3 Test for Independence --Example

Page 75: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

1212--3 Test for Independence 3 Test for Independence --Example

Page 76: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� From the MINITAB output, the P-value = 0. Hence, the null hypothesis will be rejected.

� If the critical value approach is used, the degrees of freedom for the chi-square critical value will be (number of columns –1) ××××(number of rows – 1) .

� d.f. = (3 –1)(2 – 1) = 2.

1212--3 Test for Independence 3 Test for Independence --Example

Page 77: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� Here, samples are selected from several different populations and one is interested in determining whether the proportions of elements that have a common characteristic are the same for each population.

1212--3 Test for Homogeneity of 3 Test for Homogeneity of ProportionsProportions

Page 78: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The sample sizes are specified in advance, making either the row totals or column totals in the contingency table known before the samples are selected.

� The hypotheses will be: H0: p1 = p2 = … = pkH1: At least one proportion is different from the others.

1212--3 Test for Homogeneity of 3 Test for Homogeneity of ProportionsProportions

Page 79: Lecture 13 - Állatorvostudományi Egyetem · Lecture 13 Testing the Difference between Means and Variances * Chi -square tests ©The McGraw-Hill Companies, Inc.,2000 Outline 10-1

© The McGraw-Hill Companies, Inc., 2000

� The computations for this test are the same as that for the test of independence.

1212--3 Test for Homogeneity of 3 Test for Homogeneity of ProportionsProportions