全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
4878 2
2011-12-19
悬赏 50 个论坛币 已解决
quwuji <-
matrix(c(2, 7, 3, 6,
         9, 10, 7, 5,
         4, 6, 1, 4,
         9, 7, 4, 5,
         6, 8, 4, 3,
         9, 4, 2, 6),
       nrow = 6,
       byrow = TRUE,
       dimnames = list(1 : 6,
                       c("配方1", "配方2","配方3","配方4")))
friedman.test(quwuji)

上面是非参数检验中Friedman检验的一个程序,数据是用矩阵形式,但要一个一个录入数据,太麻烦了。
如果有现成的txt数据,就可以用read.table函数导入R,但如何对此进行Friedman检验呢?

最佳答案

epoh 查看完整内容

quwuji=as.matrix(read.table("friedman.txt")) dimnames(quwuji)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-12-19 21:12:04
quwuji=as.matrix(read.table("friedman.txt"))

dimnames(quwuji) <- list(1 : 6,c("配方1", "配方2","配方3","配方4"))
friedman.test(quwuji)
#   Friedman rank sum test
#data:  quwuji
#Friedman chi-squared = 8.5932, df = 3, p-value = 0.03522
friedman.txt
  
friedman.txt
大小:(120 Bytes)

 马上下载


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-21 17:23:31
epoh老师的程序执行结果:
> quwuji=as.matrix(read.table("friedman.txt"))
>
> dimnames(quwuji) <- list(1 : 6,c("配方1", "配方2","配方3","配方4"))
> friedman.test(quwuji)

        Friedman rank sum test

data:  quwuji
Friedman chi-squared = 8.5932, df = 3, p-value = 0.03522

> #   Friedman rank sum test
> #data:  quwuji
> #Friedman chi-squared = 8.5932, df = 3, p-value = 0.03522
> friedman.txt
错误: 找不到对象'friedman.txt'
>

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群