楼主: yuan0110
2333 9

请教SAS问题 [推广有奖]

  • 0关注
  • 0粉丝

小学生

85%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
65 点
帖子
8
精华
0
在线时间
5 小时
注册时间
2010-7-29
最后登录
2011-8-26

楼主
yuan0110 发表于 2010-10-14 17:03:41 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
Two players are interested in having a game of dice. A single dice is rolled until either two consecutive unequal even numbers appears, or alternatively, a 2, followed immediately by 3. For example, a 2-4 pair is two consecutive unequal even numbers but a 2-2 pair is not. We are interested in which event is more likely to occur, a pair of two consecutive unequal even numbers, or a 2-3 pair? The players would like to investigate.
The SAS data set called dice contains the result of 10000 rolls of a dice. Every time we obtain a pair of two consecutive unequal even numbers or a 2-3 the game is restarted.
Example 1 : rolling 4-6-2 counts as a 4-6 but not as a 6-2.
Example 2 : rolling 4-2-3 counts as a 4-2 but not as a 2-3.
Example 3 : rolling 4-2-2-3 counts as two pairs; a 4-2 and a 2-3.
Example 4 : rolling 4-2-4-6 counts as two pairs; a 4-2 and a 4-6.
Using the SAS data set dice, create two new SAS data sets EvenNum and TwoThree, each containing the one variable, NumRolls. The variable NumRolls indicates the number of dice rolls it took since the last restart. Submit code, and appropriate PROC for both EvenNum and TwoThree. Which event appears more likely to occur, a pair of two consecutive unequal even numbers, or a 2-3 pair? Give the probability and the mean numbers of NumRolls for the events.

对不起英文版给大家添加麻烦了。

大概就是说只要碰到2-3组合或者是非等偶数组合 游戏就会从头算起
然后放到两个不同的data set里面因为条件不一样,然后建立一个新的variable 数出每两个重启之间的筛筛数量。

请求高手帮忙啊~~~~
想破脑袋了。。。。
二维码

扫码加我 拉你入群

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

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

关键词:SAS问题 appropriate Alternative Probability Interested interested appears example numbers either

dice.pdf
下载链接: https://bbs.pinggu.org/a-771865.html

518.71 KB

本帖被以下文库推荐

沙发
ladyw 发表于 2010-10-14 17:11:03
还搞英文的,大家的水平这么高啊

藤椅
crackman 发表于 2010-10-14 17:46:15
楼主先解释哈题目嘛
每个人理解不一样的

板凳
crackman 发表于 2010-10-14 19:27:19
bobugy应该可以解答这个问题

报纸
jingju11 发表于 2010-10-14 22:20:08
1# yuan0110

very interesting.
If you ar rolling like 1 1 4 6, the NumRolls is 3 or 4?

and
example 2: rolling 4-2-3 counts as a 4-2 but not as 2-3
looks like unfair to 2-3 pair.

地板
soporaeternus 发表于 2010-10-14 23:10:24
  1. data price;
  2.         do n=1 to 10000 by 1;
  3.                 num=ceil(ranuni(123)*6);
  4.                 output;
  5.         end;

  6. run;

  7. data r;
  8.         set price;
  9.         lag_num=lag(num);
  10.         NumRolls+1;
  11.         if (num=3 and lag_num=2) or (num^=lag(num) and mod(num,2)=0 and mod(lag_num,2)=0) then do;
  12.                 if (num=3 and lag_num=2) then Flag="TwoThree";
  13.                 else if (num^=lag_num and mod(num,2)=0 and mod(lag_num,2)=0) then Flag="EvenNum";
  14.                 output;
  15.                 NumRolls=0;
  16.         end;
  17.         else do;
  18.                 Flag="None";
  19.                 output;
  20.         end;
  21. run;

  22. proc sql;
  23.         create table ana as
  24.                 select
  25.                         Flag
  26.                         ,sum(NumRolls) as NumRolls
  27.                 from r
  28.                 where Flag not in ("None")
  29.                 group by
  30.                         Flag
  31.         ;
  32.                
  33. quit;
复制代码
抛砖引玉了,大牛们都是和偶们有时差的
感觉就是1/6和1/36的比,统计知识都忘光了,大家指正哈
又感觉没必要放在2个dataset了,就自作主张放一起了
放大样本,多跑了几次,貌似真的是1/6
无奈英语太差,没很大把握......
Let them be hard, but never unjust

7
jingju11 发表于 2010-10-14 23:17:33
I may not thoroughly understand your question.
1. Two consecutive unequal even numbers? Simply speaking, which ones are of your interest?

24 42 26 62 46 64

what about 224, etc.?

2. Apparently, the even-pairs are more often than 2-3 pairs. So why to make the comparison?

This question is hard because the inconsistency exists among the rules. If those examples were followed, it is not ideal to compute the likelihood of getting the desired pairs.

Sometimes I just image that two persons are throwing the dice and the result is only counted at the 2nd person. That is,

person1 person2 result
1              1             none
2              4             evenNum
2              3             2-3pair
4              2            none
4              5            none
.....

JingJu

8
jingju11 发表于 2010-10-14 23:28:30
6# soporaeternus

                                                                         Num
                          Obs     n    num    lag_num    Rolls    Flag
                           30    30     3        4         4      None
                           31    31     4        3         5      None
                           32    32     2        4         6      EvenNum
                           33    33     4        2         1      EvenNum
                           34    34     2        4         1      EvenNum
                           35    35     4        2         1      EvenNum
                           36    36     4        4         1      None
                           37    37     1        4         2      None
                           38    38     1        1         3      None
                           39    39     4        1         4      None
                           40    40     5        4         5      None

原来他想要这。。。这好像简单一些。
真是快捷。我还在琢磨他到底希望什么东西呢?

9
soporaeternus 发表于 2010-10-14 23:45:04
8# jingju11

  1. data r;
  2. set price;
  3. lag_num=lag(num);
  4. NumRolls+1;
  5. if ((num=3 and lag_num=2) or (num^=lag(num) and mod(num,2)=0 and mod(lag_num,2)=0)) and NumRolls>=2 then do;
  6.   if (num=3 and lag_num=2) then Flag="TwoThree";
  7.   else if (num^=lag_num and mod(num,2)=0 and mod(lag_num,2)=0) then Flag="EvenNum";
  8.   output;
  9.   NumRolls=0;
  10. end;
  11. else do;
  12.   Flag="None";
  13.   output;
  14. end;
  15. run;
复制代码
果然有错......
抱了下佛脚,撑不住睡觉去了,明天再来看
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
hopewell + 1 + 1 + 1 好的意见建议

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

Let them be hard, but never unjust

10
豆子哥哥 发表于 2011-9-21 06:36:34
data wayne.EvenNum wayne.TwoThree;
drop x pre win;
set wayne.dice;
retain pre 0;
win =0 ;
NumRolls+1;
if (mod(x,2)=0) and (mod(pre,2)=0) and (pre ne 0) and (pre ne x) then do;
output wayne.EvenNum;
win=1;
end;
if (x=3) and (pre=2) then do;
output wayne.TwoThree ;
win=1;
end;
if win=1 then do;
pre=0;
NumRolls=0;
end;
else pre=x;
run;
proc means data=wayne.EvenNum;
run;
proc means data=wayne.TwoThree;
run;


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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-2 05:57