1 1 Slide Mátgæði Kafli 11 í Newbold Snjólfur Ólafsson + Slides Prepared by John Loucks ©...
-
Upload
scott-wells -
Category
Documents
-
view
218 -
download
0
Transcript of 1 1 Slide Mátgæði Kafli 11 í Newbold Snjólfur Ólafsson + Slides Prepared by John Loucks ©...
1 1 Slide
Slide
MátgæðiMátgæði
Kafli 11 í Newbold Kafli 11 í Newbold
Snjólfur ÓlafssonSnjólfur Ólafsson++
Slides Prepared bySlides Prepared by John LoucksJohn Loucks
© 1999 ITP/South-Western College Publishing© 1999 ITP/South-Western College Publishing
2 2 Slide
Slide
Tests of Goodness of Fit and Tests of Goodness of Fit and IndependenceIndependence
Goodness of Fit Test: A Multinomial Goodness of Fit Test: A Multinomial Population Population
Tests of Independence: Contingency TablesTests of Independence: Contingency Tables Goodness of Fit Test: Poisson and Normal Goodness of Fit Test: Poisson and Normal
DistributionsDistributions
3 3 Slide
Slide
Goodness of Fit Test:Goodness of Fit Test:A Multinomial PopulationA Multinomial Population
1. Set up the null and alternative hypotheses.1. Set up the null and alternative hypotheses.
2. Select a random sample and record the observed2. Select a random sample and record the observed
frequency, frequency, ffi i , for each of the , for each of the kk categories. categories.
3. Assuming 3. Assuming HH00 is true, compute the expected is true, compute the expected frequency, frequency, eei i , in each category by multiplying the , in each category by multiplying the category probability by the sample size.category probability by the sample size.
4. Compute the value of the test statistic.4. Compute the value of the test statistic.
5. Reject 5. Reject HH00 if if (where (where is the significance is the significance level and there are level and there are kk - 1 degrees of freedom). - 1 degrees of freedom).
22
1
( )f ee
i i
ii
k2
2
1
( )f ee
i i
ii
k
2 2 2 2
4 4 Slide
Slide
Example: Finger Lakes Homes (A)Example: Finger Lakes Homes (A)
Multinomial Distribution Goodness of Fit TestMultinomial Distribution Goodness of Fit Test
Finger Lakes Homes manufactures four models of Finger Lakes Homes manufactures four models of
prefabricated homes, a two-story colonial, a ranch, aprefabricated homes, a two-story colonial, a ranch, a
split-level, and an A-frame. To help in productionsplit-level, and an A-frame. To help in production
planning, management would like to determine ifplanning, management would like to determine if
previous customer purchases indicate that there is aprevious customer purchases indicate that there is a
preference in the style selected.preference in the style selected.
The number of homes sold of each model for 100The number of homes sold of each model for 100
sales over the past two years is shown below.sales over the past two years is shown below.
ModelModel Colonial Ranch Split-Level A-Frame Colonial Ranch Split-Level A-Frame
# Sold # Sold 30 30 20 35 15 20 35 15
5 5 Slide
Slide
Example: Finger Lakes Homes (A)Example: Finger Lakes Homes (A)
Multinomial Distribution Goodness of Fit TestMultinomial Distribution Goodness of Fit Test
LetLet
ppCC = population proportion that purchase a colonial = population proportion that purchase a colonial
ppRR = population proportion that purchase a ranch = population proportion that purchase a ranch
ppSS = population proportion that purchase a split-level = population proportion that purchase a split-level
ppAA = population proportion that purchase an A-frame = population proportion that purchase an A-frame
HypothesesHypotheses
HH00: : ppCC = = ppRR = = ppSS = = ppAA = .25 = .25
HHaa: The population proportions are not : The population proportions are not ppCC = .25, = .25,
ppRR = .25, = .25, ppSS = .25, and = .25, and ppAA = .25 = .25
6 6 Slide
Slide
Example: Finger Lakes Homes (A)Example: Finger Lakes Homes (A)
Multinomial Distribution Goodness of Fit TestMultinomial Distribution Goodness of Fit Test
Expected FrequenciesExpected Frequencies
ee11 = .25(100) = 25 = .25(100) = 25 ee22 = .25(100) = 25 = .25(100) = 25
ee33 = .25(100) = 25 = .25(100) = 25 ee44 = .25(100) = 25 = .25(100) = 25
Test StatisticTest Statistic
= 1 + 1 + 4 + 4 = 1 + 1 + 4 + 4
= 10= 10
22 2 2 230 25
2520 25
2535 25
2515 25
25 ( ) ( ) ( ) ( )2
2 2 2 230 2525
20 2525
35 2525
15 2525
( ) ( ) ( ) ( )
7 7 Slide
Slide
Multinomial Distribution Goodness of Fit TestMultinomial Distribution Goodness of Fit Test
Rejection RuleRejection Rule
With With = .05 and = .05 and
kk - 1 = 4 - 1 = 3 degrees of - 1 = 4 - 1 = 3 degrees of
freedomfreedom
ConclusionConclusion
We reject the assumption there is no home style We reject the assumption there is no home style
preference, at the .05 level of significance.preference, at the .05 level of significance.
22
7.81 7.81
Do Not Reject H0Do Not Reject H0 Reject H0Reject H0
Example: Finger Lakes Homes (A)Example: Finger Lakes Homes (A)
8 8 Slide
Slide
Tests of Independence: Contingency Tests of Independence: Contingency TablesTables
1. Set up the null and alternative hypotheses.1. Set up the null and alternative hypotheses.
2. Select a random sample and record the observed2. Select a random sample and record the observed
frequency, frequency, ffij ij , for each cell of the contingency table., for each cell of the contingency table.
3. Compute the expected frequency, 3. Compute the expected frequency, eeij ij , for each cell. , for each cell.
4. Compute the value of the test statistic.4. Compute the value of the test statistic.
5. Reject 5. Reject HH00 if (where if (where is the significance level is the significance level and with and with nn rows and rows and mm columns there are columns there are
((nn - 1)( - 1)(mm - 1) degrees of freedom). - 1) degrees of freedom).
ei j
ij (Row Total )(Column Total ) Sample Size
ei j
ij (Row Total )(Column Total ) Sample Size
22
( )f e
eij ij
ijji2
2
( )f e
eij ij
ijji
2 2 2 2
9 9 Slide
Slide
Example: Finger Lakes Homes (B)Example: Finger Lakes Homes (B) Contingency Table TestContingency Table Test
Each home sold can be classified according to price and Each home sold can be classified according to price and to style. Finger Lakes Homes’ manager would like to to style. Finger Lakes Homes’ manager would like to determine if the price of the home and the style of the determine if the price of the home and the style of the home are independent variables.home are independent variables.
The number of homes sold for each model and price for The number of homes sold for each model and price for the past two years is shown below. For convenience, the the past two years is shown below. For convenience, the price of the home is listed as either price of the home is listed as either $65,000 or less $65,000 or less or or more than $65,000more than $65,000..
Price Colonial Ranch Split-Level A-FramePrice Colonial Ranch Split-Level A-Frame
<< $65,000 18 $65,000 18 6 19 6 19 1212
> $65,000 12 14 16 3> $65,000 12 14 16 3
10 10 Slide
Slide
Contingency Table TestContingency Table Test
HypothesesHypotheses
HH00: Price of the home is independent of the style of: Price of the home is independent of the style of
the home that is purchasedthe home that is purchased
HHaa: Price of the home is : Price of the home is notnot independent of the independent of the
style of the home that is purchasedstyle of the home that is purchased
Expected FrequenciesExpected Frequencies
PricePrice Colonial Ranch Split-Level A-Frame Total Colonial Ranch Split-Level A-Frame Total
<< $65K 16,5 $65K 16,5 11 19,25 8,25 55 11 19,25 8,25 55
> $65K 13,5 9 15,75 6,75 > $65K 13,5 9 15,75 6,75 4545
Total 30 20 35 15 Total 30 20 35 15 100100
Example: Finger Lakes Homes (B)Example: Finger Lakes Homes (B)
11 11 Slide
Slide
Contingency Table TestContingency Table Test
Test StatisticTest Statistic
= .14 + 2.27 + . . . + 2.08 = 8.00= .14 + 2.27 + . . . + 2.08 = 8.00
Rejection RuleRejection Rule
With With = .05 and (2 - 1)(4 - 1) = 3 d.f., = .05 and (2 - 1)(4 - 1) = 3 d.f.,
Reject Reject HH00 if if 22 > 7.81 > 7.81
ConclusionConclusion
We reject We reject HH00. We reject the assumption that the. We reject the assumption that the
price of the home is independent of the style of theprice of the home is independent of the style of the
home that is purchased.home that is purchased.
22 2 218 16 5
16 56 11
113 6 75
6 75 ( . )
.( )
. .( . )
. . 2
2 2 218 16 516 5
6 1111
3 6 756 75
( . ).
( ). .
( . ).
.
. .052 7 81 . .052 7 81
Example: Finger Lakes Homes (B)Example: Finger Lakes Homes (B)
12 12 Slide
Slide
Goodness of Fit Test: Poisson DistributionGoodness of Fit Test: Poisson Distribution
1. Set up the null and alternative hypotheses.1. Set up the null and alternative hypotheses.
2. Select a random sample and2. Select a random sample and
a. Record the observed frequency, a. Record the observed frequency, ffi i , for each of the, for each of the
k k values of the Poisson random variable.values of the Poisson random variable.
b. Compute the mean number of occurrences, b. Compute the mean number of occurrences, ..
3. Compute the expected frequency of occurrences, 3. Compute the expected frequency of occurrences, eei i , , for each value of the Poisson random variable.for each value of the Poisson random variable.
4. Compute the value of the test statistic.4. Compute the value of the test statistic.
5. Reject 5. Reject HH00 if if (where (where is the significance level is the significance level
and there are and there are kk - 2 degrees of freedom). - 2 degrees of freedom).
22
1
( )f ee
i i
ii
k2
2
1
( )f ee
i i
ii
k
2 2 2 2
13 13 Slide
Slide
Example: Troy Parking GarageExample: Troy Parking Garage Poisson Distribution Goodness of Fit TestPoisson Distribution Goodness of Fit Test
In studying the need for an additional entrance to a city In studying the need for an additional entrance to a city parking garage, a consultant has recommended an parking garage, a consultant has recommended an approach that is applicable only in situations where the approach that is applicable only in situations where the number of cars entering during a specified time period number of cars entering during a specified time period follows a Poisson distribution.follows a Poisson distribution.
A random sample of 100 one-minute time intervals A random sample of 100 one-minute time intervals resulted in the customer arrivals listed below. A statistical resulted in the customer arrivals listed below. A statistical test must be conducted to see if the assumption of a test must be conducted to see if the assumption of a Poisson distribution is reasonable.Poisson distribution is reasonable.
# Arrivals # Arrivals 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 1212
FrequencyFrequency 0 1 4 10 14 20 12 12 9 8 6 3 0 1 4 10 14 20 12 12 9 8 6 3 11
14 14 Slide
Slide
Example: Troy Parking GarageExample: Troy Parking Garage
Poisson Distribution Goodness of Fit TestPoisson Distribution Goodness of Fit Test
HypothesesHypotheses
HH00: The number of cars entering the garage during a : The number of cars entering the garage during a one-minute interval is Poisson distributed. one-minute interval is Poisson distributed.
HHaa: The number of cars entering the garage during a : The number of cars entering the garage during a one-minute interval is one-minute interval is notnot Poisson distributed. Poisson distributed.
Estimate of Poisson Probability FunctionEstimate of Poisson Probability Function
otal Arrivals = 0(0) + 1(1) + 2(4) + . . . + 12(1) = 600otal Arrivals = 0(0) + 1(1) + 2(4) + . . . + 12(1) = 600
Total Time Periods = 100Total Time Periods = 100
Estimate of Estimate of = 600/100 = 6 = 600/100 = 6
f xex
x
( )!
6 6
f xex
x
( )!
6 6
15 15 Slide
Slide
Example: Troy Parking GarageExample: Troy Parking Garage
Poisson Distribution Goodness of Fit TestPoisson Distribution Goodness of Fit Test
Expected FrequenciesExpected Frequencies
xx f f ((x x )) xf xf ((x x )) xx f f ((x x )) xf xf ((x x ))
00 .0025.0025 .25 .25 7 7 .1389.1389 13.8913.89
11 .0149.0149 1.49 1.49 8 8 .1041.1041 10.4110.41
22 .0446.0446 4.46 4.46 9 9 .0694.0694 6.946.94
33 .0892.0892 8.92 8.92 1010 .0417.0417 4.174.17
44 .1339.1339 13.3913.39 1111 .0227.0227 2.272.27
55 .1620.1620 16.2016.20 1212 .0155.0155 1.551.55
66 .1606.1606 16.0616.06 Total Total 1.00001.0000 100.00100.00
16 16 Slide
Slide
Example: Troy Parking GarageExample: Troy Parking Garage Poisson Distribution Goodness of Fit TestPoisson Distribution Goodness of Fit Test
Observed and Expected FrequenciesObserved and Expected Frequencies
ii ffii eeii ffii - - eeii
0 or 1 or 20 or 1 or 2 55 6.206.20 -1.20-1.20
33 1010 8.928.92 1.081.08
44 1414 13.3913.39 .61.61
55 2020 16.2016.20 3.803.80
66 1212 16.0616.06 -4.06-4.06
77 1212 13.8913.89 -1.89-1.89
88 99 10.4110.41 -1.41-1.41
99 88 6.946.94 1.061.06
10 or more10 or more 1010 7.997.99 2.012.01
17 17 Slide
Slide
Poisson Distribution Goodness of Fit TestPoisson Distribution Goodness of Fit Test
Test StatisticTest Statistic
Rejection RuleRejection Rule
With With = .05 and = .05 and kk - - pp - 1 = 9 - 1 - 1 = 7 d.f. - 1 = 9 - 1 - 1 = 7 d.f.
(where (where kk = number of categories and = number of categories and pp = number = number
of population parameters estimated), of population parameters estimated),
Reject Reject HH00 if if 22 > 14.07 > 14.07
ConclusionConclusion
We cannot reject We cannot reject HH00. There is no reason to question. There is no reason to question
the assumption of a Poisson distribution.the assumption of a Poisson distribution.
22 2 21 20
6 201 088 92
2 017 99
3 42
( . )
.( . )
.. . .
( . ).
. 22 2 21 20
6 201 088 92
2 017 99
3 42
( . )
.( . )
.. . .
( . ).
.
. .052 14 07 . .052 14 07
Example: Troy Parking GarageExample: Troy Parking Garage
18 18 Slide
Slide
Mátgæði fyrir normaldreifinguMátgæði fyrir normaldreifingu
Tvær ólíkar leiðir.Tvær ólíkar leiðir.
A. Nota A. Nota 22 - próf eins og hér á undan. - próf eins og hér á undan.
B. Reikna B. Reikna skekkinguskekkingu og og ferilrisferilris og nota og nota Bowman-Shelton próf. Bowman-Shelton próf.
Þið þurfið að vita um þessar leiðir og vita hvað Þið þurfið að vita um þessar leiðir og vita hvað skekkingskekking og og ferilrisferilris segja, en þurfið ekki að segja, en þurfið ekki að reikna þetta.reikna þetta.
19 19 Slide
Slide
A. A. 22 - próf - próf
Meðaltal og staðalfrávik úrtaks notað í Meðaltal og staðalfrávik úrtaks notað í tilgátuprófi.tilgátuprófi.
HH00: Þýðið er normaldreift með meðalgildi og : Þýðið er normaldreift með meðalgildi og staðalfrávik eins og í úrtaki.staðalfrávik eins og í úrtaki.
HHaa: Svo er ekki.: Svo er ekki.
Rauntöluásnum skipt í hafilega mörg bil, þ.a. Rauntöluásnum skipt í hafilega mörg bil, þ.a. væntanlegur fjöldi á bili, samkvæmt H0, sé meiri væntanlegur fjöldi á bili, samkvæmt H0, sé meiri en 5. en 5.
ReiknaðReiknað o.s.frv.o.s.frv.
22
1
( )f ee
i i
ii
k2
2
1
( )f ee
i i
ii
k
20 20 Slide
Slide
B. Skekking og ferilrisB. Skekking og ferilris
Skekking (skewness) mælir hve samhverf Skekking (skewness) mælir hve samhverf tíðnidreifing er tíðnidreifing er
(assymmetry of a frequency distribution).(assymmetry of a frequency distribution).
Ferilris (kurtosis) mælir hve tíðnidreifing rís hátt Ferilris (kurtosis) mælir hve tíðnidreifing rís hátt
(flatness or peakedness of a frequency distribution)(flatness or peakedness of a frequency distribution)
31
3 /)(
s
nxxSkekking
n
ii
41
4 /)(
s
nxxFerilris
n
ii
21 21 Slide
Slide
Í Í Bowman-Shelton prófi er skekking og ferilris Bowman-Shelton prófi er skekking og ferilris reiknað fyrir úrtakið og athugað hvort það sé í reiknað fyrir úrtakið og athugað hvort það sé í nægilega góðu samræmi við skekkingu og nægilega góðu samræmi við skekkingu og ferilris fyrir normaldreifingu.ferilris fyrir normaldreifingu.
Skekking og ferilris - framhaldSkekking og ferilris - framhald