1 hypothesis testing goodness-of-fit & independence chi-squared tests

9
1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

Upload: rosalind-edwards

Post on 18-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

1

Hypothesis Testing

Goodness-of-fit & Independence Chi-Squared Tests

Page 2: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

2

Goodness-of-fit Test

A managed forest has the following distribution of trees:

Douglas Fir 54%

Ponderosa Pine 40%

Grand Fir 5%

Western Larch 1%

Mannan & Meslow (1984) made 156 observations of foraging by red-breasted nuthatches and found the following:

Mannan, R.W., and E.C. Meslow. 1984. “Bird populations and vegetation characteristics in managed and old-growth forests, northeastern Oregon.” J. Wildl. Manage. 48: 1219-1238.

Douglas Fir 70

Ponderosa Pine 79

Grand Fir 3

Western Larch 4

Page 3: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

3

Hypotheses

Do the birds forage randomly, without regard to what species of tree they are in? To be true, the observed and expected distributions should be alike.

Null: The distributions are alike (good fit, meaning birds forage randomly)

Alternate: The distributions are different (lack of fit, or birds prefer certain vegetation)

Page 4: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

4

Expected Values

Based on the percentage distribution of trees, the expected counts for each type (out of 156) are:

Douglas Fir 84.24

Ponderosa Pine 62.40

Grand Fir 7.80

Western Larch 1.56

(54% of 156 = 84.24)

Page 5: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

5

Chi-Square Statistic

Expected Observed o-e (o-e)Sq(o-e)Sq/

e

Douglas Fir

84.24 70 -14.24 202.78 2.41

Ponderosa Pine

62.40 79 16.60 275.56

4.42

Grand Fir

7.80 3 -4.80 23.04 2.95

Western Larch 1.56 4 2.44 5.95 3.82

156.00 156Chi-square

= 13.593

p-value = 0.003514For p-value in Excel, type =CHIDIST(13.593,3),

for 3 degrees of freedom (n groups -1)

Page 6: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

6

Conclusion

Given the small p-value, we reject the null. These birds are not foraging randomly – they prefer certain types of trees.

Page 7: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

7

Test of Independence

Demographic data on 111 students is available. We wish to study gender differences, in this case pertaining to dog ownership.

Data Set: StudentVariables: Gender, Dog (Yes/No)

Are Gender and Dog Ownership independent of each other?

No

Dog

Have

Dog

Female 29 23

Male 35 24

Page 8: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

8

The Hypotheses

Null: The two variables are independent of each other (the occurrence of one does not influence the probability of the occurrence of the other.)

Alternate: They are not independent (one influences the other)

Page 9: 1 Hypothesis Testing Goodness-of-fit & Independence Chi-Squared Tests

9

Chi Square Test Results

Tabulated statistics: Gender, Dog

Rows: Gender Columns: Dog

No Yes All

Female 29 23 52 29.98 22.02 52.00

Male 35 24 59 34.02 24.98 59.00

All 64 47 111 64.00 47.00 111.00

Cell Contents: Count Expected count

Pearson Chi-Square = 0.143, DF = 1, P-Value = 0.705Likelihood Ratio Chi-Square = 0.143, DF = 1, P-Value = 0.705