Author:ZHANG TAO
Data:2018.4.3
student t-test假设检验
χ2− χ 2 − distribution
设
X1,X2,...,Xn
X
1
,
X
2
,
.
.
.
,
X
n
是来自总体
N(0,1)
N
(
0
,
1
)
的样本,则称统计量
服从自由度为n的卡方分布,记为 χ2(n) χ 2 ( n )
t− t − distribution
设
X∼N(0,1),Y∼χ2(n)
X
∼
N
(
0
,
1
)
,
Y
∼
χ
2
(
n
)
,并且X和Y独立,则称随机变量
服从自由度为n的t分布,记作 t∼t(n) t ∼ t ( n )
t-test
One-sample
样本方差 σ2 σ 2 未知,关于 μ μ 的检验(t检验)
构造
作为检测统计量,如果观测值过大就拒绝 H0 H 0
如图1可知,当 H0 H 0 为真时,监测统计量位于阴影部分的概率时 α α (显著性水平,特别小的值),所以如果此事发生(也就是检测统计量的值位于阴影处时),就可以认为原假设时错误的,而拒绝 H0 H 0
问题1:matlab中的ttest返回的p_value表示的含义?
returns the p-value, i.e., the probability of observing the given result, or one more extreme,
by chance if the null hypothesis is true. Small values of P cast doubt on the validity of the
null hypothesis.
形象的表示就是如图二所示,观测变量的值求出以后,红的区域的值就是P的value,而只有 Pvalue<α P v a l u e < α 时才会拒绝原假设。
假设检验的难点在于如何通过已知量构造已知分布的检验统计量
Paired sample
一般,假设有n对相互独立的观察结果: (X1,Y1),...,(Xn,Yn), ( X 1 , Y 1 ) , . . . , ( X n , Y n ) , 另 D1=X1−Y1,D2=X2−Y2,...,Dn=Xn−Yn, D 1 = X 1 − Y 1 , D 2 = X 2 − Y 2 , . . . , D n = X n − Y n , 则 D1,D2,...,Dn D 1 , D 2 , . . . , D n 相互独立。又因为 D1,D2,...,Dn D 1 , D 2 , . . . , D n 是由同一个因素引起的,所以可以认为他们服从同一个分布。故:
则检测统计量为:
matlab实现使用ttest:
ttest One-sample and paired-sample t-test.
Unpaired(Independent) sample
检验具有相同方差的两正态总体均值差的假设.假设 X1,X2...Xn1 X 1 , X 2 . . . X n 1 是来自分布 N(μ1,σ2) N ( μ 1 , σ 2 ) 的样本, Y1,Y2,...,Yn2 Y 1 , Y 2 , . . . , Y n 2 是来自正态总体 N(μ2,σ2) N ( μ 2 , σ 2 ) ,且设两样本独立。
故
易知:
matlab中实现时使用ttest2
ttest2默认是X和Y的方差时相等的,可以通过Vartype:unequal改成方差不相等。
'equal' Conduct test using the assumption that x and y are from normal distributions with unknown but equal variances.
'unequal' Conduct test using the assumption that x and y are from normal distributions with unknown and unequal variances. This is called the Behrens-Fisher problem. ttest2 uses Satterthwaite's approximation for the effective degrees of freedom.
Vartype must be a single variance type, even when x is a matrix or a multidimensional array.
Example: 'Vartype','unequal'
不相等的情况下被称为Behrens-Fisher problem,优化方式可参看wiki