通过统计检定值与随机变量的概率分布进行比较,我们可以知道在多少百分比的机会下得到目前的结果,如果比较之后发现出现这结果的机率很小,就是说,是在机会很少,很罕见的情况下才出现的;那我们就会认为出现这批样本不是巧合,是具有统计学意义的,相反,若比较后发现,出现的机率很高,并不罕见,那我们会觉得这批样本出现全为巧合,不具有统计学上的意义。

> var(Z)
[1] 6.763636
> var(H)
[1] 6.654545
> var.test(Z,H)

	F test to compare two variances

data:  Z and H
F = 1.0164, num df = 10, denom df = 10,
p-value = 0.98
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
 0.2734599 3.7777229
sample estimates:
ratio of variances 
          1.016393 

从方差相似性的检验中,我们可以看到p-value是0.98,即p-value大于0.05,数据中没足够证据证明方差不相似。即两组样品的方差是相似的 





> t.test(Z,H,var.equal = TRUE,paired=F)

	Two Sample t-test

data:  Z and H
t = -1.317, df = 20, p-value = 0.2027
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -3.7584113  0.8493204
sample estimates:
mean of x mean of y 
 25.18182  26.63636 
结果分析,因为p-value的值为0.2027>0.05,因此接受原假设,认为Z与H之间不存在明显的差异

t就是统计检定值,与它相对应的概率分布,就是t分布

R语言有t.test()函数可以直接调用来做t-test

t.test(x, y, mu=0, paired=FALSE, var.equal=FALSE, conf.level=0.95))

参数

意思

用法

x

非空数据集

 

y

非空数据集

 

alternative

替代假设

two.sided(缺省),双边检验(H1:μ≠H0),less表示单边检验(H1:μ<μ0),greater表示单边检验(H1:μ>μ0),

mu

均值

mu表示原假设μ0,可以指定任何值

paired

配对

若paired=T,为配对检验,则必须指定相同长度的x和y的值,默认FALSE

var.equal

方差

若var.equal=T,则使用汇总的方差估计,默认情况下,如果var.equal为FALSE,则为两组分别估计方差

conf.level

置信水平

默认0.95

检验例子:

t-test的功能:单因素二水平的假设检验。

H0:与我们想过要的结果相反的假设,比如我们想要的是两组数据的差异性,那么这个假设是:两组数据没有差异性。

H1或Ha:备择假设,与H0假设相反。

结果:在显著性水平α =0.05的情况下,p>0.05接受原假设,p值<0.05拒绝原假设

分析结果的时候,当p-value小于0.05的时候,认为两个样本之间有显著性差异,当p-value的值大于0.05的时候,认为两个样本之间没有显著的差异。

statistic

the value of the t-statistic

parameter

the degrees of freedom for the t-statistic

p.value

the p-value for the test

conf.int

a confidence interval for the mean appropriate to the specified alternative hypothesis

estimate

the estimated mean or different in means depending on whether it was a one-sample test or a two-sample test.

null.value 

the specified hypothesized value of the mean difference depending on whether it was a one-sample test or a two-sample test

alternative

a character string describing the alternative hypothesis

method 

a character string indicating what type of t-test was performed

data.name

a character string giving the name of the data.

 

 

 

 


摘要:

无论你从事何种领域的科学研究还是统计调查,显著性检验作为判断两个乃至多个数据集之间是否存在差异的方法被广泛应用于各个科研领域。笔者作为科研界一名新人也曾经在显著性检验方面吃过许多苦头。后来醉心于统计理论半载有余才摸到显著性检验的皮毛,也为显著性检验理论之精妙,品种之繁多,逻辑之严谨所折服。在此,特写下这篇博文,以供那些仍然挣扎在显著性检验泥潭的非统计专业的科研界同僚们参考。由于笔者本人也并非统计专业毕业,所持观点粗陋浅鄙,贻笑大方之处还望诸位业界前辈,领域翘楚不吝赐教。小可在此谢过诸位看官了。

     本篇博文致力于解决一下几点问题,在此罗列出来:1.什么是显著性检验? 2.为什么要做显著性检验? 3.怎么做显著性检验?下面就请跟随笔者的步伐一步步走入显著性检验的“前世与今生”。