- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 283 个
- 通用积分
- 2.3358
- 学术水平
- 0 点
- 热心指数
- 0 点
- 信用等级
- 0 点
- 经验
- 412 点
- 帖子
- 22
- 精华
- 0
- 在线时间
- 42 小时
- 注册时间
- 2015-6-8
- 最后登录
- 2023-6-6
大专生
还不是VIP/贵宾
- 威望
- 0 级
- 论坛币
- 283 个
- 通用积分
- 2.3358
- 学术水平
- 0 点
- 热心指数
- 0 点
- 信用等级
- 0 点
- 经验
- 412 点
- 帖子
- 22
- 精华
- 0
- 在线时间
- 42 小时
- 注册时间
- 2015-6-8
- 最后登录
- 2023-6-6
| 开心 2016-8-30 18:28:46 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到
|
20论坛币
请教大神:
在《R语言实战》中提到可用coin包中的oneway_test函数做置换检验,但怎么提取出里面的P值来?
library(coin)
score <- c(40, 57, 45, 55, 58, 57, 64, 55, 62, 65)
treatment <- factor(c(rep("A", 5), rep("B", 5)))
mydata <- data.frame(treatment, score)
t.test(score ~ treatment, data = mydata, var.equal = TRUE)
fit<-oneway_test(score ~ treatment, data = mydata, distribution = "exact")
fit
Exact Two-Sample Fisher-Pitman Permutation Test
data: score by treatment (A, B)
Z = -1.9147, p-value = 0.07143
alternative hypothesis: true mu is not equal to 0
另外,这里的Z值为-1.9147,但根据Z值来求P值的话:pnorm(-1.9147)*2=0.0555,与上面的P值也不同,但与下面的置换检验(参数 distribution取“asymptotic”)中P值相同,想问一下:为何两个不同的参数,得到同一个Z值,但得到不同的P值,谢谢!
> oneway_test(score ~ treatment, data = mydata, distribution = "asymptotic")
Asymptotic Two-Sample Fisher-Pitman Permutation Test
data: score by treatment (A, B)
Z = -1.9147, p-value = 0.05553
alternative hypothesis: true mu is not equal to 0
|
|