当前位置:  开发笔记 > 编程语言 > 正文

两个配对的t检验p值= NA和t = NaN

如何解决《两个配对的t检验p值=NA和t=NaN》经验,为你挑选了1个好方法。

我想做以下配对t检验:

str1<-' ENSEMBLE 0.934 0.934 0.934 0.934 '
  str2<-' J48 0.934 0.934 0.934 0.934 '

  df1 <- read.table(text=scan(text=str1, what='', quiet=TRUE), header=TRUE)
  df2 <- read.table(text=scan(text=str2, what='', quiet=TRUE), header=TRUE)

t.test ( df1$ENSEMBLE, df2$J48, mu=0 , alt="two.sided", paired = T, conf.level = 0.95)

我得到以下结果:

Paired t-test

data:  df1$ENSEMBLE and df2$J48
t = NaN, df = 3, p-value = NA
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 NaN NaN
sample estimates:
mean of the differences 
                      0 

我为什么要这个?



1> triddle..:

这是因为数据集完全相同.

df2[1,1] <- .935

t.test ( df1$ENSEMBLE, df2$J48, mu=0 , alt="two.sided", paired = T, conf.level = 0.95)

Paired t-test

data:  df1$ENSEMBLE and df2$J48
t = -1, df = 3, p-value = 0.391
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.0010456116  0.0005456116
sample estimates:
mean of the differences 
           -0.00025 

推荐阅读
殉情放开那只小兔子
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有