楼主: dxystata
4659 30

[问答] 如何计算得到呢? [推广有奖]

版主

已卖:302份资源

大师

37%

还不是VIP/贵宾

-

TA的文库  其他...

Software

中英文Ebook

R学习

威望
2
论坛币
183395 个
通用积分
15333.1475
学术水平
208 点
热心指数
271 点
信用等级
174 点
经验
298627 点
帖子
5586
精华
1
在线时间
13632 小时
注册时间
2006-6-21
最后登录
2025-12-22

初级学术勋章 初级热心勋章 中级热心勋章 初级信用勋章

楼主
dxystata 发表于 2013-1-1 09:37:29 |AI写论文
200论坛币
data aaa;
input x1 x2;
diff=x1-x2;
cards;
50.7 60
3.3  3.3
28.8 30
46.2 43.2
1.2  2.2
25.5 27.5
2.9 4.9
5.4 5
3.8 3.2
1 4
;
run;
proc univariate data =aaa;
  var diff;
run;

If , the significance of is computed from the exact distribution of , where the distribution is a convolution of scaled binomial distributions.

For n <= 20, proc univariate uses the exact distribution to compute the significance of S,如何计算得到的呢?
谢谢!

最佳答案

jingju11 查看完整内容

This is an exact p value from permutation. I gave a way how to calculate the exact p value in data step. Please read Wilcoxon Signed Rank Test when n
关键词:distribution significance convolution Univariate Binomial 计算 where 如何

本帖被以下文库推荐

沙发
jingju11 发表于 2013-1-1 09:37:30
This is an exact p value from permutation. I gave a way how to calculate the exact p value in data step.
Please read Wilcoxon Signed Rank Test when n <= 20
jingju
已有 2 人评分学术水平 热心指数 信用等级 收起 理由
webgu + 1 + 1 + 1 牛啊。
ziyenano + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 2  热心指数 + 2  信用等级 + 2   查看全部评分

藤椅
向西村上春树 发表于 2013-1-4 20:06:23
也许可以用R函数  还是等高手吧

板凳
ziyenano 发表于 2013-1-4 22:20:36
wilcoxon符号秩检验;
默认的mu0=0;
原假设为dif的中位数=mu0;
以dif为例,首先计算dif-mu0;剔除掉dif-mu0=0的观测;
计算|dif-mu0|的秩,
之后考虑正负号,
r+为正数的秩和,r-为负数的秩和;
实际应用中W=min(r+,r-),W服从wilcoxon符号秩分布
查表可以确定是否拒绝原假设。
已有 1 人评分热心指数 信用等级 收起 理由
数据分析师3K + 1 + 1 鼓励积极发帖讨论

总评分: 热心指数 + 1  信用等级 + 1   查看全部评分

报纸
dxystata 发表于 2013-1-5 13:29:09
jingju11 发表于 2013-1-5 12:49
This is an exact p value from permutation. I gave a way how to calculate the exact p value in data s ...
data have;
input x1 x2;
diff=x1-x2;
a_diff= round(abs(diff), .01);
cards;
50.7 60
3.3  3.3
28.8 30
46.2 43.2
1.2  2.2
25.5 27.5
2.9 4.9
5.4 5
3.8 3.2
1 4
;
run;

试试这个数据集,你的程序中未考虑差值为0和ties的情况!
谢谢!

地板
jingju11 发表于 2013-1-5 13:49:21
dxystata 发表于 2013-1-5 13:29
data have;
input x1 x2;
diff=x1-x2;
你怎么知道我没有考虑TIES的情况? 在SAS里,0 不携带信息.(但是我不是说所有的人都认为如此).基于你的数据结果如下:
京剧

VarName
Test
Testlab
StatpType
pValueMu0
diff
Student's t
t
-1.41562Pr > |t|
0.190550
diff
Sign
M
-1.5Pr >= |M|
0.507810
diff
Signed Rank
S
-12Pr >= |S|
0.179690


好象粘贴表格不好用.
MPRINT(WSRLE20): run;
-------------------------------------------------------
------------- Results from data step -------------
Sum of total ranks for diff 45
Sum of ranks for +/- diff 10.5
# of combinations in one-side 46
Wilcoxon signed rank statistic S -12
P value from exact permutation test 0.17969
-------------------------------------------------------
NOTE: There were 9 observations read from the data set WORK.HAVE_R.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
 
19353 ;

7
dxystata 发表于 2013-1-5 14:24:05
data aaa;
input x1 x2;
diff=x1-x2;
cards;
50.7 60
3.3  3.3
28.8 30
46.2 43.2
1.2  2.2
25.5 27.5
2.9 4.9
5.4 5
3.8 3.2
1 4
;
run;
proc univariate data =aaa;
  var diff;
run;

得到的结果是 符号秩       S       -12    Pr >= |S|   0.1719
非0.17969

8
jingju11 发表于 2013-1-5 14:40:25
okay. I think that is because of the fuzz numbers, similiar to 0 .3 ^=0 .3. why this is a problem here? the reason is that getting the rank is basically to order the data and then assign the rank values. To get around that, what i was doing is using diff = round(x1-x2, .01) considering your data values. probably you can disconcern this from the ranked data set.
jingju

已有 1 人评分经验 学术水平 热心指数 收起 理由
dxystata + 20 + 1 + 1 好的意见建议

总评分: 经验 + 20  学术水平 + 1  热心指数 + 1   查看全部评分

9
dxystata 发表于 2013-1-5 14:40:55
jingju11 发表于 2013-1-5 13:49
你怎么知道我没有考虑TIES的情况? 在SAS里,0 不携带信息.(但是我不是说所有的人都认为如此).基于你的数 ...
我算出的结果是0.1719

10
ziyenano 发表于 2013-1-5 14:49:14
jingju11 发表于 2013-1-5 13:49
你怎么知道我没有考虑TIES的情况? 在SAS里,0 不携带信息.(但是我不是说所有的人都认为如此).基于你的数 ...
我觉得在proc rank的时候都考虑到了~
proc rank data =have out =have_r;
      where diff ^=0;
      var   a_diff      ;
      ranks a_diff_r;
run;
where 条件提出了等于0的情况
rank默认选择ties取平均值,正好对应算法要求

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-27 06:22