第 9章 参数假设检验
Hypotheses Test with Parametrics
[开篇案例 ]
北京地区大学教授与合资企业职工收入比较
统计量 大学教授 合资企业职工
样本含量 n=150 n=150
平均收入 ¥ 1000 ¥ 1000
标准差 ¥ 200 ¥ 800
标准误 ¥ 16.33 ¥ 65.32
95%的 CI ( 968,1032) ( 872,1128)
问题:
两人群收入的离散(“贫富”分化)程度如何?
一、假设检验的基本概念
某项市场调研想分析一次特定的广告大战之后
是否明显提高了某彩电在消费者中的知名度
?是否显著激发了消费兴趣? ----显著性检验
1、零假设与备择假设
零假设( null hypothesis,H0) 又称无差异假设
备择假设( alternative hypothesis,H1),单双侧
2、假设检验的分类
参数检验 (parametric tests)要求明确的总体分布
非参数检验 (non-parametric tests)无须总体分布
3、显著性水平:样本参数偏离总体参数的概率
4、假设检验的基本步骤
正确给出两类假设及检验水平;
正确选择并计算样本统计量的值;
将样本统计量与 由样本含量、检验水平及统计量
的理论分布决定的 临界值比较,获得样本统
计量大(小)于临界值的概率 P;
将 P与检验水平比较,并做出是否拒绝或不拒绝
零假设的决策。
5、两类错误,接受 H0 拒绝 H0
H0为真 --- I型错误
H0为假 II型错误 ---
二,One-Sample Tests ( 单样本检验)
?Hypothesis Testing Methodology
?Z Test for the Mean (s Known总体方差已知 )
? p-Value Approach to Hypothesis Testing
?Connection to Confidence Interval Estimation
?One Tail Test(单侧检验)
? t Test of Hypothesis for the Mean
?Z Test of Hypothesis for the Proportion
A hypothesis is an
assumption about the
population parameter.
? A parameter is a
Population mean or
proportion
? The parameter must be
identified before
analysis.
I assume the mean GPA
of this class is 3.5!
1984-1994 T/Maker Co.
What is a Hypothesis?
关于总体参数的假设
? States the Assumption (numerical) to be tested
e.g,The average # TV sets in US homes is at
least 3 (H0,m >3)
? Begin with the assumption that the null
hypothesis is TRUE,
(Similar to the notion of innocent until proven guilty)
The Null Hypothesis,H0
无效假设
?Refers to the Status Quo
?Always contains the?=?sign
?The Null Hypothesis may or may not be rejected.
? Is the opposite of the null hypothesis
e.g,The average # TV sets in US homes is
less than 3 (H1,m < 3)
? Challenges the Status Quo
? Never contains thesign
? The Alternative Hypothesis may or may
not be accepted
The Alternative Hypothesis,H1
被择假设
Steps:
?State the Null Hypothesis (H0,m = 3)
?State its opposite,the Alternative
Hypothesis (H1,m < 3)
?Hypotheses are mutually exclusive &
exhaustive
?Sometimes it is easier to form the
alternative hypothesis first.
Identify the Problem
解决问题的步骤
Population
Assume the
population
mean age is 50.
(Null Hypothesis)
REJECT
The Sample
Mean Is 20
SampleNull Hypothesis
5 0?20 ?@? mXIs
Hypothesis Testing Process
假设检验过程
No,not likely!
Sample Meanm = 50
Sampling Distribution
It is unlikely
that we would
get a sample
mean of this
value,..
..,if in fact this were
the population mean.
..,Therefore,we
reject the null
hypothesis that
m = 50.
20 H
0
Reason for Rejecting H0
拒绝无效假设的原因
小概率事件原理
? Defines Unlikely Values of Sample
Statistic if Null Hypothesis Is True
? Called Rejection Region of Sampling
Distribution
? Designateda (alpha)
? Typical values are 0.01,0.05,0.10
? Selected by the Researcher at the Start
? Provides the Critical Value(s) of the Test
Level of Significance,a
显著性水平
Level of Significance,a and
the Rejection Region
H0,m =3
H1,m < 3
0
0
0
H0,m?3
H1,m > 3
H0,m? 3
H1,m 3
a
a
a/2
Critical
Value(s)
Rejection
Regions
拒绝域
? Type I Error(I型错误)
? Reject True Null Hypothesis
? Has Serious Consequences
? Probability of Type I Error Is a
? Called Level of Significance
? Type II Error( II型错误)
? Do Not Reject False Null Hypothesis
? Probability of Type II Error Is b (Beta)
Errors in Making Decisions
决策错误
H0,Innocent
Jury Trial Hypothesis Test
Actual Situation Actual Situation
Verdict Innocent Guilty Decision H0 True H0 False
Innocent Correct Error
Do Not
Reject
H0
1 - a Type IIError (b)
Guilty Error Correct RejectH
0
Type I
Error
(a )
Power
(1 - b)
Result Possibilities
a
b
Reduce probability of one error
and the other one goes up.
a & b Have an
Inverse Relationship
? True Value of Population Parameter
? Increases When Difference Between Hypothesized
Parameter & True Value Decreases
? Significance Level a
? Increases When a Decreases
? Population Standard Deviation s
? Increases When s Increases
? Sample Size n
? Increases When n Decreases
Factors Affecting
Type II Error,b
a
b
b s
b
n
? Convert Sample Statistic (e.g.,) to
Standardized Z Variable
? Compare to Critical Z Value(s)
? If Z test Statistic falls in Critical Region,
Reject H0; Otherwise Do Not Reject H0
Z-Test Statistics (s Known)
Test Statistic
X
n
XX
Z
X
X
s
m
s
m ?
?
?
?
? Probability of Obtaining a Test Statistic
More Extreme ( or ) than Actual Sample
Value Given H0 Is True
? Called Observed Level of Significance
? Smallest Value of a H0 Can Be Rejected
? Used to Make Rejection Decision
? If p value?a,Do Not Reject H0
? If p value < a,Reject H0
p Value Test
1,State H0 H0, m?3
2,State H1 H1, m < 3
3,Choose a a =,05
4,Choose n n = 100
5,Choose Test,Z Test (or p Value)
Hypothesis Testing,Steps
Test the Assumption that the true mean #
of TV sets in US homes is at least 3.
6,Set Up Critical Value(s) Z = -1.645
7,Collect Data 100 households surveyed
8,Compute Test Statistic Computed Test Stat.= -2
9,Make Statistical Decision Reject Null Hypothesis
10,Express Decision The true mean # of TV set
is less than 3 in the US
households.
Hypothesis Testing,Steps
Test the Assumption that the average # of
TV sets in US homes is at least 3.
(continued)
? Assumptions
? Population Is Normally Distributed
? If Not Normal,use large samples
? Null Hypothesis Has or Sign Only
? Z Test Statistic:
One-Tail Z Test for Mean
(s Known)
n
xx
z
x
x
s
m
s
m ?
?
?
?
Z0
a
Reject H0
Z0
Reject H0
a
H0,m?0
H1,m < 0
H0,m?0
H1,m > 0
Must Be Significantly
Belowm = 0
Small values don’t contradict H0
Don’t Reject H0!
Rejection Region
Does an average box of
cereal contain more than
368 grams of cereal? A
random sample of 25 boxes
showed X = 372.5,The
company has specified s to
be 15 grams,Test at the
a?0.05 level.
368 gm.
Example,One Tail Test
H0,m? 368
H1,m > 368
_
Z,04,06
1.6,5495,5505,5515
1.7,5591,5599,5608
1.8,5671,5678,5686
.5738,5750
Z0
sZ = 1
1.645
.50
-.05
.45
.05
1.9,5744
Standardized Normal
Probability Table (Portion)What Is Z Given a = 0.05?
a =,05
Finding Critical Values,One Tail
单侧检验的界值
Critical Value
= 1.645
a = 0.025
n = 25
Critical Value,1.645
Test Statistic,
Decision:
Conclusion:
Do Not Reject at a =,05
No Evidence True Mean
Is More than 368Z0 1.645
.05
Reject
Example Solution,One Tail
H0,m ? 368
H1,m > 368 50.1?
?
?
n
X
Z
s
m
Z0 1.50
p Value
.0668
Z Value of Sample
Statistic
From Z Table,
Lookup 1.50
.9332
Use the
alternative
hypothesis
to find the
direction of
the test.
1.0000
-,9332
.0668
p Value is P(Z >= 1.50) = 0.0668
p Value Solution
0 1.50 Z
Reject
(p Value = 0.0668) > (a = 0.05),
Do Not Reject.
p Value = 0.0668
a = 0.05
Test Statistic Is In the Do Not Reject Region
p Value Solution
Does an average box of
cereal contains 368 grams of
cereal? A random sample of
25 boxes showed X = 372.5.
The company has specified
s to be 15 grams,Test at the
a?0.05 level.
368 gm.
Example,Two Tail Test
双侧检验
H0,m ? 368
H1,m 368
a = 0.05
n = 25
Critical Value,?.96
Test Statistic,
Decision:
Conclusion:
Do Not Reject at a =,05
No Evidence that True
Mean Is Not 368Z0 1.96
.025
Reject
Example Solution,Two Tail
-1.96
.025
H0,m ? 386
H1,m 386 50.1
25
15
3 6 85.3 7 2 ?????
n
XZ
s
m
Connection to
Confidence Intervals
For X = 372.5,s = 15 and n = 25,
The 95% Confidence Interval is:
372.5 - (1.96) 15/ 25 to 372.5 + (1.96) 15/ 25
or ( 366.62 m 378.38)
If this interval contains the Hypothesized mean
(368),we do not reject the null hypothesis.
It does,Do not reject.
_
Assumptions
? Population is normally distributed
? If not normal,only slightly skewed & a large
sample taken
Parametric test procedure(参数检验过程)
t test statistic
t-Test,s Unknown
n
S
X
t
m?
?
Example,One Tail t-Test
Does an average box of cereal
contain more than 368 grams
of cereal? A random sample of
36 boxes showed X = 372.5,
and s? 15,Test at the a?0.01
level,368 gm.
H0,m 368
H1,m > 368s is not given,
a = 0.01
n = 36,df = 35
Critical Value,2.4377
Test Statistic,
Decision:
Conclusion:
Do Not Reject at a =,01
No Evidence that True
Mean Is More than 368Z0 2.4377
.01
Reject
Example Solution,One Tail
H0,m? 368
H1,m > 368
80.1
36
15
3685.372 ?????
n
S
Xt m
[实例分析 ]:某电视机厂欲检验生产显象管的新
工序是否优于旧工序(即与旧工序下的平均
寿命 1200小时比较)
解:
分析,P<0.05,拒绝零假设,可以认为新工序生
产的显象管总体的平均寿命优于旧工序。
注意:统计检验结果的表达方式。
)99(66.117.2
1 0 0/3 0 0
1 2 0 01 2 6 5
3 0 0,1 2 6 5,1 0 0
05.0;1 2 0 0:,1 2 0 0:
05.0
10
tt
SXn
HH
?>?
?
?
???
?>? amm
? Involves categorical variables
? Fraction or % of population in a category
? If two categorical outcomes,binomial
distribution
? Either possesses or doesn抰 possess the characteristic
? Sample proportion (ps)
Proportions
比例
s i zes a m p l e
s u c c e s s e sofn u m b e r
n
Xp
s ??
? 单样本比例(率)的假设检验
正态近似法(适于已知总体率接近 0.5)
直接计算概率法 ---二项分布的累计概率法
)1(
1,
)1(
.,01.0,05.0
),(:
:
~
a r g
00
0
01
00
?
??
?
?
?
?
><?
?
?
ntu
n
n
P
u
alet
H
H
eln
a
?
??
?
a
??
??
jnjnk
j
j
nCjXPkXP
??
?
??????? ? ? )1()()( 00
0
??
[实例分析 ]要检验 1960年美国大选前盖洛调查公司对
总统选举预测结果( 51%)是否与实际选举结果
(肯尼迪得票 50.1%)有显著差异?
结论,P>0.05,不拒绝零假设,尚不能认为盖洛调查
公司预测的总统选举结果与实际结果有显著的统
计学意义上的差异。
再一次提醒:统计结论不能绝对化!!!
)(96.1
70.01 5 0 0/)1.501 0 0(1.50)1.5051(
%,51,11 5 0 0,05.0
%,1.50:%,1.50:
05.0
10
??<
????
????
??
t
u
P
HH
?a
??
Example:Z Test for Proportion
?Problem,A marketing company claims
that it receives 4% responses from its
Mailing,
?Approach,To test this claim,a random
sample of 500 were surveyed with 25
responses,
?Solution,Test at the a =,05 significance
level.
a =,05
n = 500
Do not reject at a =,05
Z Test for Proportion,
Solution
H0,p ?,04
H1,p,04
Critical Values,1.96
Test Statistic:
Decision:
Conclusion:
We do not have sufficient
evidence to reject the company抯
claim of 4% response rate.
Z @ p - pp (1 - p)
n
s =,04 -.05
.04 (1 -,04)
500
= 1.14
Z0
Reject Reject
.025.025
小结
?Addressed Hypothesis Testing Methodology
?Performed Z Test for the Mean (s Known)
? Discussed p-Value Approach to Hypothesis Testing
?Made Connection to Confidence Interval
Estimation
?Performed One Tail and Two Tail Tests
? Performed t Test of Hypothesis for the Mean
?Performed Z Test of Hypothesis for the Proportion
三,Two-Samples Tests(两样本检验)
?Comparing Two Independent Samples:
(独立样本)
Z Test for the Difference in Two Means
t Test for Difference in Two Means
?F Test for Difference in two Variances
(方差齐性检验)
?Comparing Two Related Samples(相关样本),
t Tests for the Mean Difference
?Wilcoxon Rank-Sum Test(秩和检验),
Difference in Two Medians
? Different Data Sources:
? Unrelated
? Independent
Sample selected from one population has no effect
or bearing on the sample selected from the other
population.
? Use Difference Between the 2 Sample Means
? Use Pooled Variance t Test
Independent Samples
? Assumptions:
? Samples are Randomly and Independently
drawn
? Data Collected are Numerical
? Population Variances Are Known
? Samples drawn are Large
? Test Statistic:
Z Test for Differences in Two
Means (Variances Known总体方差已知 )
2
2
2
1
1
2
2121
nn
)()XX(
Z
ss
mm
?
???
?
? Assumptions:
? Both Populations Are Normally Distributed
? Or,If Not Normal,Can Be Approximated by
Normal Distribution
? Samples are Randomly and Independently
drawn
? Population Variances Are Unknown But
Assumed Equal
t Test for Differences in Two
Means (Variances Unknown总体方差未知 )
Developing the
Pooled-Variance t Test (Part 1)
?Setting Up the Hypothesis:
H0,m 1 = m 2
H1,m 1 > m 2
H0,m 1 -m 2 = 0
H1,m 1 - m 2 # 0
H0,m 1 = m 2
H1,m 1 # m 2
H0,m 1 ? m 2
H0,m 1 - m 2 = 0
H1,m 1 - m 2 > 0
H0,m 1 - m 2 = 0
H1,m 1 - m 2 < 0
OR
OR
OR Left
Tail
Right
Tail
Two
Tail
H1,m 1 < m 2
Developing the
Pooled-Variance t Test (Part 2)
?Calculate the Pooled Sample Variances as an
Estimate of the Common Populations Variance:
)n()n(
S)n(S)n(S
p 11
11
21
2
22
2
112
???
????
2pS
21S
2
2S
1n
2n
= Pooled-Variance
= Variance of Sample 1
= Variance of sample 2
= Size of Sample 1
= Size of Sample 2
t X X
S n S n Sn n
df n n
P
? ? ? ?
? ? ? ?? ? ?
? ? ?
1 2 1 2
2 1 1
2
2 2
2
1 2
1 2
1 1
1 1
2
m m
Hypothesized
Difference
Developing the
Pooled-Variance t Test (Part 3)
?Compute the Test Statistic:
( ))(
( ) ( )
( ) ( )
???
?
???
? ?? 112
pS n1 n2
_ _
两个独立样本的检验
)(~
)
11
(
2
2.,.,01.0,05.0
),(:
:
2121
2
22
2
11
21
21
211
210
?
?a
mm
mm
a
tt
nnnn
snsn
XX
t
nnalet
H
H
?
??
?
?
?
????
><?
?
[实例分析 ]检验两个消费群体对某品牌的产品的平均
偏好程度(得分)是否有显著差异?
解:
结论:拒绝零假设,可以认为两个消费群体的偏好程
度有显著的统计学意义上的差异。
05.001.0),(58.2
80.3
)
1 2 0
1
2 0 0
1
(
21 2 02 0 0
33.11 2 020.12 0 0
67.216.3
33.1,20.1,67.2,16.3
1 2 0,2 0 0,05.0
,),(:,:
05.0
2
2
2
121
21
211210
<<??>
?
?
??
???
?
?
????
???
><??
Ptt
t
ssXX
nn
HH
a
mmmm
两独立样本比例(率)的比较 ---正态近似
)(~;,
)
11
)(1(
2.,.,01.0,05.0
),(:
:
21
2211
21
21
21
211
210
?
?
?
?
??
?
?
????
><?
?
a
?a
??
??
tu
nn
pnpn
p
nn
pp
pp
u
nnalet
H
H
c
cc
[实例分析 ]1998年,某调查公司接受宜而爽公司对该品牌内
衣的调查( 1500名成年人),结果 45%的人熟知该品
牌,而 1996年调查的 1500名成年人只有 42%,请检验
从 96年到 98年,该品牌知名度的提升是否有显著的统
计学差异?
解:简略的检验过程如下经计算统计量
结论:不拒绝零假设,尚不能认为 96年到 98年间该品牌在
成年人消费者中的知名度有显著的提高。
01.0
)(326.266.1
:,:
01.0
211210
>
??<?
>?
P
tu
HH ????
You are a financial analyst for Charles Schwab,Is
there a difference in dividend yield between stocks
listed on the NYSE & NASDAQ? You collect the
following data:
NYSE NASDAQ
Number 21 25
Mean 3.27 2.53
Std Dev 1.30 1.16
Assuming equal variances,is
there a difference in average
yield (a = 0.05)?
Pooled-Variance t Test,Example
t X X
S n n
S n S n Sn n
P
P
? ? ? ? ? ? ? ?
? ? ? ?? ? ?
? ? ? ?? ? ? ?
1 2 1 2
2
1 2
2 1 1
2
2 2
2
1 2
2 2
3 27 2 53 0
1510 21 25
2 03
1 1
1 1
21 1 1 30 25 1 116
21 1 25 1 1 510
m m,,
.
.
.,,
Calculating the Test Statistic:
(
((
((
(
(
(
(
(
(
)
)
)
)
)
)
))
))
)
???
?
???
? ?? 11
???
?
???
? ?? 11
H0,m1 - m2 = 0 (m1 = m2)
H1,m1 - m2 0 (m1?m2)
a = 0.05
df = 21 + 25 - 2 = 44
Critical Value(s):
Test Statistic,
Decision:
Conclusion:
Reject at a = 0.05
There is evidence of a
difference in means.t0 2.0154-2.0154
.025
Reject H0 Reject H0
.025
t ? ? ?3 27 2 53
1510 21 25
2 03.,
.
.
Solution
???
?
???
? ?? 11
F Test for Differences in Two Variances
方差齐性检验
?The F test Statistic:
F = = Variance of Sample 1n1 - 1 = degrees of freedom
n2 - 1 = degrees of freedom
F 0
21S 2
1S
22S 2
2S = Variance of Sample 2
? Tests for Differences in 2 Independent
Population Variances
? Parametric Test Procedure
? Assumptions
? Both Populations Are Normally Distributed
? Test Is Not Robust to Violations
F Test for the Difference in
Two Population Variances
? Hypotheses
? H0,s12 = s22
? H1,s12?s22
? Test Statistic
? F = S12 /S22
? Two Sets of Degrees of Freedom
? df1 = n1 - 1; df2 = n2 - 1
? Critical Values,FL( ) and FU( )
FL = 1/FU* (*degrees of freedom switched)
F Test for the Difference in
Two Population Variances
Reject H0
Reject H0
a/2a/2 Do NotReject
F0 FL FU
n1 -1,n2 -1 n1 -1,n2 -1
Assume you are a financial analyst for Charles
Schwab,You want to compare dividend yields
between stocks listed on the NYSE & NASDAQ,
You collect the following data:
NYSE NASDAQ
Number 21 25
Mean 3.27 2.53
Std Dev 1.30 1.16
Is there a difference in the
variances between the NYSE
& NASDAQ at the 0.05 level?
F Test,An Example
H0,s12 = s22
H1,s12 s22
a?,05
df1 ? 20 df2 ? 24
Critical Value(s):
Test Statistic,
Decision:
Conclusion:
Do not reject at a = 0.05
There is no evidence of a
difference in variances.0 F2.330.415
.025
Reject Reject
.025
F ? ? ?
2
2
130
116
125.
.
.
F Test,Example Solution
21S
22S
H0,s12 s22
H1,s12 < s22
F Test,One Tail 单侧
H0,s12?s22
H1,s12 > s22
Reject
a ?.05
F0 F0
Reject
a ?.05
a =,05
FL FU
FL = F
U
1
or
(n2 -1,n1 -1)
Degrees of
freedom
switched
? Tests Means of 2 Related Populations
? Paired or Matched
? Repeated Measures (Before/After)
? Use Difference Between Pairs
? Eliminates Variation Among Subjects
? Assumptions
? Both Population Are Normally Distributed
? Or,if Not Normal,use large samples
Comparing Two Related Samples,
t Test for Mean Difference
Dn = X1n - X2n
配对样本的比较(相关样本)
1),(~
/
0
.,.,01.0,05.0
0),(:
0:
1
0
??
?
?
?
><?
?
ntt
ns
X
t
alet
H
H
d
d
d
d
??
a
m
m
a
[实例分析 ]为研究两种处理方案(萃水与否)对
钢材的抗拉强度的影响,实验数据如下:
样品编号 萃水 不萃水 差值
1 120 119 1
2 119 117 2
3 124 118 6
4 121 119 2
5 125 120 5
6 117 114 3
7 123 120 3
8 126 123 3
9 122 120 2
解答
!
819,86.1)8(
69.5
9/5 8 1 1.1
03
05.0
0:
0:
05.0
1
0
r e f u s e
tt
t
H
H
d
d
????>
?
?
?
?
>
?
?
a
m
m
Assume you work in the finance department,Is the new
financial package faster (0.05 level)? You collect the
following data entry times:
Paired Sample t Test,Example
User Current Leader (1) New Software (2) Difference Di
C.B,9.98 Seconds 9.88 Seconds,10
T.F,9.88 9.86,02
M.H,9.84 9.75,09
R.K,9.99 9.80,19
M.O,9.94 9.87,07
D.S,9.84 9.84,00
S.S,9.86 9.87 -,01
C.T,10.12 9.86,26
K.T,9.90 9.83,07
S.Z,9.91 9.86,05
=.084D = SDin
0844
1
2
.
n
)DD(
S iD
?
?
? ??
Is the new financial package faster (0.05 level)?
Paired Sample t Test,Example
Solution
.084D =
153100 8 4 4 4 0084,/.,n/SDt
D
D ????? m
H0,mD 0
H1,mD > 0
a ?.05
Test Statistic
Critical Value=1.8331
df = n - 1 = 9
Reject
a ?.05
1.8331
Decision,Reject H0
t Stat,in the rejection zone.
Conclusion,The new
software package is faster.
? Tests Two Independent Population
Medians
? Populations Need Not be Normal
? Distribution Free Procedure
Only Rank of Data Obtained
? Can Use Normal Approximation If ni > 10
Wilcoxon Rank Sum Test for Differences
in 2 Medians(中位数检验)
? Assign Ranks,Ri,to the n1 + n2 Sample
Observations
? If Unequal Sample Sizes,Let n1 Refer to Smaller-
Sized Sample
? Smallest Value = 1
? Average Ties
? Sum the Ranks,Ti,for Each Sample
? Obtain Test Statistic,T1 (Smallest Sample)
Wilcoxon Rank Sum Test,
Procedure
Wilcoxon Rank Sum Test,
Setting of Hypothesis
H0,M1 = M2
H1,M1 # M2
H0,M1 = M2
H1,M1 > M2
H0,M1 = M2
H1,M1 < M2
Two -Tail Test
双侧
Left-Tail Test
左单侧
Right -Tail Test
右单侧
M1 = median of population 1
M2 = median of population 2
Assume you are a production planner,
You want to see if the median operating
rates for the 2 factories is the same,For
factory 1,the rates (% of capacity) are
71,82,77,92,88,For factory 2,
the rates are 85,82,94 & 97.
Do the factories have
the same median rates
at the 0.10 level,
Wilcoxon Rank Sum Test,
Example
Factory 1 Factory 2
Rate Rank Rate Rank
71 1 85 5
82 3 3.5 82 4 3.5
77 2 94 8
92 7 97 9
88 6,..,..
Rank Sum 19.5 25.5
Wilcoxon Rank Sum Test,
Computation Table
Tie Tie
H0,M1 = M2
H1,M1 # M2
a =,10
n1 = 4 n2 = 5
Critical Value(s):
Test Statistic,
Decision:
Conclusion:
Do not reject at a = 0.10
There is no evidence
medians are not equal.Reject Reject
Do Not
Reject
12 28 S Ranks
T1 = 5 + 3.5 + 8+ 9 = 25.5
(Smallest Sample)
Wilcoxon Rank Sum Test,
Solution
Wilcoxon Rank Sum Test,
Large Sample 大样本
? For Large Sample Size,the test statistic T1 is
approximately normal with mean m and
standard deviation s,
? Computing the Z value:
Where and
n1 n2,n = n1 + n2
T1
T1
1
11
T
TTZ
s
m?
?
2
11
1
)n(n
T
??m
12
121
1
)n(nn
T
??s
本章小结
?Compared Two Independent Samples:
Performed Z Test for the Differences in Two Means
Performed t Test for Differences in Two Means
?Addressed F Test for Difference in two Variances
?Compared Two Related Samples:
Performed t Tests for the Mean Difference
?Addressed Wilcoxon Rank Sum Test:
Performed Tests on Differences in Two Medians
Hypotheses Test with Parametrics
[开篇案例 ]
北京地区大学教授与合资企业职工收入比较
统计量 大学教授 合资企业职工
样本含量 n=150 n=150
平均收入 ¥ 1000 ¥ 1000
标准差 ¥ 200 ¥ 800
标准误 ¥ 16.33 ¥ 65.32
95%的 CI ( 968,1032) ( 872,1128)
问题:
两人群收入的离散(“贫富”分化)程度如何?
一、假设检验的基本概念
某项市场调研想分析一次特定的广告大战之后
是否明显提高了某彩电在消费者中的知名度
?是否显著激发了消费兴趣? ----显著性检验
1、零假设与备择假设
零假设( null hypothesis,H0) 又称无差异假设
备择假设( alternative hypothesis,H1),单双侧
2、假设检验的分类
参数检验 (parametric tests)要求明确的总体分布
非参数检验 (non-parametric tests)无须总体分布
3、显著性水平:样本参数偏离总体参数的概率
4、假设检验的基本步骤
正确给出两类假设及检验水平;
正确选择并计算样本统计量的值;
将样本统计量与 由样本含量、检验水平及统计量
的理论分布决定的 临界值比较,获得样本统
计量大(小)于临界值的概率 P;
将 P与检验水平比较,并做出是否拒绝或不拒绝
零假设的决策。
5、两类错误,接受 H0 拒绝 H0
H0为真 --- I型错误
H0为假 II型错误 ---
二,One-Sample Tests ( 单样本检验)
?Hypothesis Testing Methodology
?Z Test for the Mean (s Known总体方差已知 )
? p-Value Approach to Hypothesis Testing
?Connection to Confidence Interval Estimation
?One Tail Test(单侧检验)
? t Test of Hypothesis for the Mean
?Z Test of Hypothesis for the Proportion
A hypothesis is an
assumption about the
population parameter.
? A parameter is a
Population mean or
proportion
? The parameter must be
identified before
analysis.
I assume the mean GPA
of this class is 3.5!
1984-1994 T/Maker Co.
What is a Hypothesis?
关于总体参数的假设
? States the Assumption (numerical) to be tested
e.g,The average # TV sets in US homes is at
least 3 (H0,m >3)
? Begin with the assumption that the null
hypothesis is TRUE,
(Similar to the notion of innocent until proven guilty)
The Null Hypothesis,H0
无效假设
?Refers to the Status Quo
?Always contains the?=?sign
?The Null Hypothesis may or may not be rejected.
? Is the opposite of the null hypothesis
e.g,The average # TV sets in US homes is
less than 3 (H1,m < 3)
? Challenges the Status Quo
? Never contains thesign
? The Alternative Hypothesis may or may
not be accepted
The Alternative Hypothesis,H1
被择假设
Steps:
?State the Null Hypothesis (H0,m = 3)
?State its opposite,the Alternative
Hypothesis (H1,m < 3)
?Hypotheses are mutually exclusive &
exhaustive
?Sometimes it is easier to form the
alternative hypothesis first.
Identify the Problem
解决问题的步骤
Population
Assume the
population
mean age is 50.
(Null Hypothesis)
REJECT
The Sample
Mean Is 20
SampleNull Hypothesis
5 0?20 ?@? mXIs
Hypothesis Testing Process
假设检验过程
No,not likely!
Sample Meanm = 50
Sampling Distribution
It is unlikely
that we would
get a sample
mean of this
value,..
..,if in fact this were
the population mean.
..,Therefore,we
reject the null
hypothesis that
m = 50.
20 H
0
Reason for Rejecting H0
拒绝无效假设的原因
小概率事件原理
? Defines Unlikely Values of Sample
Statistic if Null Hypothesis Is True
? Called Rejection Region of Sampling
Distribution
? Designateda (alpha)
? Typical values are 0.01,0.05,0.10
? Selected by the Researcher at the Start
? Provides the Critical Value(s) of the Test
Level of Significance,a
显著性水平
Level of Significance,a and
the Rejection Region
H0,m =3
H1,m < 3
0
0
0
H0,m?3
H1,m > 3
H0,m? 3
H1,m 3
a
a
a/2
Critical
Value(s)
Rejection
Regions
拒绝域
? Type I Error(I型错误)
? Reject True Null Hypothesis
? Has Serious Consequences
? Probability of Type I Error Is a
? Called Level of Significance
? Type II Error( II型错误)
? Do Not Reject False Null Hypothesis
? Probability of Type II Error Is b (Beta)
Errors in Making Decisions
决策错误
H0,Innocent
Jury Trial Hypothesis Test
Actual Situation Actual Situation
Verdict Innocent Guilty Decision H0 True H0 False
Innocent Correct Error
Do Not
Reject
H0
1 - a Type IIError (b)
Guilty Error Correct RejectH
0
Type I
Error
(a )
Power
(1 - b)
Result Possibilities
a
b
Reduce probability of one error
and the other one goes up.
a & b Have an
Inverse Relationship
? True Value of Population Parameter
? Increases When Difference Between Hypothesized
Parameter & True Value Decreases
? Significance Level a
? Increases When a Decreases
? Population Standard Deviation s
? Increases When s Increases
? Sample Size n
? Increases When n Decreases
Factors Affecting
Type II Error,b
a
b
b s
b
n
? Convert Sample Statistic (e.g.,) to
Standardized Z Variable
? Compare to Critical Z Value(s)
? If Z test Statistic falls in Critical Region,
Reject H0; Otherwise Do Not Reject H0
Z-Test Statistics (s Known)
Test Statistic
X
n
XX
Z
X
X
s
m
s
m ?
?
?
?
? Probability of Obtaining a Test Statistic
More Extreme ( or ) than Actual Sample
Value Given H0 Is True
? Called Observed Level of Significance
? Smallest Value of a H0 Can Be Rejected
? Used to Make Rejection Decision
? If p value?a,Do Not Reject H0
? If p value < a,Reject H0
p Value Test
1,State H0 H0, m?3
2,State H1 H1, m < 3
3,Choose a a =,05
4,Choose n n = 100
5,Choose Test,Z Test (or p Value)
Hypothesis Testing,Steps
Test the Assumption that the true mean #
of TV sets in US homes is at least 3.
6,Set Up Critical Value(s) Z = -1.645
7,Collect Data 100 households surveyed
8,Compute Test Statistic Computed Test Stat.= -2
9,Make Statistical Decision Reject Null Hypothesis
10,Express Decision The true mean # of TV set
is less than 3 in the US
households.
Hypothesis Testing,Steps
Test the Assumption that the average # of
TV sets in US homes is at least 3.
(continued)
? Assumptions
? Population Is Normally Distributed
? If Not Normal,use large samples
? Null Hypothesis Has or Sign Only
? Z Test Statistic:
One-Tail Z Test for Mean
(s Known)
n
xx
z
x
x
s
m
s
m ?
?
?
?
Z0
a
Reject H0
Z0
Reject H0
a
H0,m?0
H1,m < 0
H0,m?0
H1,m > 0
Must Be Significantly
Belowm = 0
Small values don’t contradict H0
Don’t Reject H0!
Rejection Region
Does an average box of
cereal contain more than
368 grams of cereal? A
random sample of 25 boxes
showed X = 372.5,The
company has specified s to
be 15 grams,Test at the
a?0.05 level.
368 gm.
Example,One Tail Test
H0,m? 368
H1,m > 368
_
Z,04,06
1.6,5495,5505,5515
1.7,5591,5599,5608
1.8,5671,5678,5686
.5738,5750
Z0
sZ = 1
1.645
.50
-.05
.45
.05
1.9,5744
Standardized Normal
Probability Table (Portion)What Is Z Given a = 0.05?
a =,05
Finding Critical Values,One Tail
单侧检验的界值
Critical Value
= 1.645
a = 0.025
n = 25
Critical Value,1.645
Test Statistic,
Decision:
Conclusion:
Do Not Reject at a =,05
No Evidence True Mean
Is More than 368Z0 1.645
.05
Reject
Example Solution,One Tail
H0,m ? 368
H1,m > 368 50.1?
?
?
n
X
Z
s
m
Z0 1.50
p Value
.0668
Z Value of Sample
Statistic
From Z Table,
Lookup 1.50
.9332
Use the
alternative
hypothesis
to find the
direction of
the test.
1.0000
-,9332
.0668
p Value is P(Z >= 1.50) = 0.0668
p Value Solution
0 1.50 Z
Reject
(p Value = 0.0668) > (a = 0.05),
Do Not Reject.
p Value = 0.0668
a = 0.05
Test Statistic Is In the Do Not Reject Region
p Value Solution
Does an average box of
cereal contains 368 grams of
cereal? A random sample of
25 boxes showed X = 372.5.
The company has specified
s to be 15 grams,Test at the
a?0.05 level.
368 gm.
Example,Two Tail Test
双侧检验
H0,m ? 368
H1,m 368
a = 0.05
n = 25
Critical Value,?.96
Test Statistic,
Decision:
Conclusion:
Do Not Reject at a =,05
No Evidence that True
Mean Is Not 368Z0 1.96
.025
Reject
Example Solution,Two Tail
-1.96
.025
H0,m ? 386
H1,m 386 50.1
25
15
3 6 85.3 7 2 ?????
n
XZ
s
m
Connection to
Confidence Intervals
For X = 372.5,s = 15 and n = 25,
The 95% Confidence Interval is:
372.5 - (1.96) 15/ 25 to 372.5 + (1.96) 15/ 25
or ( 366.62 m 378.38)
If this interval contains the Hypothesized mean
(368),we do not reject the null hypothesis.
It does,Do not reject.
_
Assumptions
? Population is normally distributed
? If not normal,only slightly skewed & a large
sample taken
Parametric test procedure(参数检验过程)
t test statistic
t-Test,s Unknown
n
S
X
t
m?
?
Example,One Tail t-Test
Does an average box of cereal
contain more than 368 grams
of cereal? A random sample of
36 boxes showed X = 372.5,
and s? 15,Test at the a?0.01
level,368 gm.
H0,m 368
H1,m > 368s is not given,
a = 0.01
n = 36,df = 35
Critical Value,2.4377
Test Statistic,
Decision:
Conclusion:
Do Not Reject at a =,01
No Evidence that True
Mean Is More than 368Z0 2.4377
.01
Reject
Example Solution,One Tail
H0,m? 368
H1,m > 368
80.1
36
15
3685.372 ?????
n
S
Xt m
[实例分析 ]:某电视机厂欲检验生产显象管的新
工序是否优于旧工序(即与旧工序下的平均
寿命 1200小时比较)
解:
分析,P<0.05,拒绝零假设,可以认为新工序生
产的显象管总体的平均寿命优于旧工序。
注意:统计检验结果的表达方式。
)99(66.117.2
1 0 0/3 0 0
1 2 0 01 2 6 5
3 0 0,1 2 6 5,1 0 0
05.0;1 2 0 0:,1 2 0 0:
05.0
10
tt
SXn
HH
?>?
?
?
???
?>? amm
? Involves categorical variables
? Fraction or % of population in a category
? If two categorical outcomes,binomial
distribution
? Either possesses or doesn抰 possess the characteristic
? Sample proportion (ps)
Proportions
比例
s i zes a m p l e
s u c c e s s e sofn u m b e r
n
Xp
s ??
? 单样本比例(率)的假设检验
正态近似法(适于已知总体率接近 0.5)
直接计算概率法 ---二项分布的累计概率法
)1(
1,
)1(
.,01.0,05.0
),(:
:
~
a r g
00
0
01
00
?
??
?
?
?
?
><?
?
?
ntu
n
n
P
u
alet
H
H
eln
a
?
??
?
a
??
??
jnjnk
j
j
nCjXPkXP
??
?
??????? ? ? )1()()( 00
0
??
[实例分析 ]要检验 1960年美国大选前盖洛调查公司对
总统选举预测结果( 51%)是否与实际选举结果
(肯尼迪得票 50.1%)有显著差异?
结论,P>0.05,不拒绝零假设,尚不能认为盖洛调查
公司预测的总统选举结果与实际结果有显著的统
计学意义上的差异。
再一次提醒:统计结论不能绝对化!!!
)(96.1
70.01 5 0 0/)1.501 0 0(1.50)1.5051(
%,51,11 5 0 0,05.0
%,1.50:%,1.50:
05.0
10
??<
????
????
??
t
u
P
HH
?a
??
Example:Z Test for Proportion
?Problem,A marketing company claims
that it receives 4% responses from its
Mailing,
?Approach,To test this claim,a random
sample of 500 were surveyed with 25
responses,
?Solution,Test at the a =,05 significance
level.
a =,05
n = 500
Do not reject at a =,05
Z Test for Proportion,
Solution
H0,p ?,04
H1,p,04
Critical Values,1.96
Test Statistic:
Decision:
Conclusion:
We do not have sufficient
evidence to reject the company抯
claim of 4% response rate.
Z @ p - pp (1 - p)
n
s =,04 -.05
.04 (1 -,04)
500
= 1.14
Z0
Reject Reject
.025.025
小结
?Addressed Hypothesis Testing Methodology
?Performed Z Test for the Mean (s Known)
? Discussed p-Value Approach to Hypothesis Testing
?Made Connection to Confidence Interval
Estimation
?Performed One Tail and Two Tail Tests
? Performed t Test of Hypothesis for the Mean
?Performed Z Test of Hypothesis for the Proportion
三,Two-Samples Tests(两样本检验)
?Comparing Two Independent Samples:
(独立样本)
Z Test for the Difference in Two Means
t Test for Difference in Two Means
?F Test for Difference in two Variances
(方差齐性检验)
?Comparing Two Related Samples(相关样本),
t Tests for the Mean Difference
?Wilcoxon Rank-Sum Test(秩和检验),
Difference in Two Medians
? Different Data Sources:
? Unrelated
? Independent
Sample selected from one population has no effect
or bearing on the sample selected from the other
population.
? Use Difference Between the 2 Sample Means
? Use Pooled Variance t Test
Independent Samples
? Assumptions:
? Samples are Randomly and Independently
drawn
? Data Collected are Numerical
? Population Variances Are Known
? Samples drawn are Large
? Test Statistic:
Z Test for Differences in Two
Means (Variances Known总体方差已知 )
2
2
2
1
1
2
2121
nn
)()XX(
Z
ss
mm
?
???
?
? Assumptions:
? Both Populations Are Normally Distributed
? Or,If Not Normal,Can Be Approximated by
Normal Distribution
? Samples are Randomly and Independently
drawn
? Population Variances Are Unknown But
Assumed Equal
t Test for Differences in Two
Means (Variances Unknown总体方差未知 )
Developing the
Pooled-Variance t Test (Part 1)
?Setting Up the Hypothesis:
H0,m 1 = m 2
H1,m 1 > m 2
H0,m 1 -m 2 = 0
H1,m 1 - m 2 # 0
H0,m 1 = m 2
H1,m 1 # m 2
H0,m 1 ? m 2
H0,m 1 - m 2 = 0
H1,m 1 - m 2 > 0
H0,m 1 - m 2 = 0
H1,m 1 - m 2 < 0
OR
OR
OR Left
Tail
Right
Tail
Two
Tail
H1,m 1 < m 2
Developing the
Pooled-Variance t Test (Part 2)
?Calculate the Pooled Sample Variances as an
Estimate of the Common Populations Variance:
)n()n(
S)n(S)n(S
p 11
11
21
2
22
2
112
???
????
2pS
21S
2
2S
1n
2n
= Pooled-Variance
= Variance of Sample 1
= Variance of sample 2
= Size of Sample 1
= Size of Sample 2
t X X
S n S n Sn n
df n n
P
? ? ? ?
? ? ? ?? ? ?
? ? ?
1 2 1 2
2 1 1
2
2 2
2
1 2
1 2
1 1
1 1
2
m m
Hypothesized
Difference
Developing the
Pooled-Variance t Test (Part 3)
?Compute the Test Statistic:
( ))(
( ) ( )
( ) ( )
???
?
???
? ?? 112
pS n1 n2
_ _
两个独立样本的检验
)(~
)
11
(
2
2.,.,01.0,05.0
),(:
:
2121
2
22
2
11
21
21
211
210
?
?a
mm
mm
a
tt
nnnn
snsn
XX
t
nnalet
H
H
?
??
?
?
?
????
><?
?
[实例分析 ]检验两个消费群体对某品牌的产品的平均
偏好程度(得分)是否有显著差异?
解:
结论:拒绝零假设,可以认为两个消费群体的偏好程
度有显著的统计学意义上的差异。
05.001.0),(58.2
80.3
)
1 2 0
1
2 0 0
1
(
21 2 02 0 0
33.11 2 020.12 0 0
67.216.3
33.1,20.1,67.2,16.3
1 2 0,2 0 0,05.0
,),(:,:
05.0
2
2
2
121
21
211210
<<??>
?
?
??
???
?
?
????
???
><??
Ptt
t
ssXX
nn
HH
a
mmmm
两独立样本比例(率)的比较 ---正态近似
)(~;,
)
11
)(1(
2.,.,01.0,05.0
),(:
:
21
2211
21
21
21
211
210
?
?
?
?
??
?
?
????
><?
?
a
?a
??
??
tu
nn
pnpn
p
nn
pp
pp
u
nnalet
H
H
c
cc
[实例分析 ]1998年,某调查公司接受宜而爽公司对该品牌内
衣的调查( 1500名成年人),结果 45%的人熟知该品
牌,而 1996年调查的 1500名成年人只有 42%,请检验
从 96年到 98年,该品牌知名度的提升是否有显著的统
计学差异?
解:简略的检验过程如下经计算统计量
结论:不拒绝零假设,尚不能认为 96年到 98年间该品牌在
成年人消费者中的知名度有显著的提高。
01.0
)(326.266.1
:,:
01.0
211210
>
??<?
>?
P
tu
HH ????
You are a financial analyst for Charles Schwab,Is
there a difference in dividend yield between stocks
listed on the NYSE & NASDAQ? You collect the
following data:
NYSE NASDAQ
Number 21 25
Mean 3.27 2.53
Std Dev 1.30 1.16
Assuming equal variances,is
there a difference in average
yield (a = 0.05)?
Pooled-Variance t Test,Example
t X X
S n n
S n S n Sn n
P
P
? ? ? ? ? ? ? ?
? ? ? ?? ? ?
? ? ? ?? ? ? ?
1 2 1 2
2
1 2
2 1 1
2
2 2
2
1 2
2 2
3 27 2 53 0
1510 21 25
2 03
1 1
1 1
21 1 1 30 25 1 116
21 1 25 1 1 510
m m,,
.
.
.,,
Calculating the Test Statistic:
(
((
((
(
(
(
(
(
(
)
)
)
)
)
)
))
))
)
???
?
???
? ?? 11
???
?
???
? ?? 11
H0,m1 - m2 = 0 (m1 = m2)
H1,m1 - m2 0 (m1?m2)
a = 0.05
df = 21 + 25 - 2 = 44
Critical Value(s):
Test Statistic,
Decision:
Conclusion:
Reject at a = 0.05
There is evidence of a
difference in means.t0 2.0154-2.0154
.025
Reject H0 Reject H0
.025
t ? ? ?3 27 2 53
1510 21 25
2 03.,
.
.
Solution
???
?
???
? ?? 11
F Test for Differences in Two Variances
方差齐性检验
?The F test Statistic:
F = = Variance of Sample 1n1 - 1 = degrees of freedom
n2 - 1 = degrees of freedom
F 0
21S 2
1S
22S 2
2S = Variance of Sample 2
? Tests for Differences in 2 Independent
Population Variances
? Parametric Test Procedure
? Assumptions
? Both Populations Are Normally Distributed
? Test Is Not Robust to Violations
F Test for the Difference in
Two Population Variances
? Hypotheses
? H0,s12 = s22
? H1,s12?s22
? Test Statistic
? F = S12 /S22
? Two Sets of Degrees of Freedom
? df1 = n1 - 1; df2 = n2 - 1
? Critical Values,FL( ) and FU( )
FL = 1/FU* (*degrees of freedom switched)
F Test for the Difference in
Two Population Variances
Reject H0
Reject H0
a/2a/2 Do NotReject
F0 FL FU
n1 -1,n2 -1 n1 -1,n2 -1
Assume you are a financial analyst for Charles
Schwab,You want to compare dividend yields
between stocks listed on the NYSE & NASDAQ,
You collect the following data:
NYSE NASDAQ
Number 21 25
Mean 3.27 2.53
Std Dev 1.30 1.16
Is there a difference in the
variances between the NYSE
& NASDAQ at the 0.05 level?
F Test,An Example
H0,s12 = s22
H1,s12 s22
a?,05
df1 ? 20 df2 ? 24
Critical Value(s):
Test Statistic,
Decision:
Conclusion:
Do not reject at a = 0.05
There is no evidence of a
difference in variances.0 F2.330.415
.025
Reject Reject
.025
F ? ? ?
2
2
130
116
125.
.
.
F Test,Example Solution
21S
22S
H0,s12 s22
H1,s12 < s22
F Test,One Tail 单侧
H0,s12?s22
H1,s12 > s22
Reject
a ?.05
F0 F0
Reject
a ?.05
a =,05
FL FU
FL = F
U
1
or
(n2 -1,n1 -1)
Degrees of
freedom
switched
? Tests Means of 2 Related Populations
? Paired or Matched
? Repeated Measures (Before/After)
? Use Difference Between Pairs
? Eliminates Variation Among Subjects
? Assumptions
? Both Population Are Normally Distributed
? Or,if Not Normal,use large samples
Comparing Two Related Samples,
t Test for Mean Difference
Dn = X1n - X2n
配对样本的比较(相关样本)
1),(~
/
0
.,.,01.0,05.0
0),(:
0:
1
0
??
?
?
?
><?
?
ntt
ns
X
t
alet
H
H
d
d
d
d
??
a
m
m
a
[实例分析 ]为研究两种处理方案(萃水与否)对
钢材的抗拉强度的影响,实验数据如下:
样品编号 萃水 不萃水 差值
1 120 119 1
2 119 117 2
3 124 118 6
4 121 119 2
5 125 120 5
6 117 114 3
7 123 120 3
8 126 123 3
9 122 120 2
解答
!
819,86.1)8(
69.5
9/5 8 1 1.1
03
05.0
0:
0:
05.0
1
0
r e f u s e
tt
t
H
H
d
d
????>
?
?
?
?
>
?
?
a
m
m
Assume you work in the finance department,Is the new
financial package faster (0.05 level)? You collect the
following data entry times:
Paired Sample t Test,Example
User Current Leader (1) New Software (2) Difference Di
C.B,9.98 Seconds 9.88 Seconds,10
T.F,9.88 9.86,02
M.H,9.84 9.75,09
R.K,9.99 9.80,19
M.O,9.94 9.87,07
D.S,9.84 9.84,00
S.S,9.86 9.87 -,01
C.T,10.12 9.86,26
K.T,9.90 9.83,07
S.Z,9.91 9.86,05
=.084D = SDin
0844
1
2
.
n
)DD(
S iD
?
?
? ??
Is the new financial package faster (0.05 level)?
Paired Sample t Test,Example
Solution
.084D =
153100 8 4 4 4 0084,/.,n/SDt
D
D ????? m
H0,mD 0
H1,mD > 0
a ?.05
Test Statistic
Critical Value=1.8331
df = n - 1 = 9
Reject
a ?.05
1.8331
Decision,Reject H0
t Stat,in the rejection zone.
Conclusion,The new
software package is faster.
? Tests Two Independent Population
Medians
? Populations Need Not be Normal
? Distribution Free Procedure
Only Rank of Data Obtained
? Can Use Normal Approximation If ni > 10
Wilcoxon Rank Sum Test for Differences
in 2 Medians(中位数检验)
? Assign Ranks,Ri,to the n1 + n2 Sample
Observations
? If Unequal Sample Sizes,Let n1 Refer to Smaller-
Sized Sample
? Smallest Value = 1
? Average Ties
? Sum the Ranks,Ti,for Each Sample
? Obtain Test Statistic,T1 (Smallest Sample)
Wilcoxon Rank Sum Test,
Procedure
Wilcoxon Rank Sum Test,
Setting of Hypothesis
H0,M1 = M2
H1,M1 # M2
H0,M1 = M2
H1,M1 > M2
H0,M1 = M2
H1,M1 < M2
Two -Tail Test
双侧
Left-Tail Test
左单侧
Right -Tail Test
右单侧
M1 = median of population 1
M2 = median of population 2
Assume you are a production planner,
You want to see if the median operating
rates for the 2 factories is the same,For
factory 1,the rates (% of capacity) are
71,82,77,92,88,For factory 2,
the rates are 85,82,94 & 97.
Do the factories have
the same median rates
at the 0.10 level,
Wilcoxon Rank Sum Test,
Example
Factory 1 Factory 2
Rate Rank Rate Rank
71 1 85 5
82 3 3.5 82 4 3.5
77 2 94 8
92 7 97 9
88 6,..,..
Rank Sum 19.5 25.5
Wilcoxon Rank Sum Test,
Computation Table
Tie Tie
H0,M1 = M2
H1,M1 # M2
a =,10
n1 = 4 n2 = 5
Critical Value(s):
Test Statistic,
Decision:
Conclusion:
Do not reject at a = 0.10
There is no evidence
medians are not equal.Reject Reject
Do Not
Reject
12 28 S Ranks
T1 = 5 + 3.5 + 8+ 9 = 25.5
(Smallest Sample)
Wilcoxon Rank Sum Test,
Solution
Wilcoxon Rank Sum Test,
Large Sample 大样本
? For Large Sample Size,the test statistic T1 is
approximately normal with mean m and
standard deviation s,
? Computing the Z value:
Where and
n1 n2,n = n1 + n2
T1
T1
1
11
T
TTZ
s
m?
?
2
11
1
)n(n
T
??m
12
121
1
)n(nn
T
??s
本章小结
?Compared Two Independent Samples:
Performed Z Test for the Differences in Two Means
Performed t Test for Differences in Two Means
?Addressed F Test for Difference in two Variances
?Compared Two Related Samples:
Performed t Tests for the Mean Difference
?Addressed Wilcoxon Rank Sum Test:
Performed Tests on Differences in Two Medians