楼主: saiyasaibing
2596 8

如何在特定distribution下产生样本点? [推广有奖]

  • 0关注
  • 0粉丝

已卖:207份资源

硕士生

54%

还不是VIP/贵宾

-

威望
0
论坛币
1913 个
通用积分
0.9100
学术水平
3 点
热心指数
4 点
信用等级
1 点
经验
1109 点
帖子
116
精华
0
在线时间
167 小时
注册时间
2008-6-16
最后登录
2025-10-24

楼主
saiyasaibing 发表于 2010-9-28 01:43:10 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
如题
比如说我想要产生一个样本,包含若干数据(10000个或是更多),并且这些数据是服从Gamma Distribution的。
如何实现这样的工作呢?
IML是不是有此类功能呢?

先在这里谢谢给位前辈的指点。
二维码

扫码加我 拉你入群

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

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

关键词:distribution Istr BUT Dis UTI 样本 distribution

回帖推荐

bobguy 发表于2楼  查看完整内容

See below. IML是不是有此类功能呢?是的 data tmp; do i = 1 to 1e5; x_normal=rand('norm'); output; end; run; proc univariate data=tmp; var x_normal; histogram x_normal/normal; run;

本帖被以下文库推荐

沙发
bobguy 发表于 2010-9-28 06:43:44
saiyasaibing 发表于 2010-9-28 01:43
如题
比如说我想要产生一个样本,包含若干数据(10000个或是更多),并且这些数据是服从Gamma Distribution的。
如何实现这样的工作呢?
IML是不是有此类功能呢?

先在这里谢谢给位前辈的指点。
See below.
IML是不是有此类功能呢?是的

data tmp;
   do i = 1 to 1e5;
      x_normal=rand('norm');
      output;
    end;
run;

proc univariate data=tmp;
var x_normal;
histogram x_normal/normal;
run;
已有 1 人评分热心指数 收起 理由
crackman + 1

总评分: 热心指数 + 1   查看全部评分

藤椅
saiyasaibing 发表于 2010-9-28 21:43:12
Thanks a lot!

板凳
michaelnlitta 发表于 2010-9-29 13:05:57
学习了!!

报纸
zhymqy 发表于 2010-9-30 13:06:53
不是要 GAMMA  分布吗?

地板
saiyasaibing 发表于 2010-9-30 21:51:07
是啊 我试过rand('gamma',a)。 但是这种情况下另外一个参数beta默认设置为1,也就是说只能改alpha。
求教各位高手,如何定义两个参数呢?并且参数既可为整数,又可以是带小数点的数。

7
jingju11 发表于 2010-10-1 05:37:32
saiyasaibing 发表于 2010-9-30 21:51
是啊 我试过rand('gamma',a)。 但是这种情况下另外一个参数beta默认设置为1,也就是说只能改alpha。
求教各位高手,如何定义两个参数呢?并且参数既可为整数,又可以是带小数点的数。





  1. title 'Generating random Samples with 10,000 observations from a Gamma Density';
  2. data _t;
  3. run;

  4. ***not or unnecessary to discard any simulated samples;
  5. proc mcmc data=_t outpost =Gamma_Simu seed =11 nmc =10000 maxtune =0 nbi =0
  6.   statistics =(summary) diagnostics =none;   
  7.   parm r 0.1;
  8.   prior r ~ gamma(a, scale=b);
  9.   model general(0);
  10. run;
复制代码
Considering the likelihood function is specified as a constant (i.e., general(0)), the posterior distribution that SAS generates in data set 'Gamma_Simu' becomes identical to the prior distributions that you specify, a gamma, that is, p_posterior = p_prior*c/c =p_prior =gamma(a, b). JingJu

8
saiyasaibing 发表于 2010-10-1 12:32:05
Thanks a lot Professor Jingju, I am learning!

9
saiyasaibing 发表于 2010-10-5 02:13:32
我研究出了一种办法,
  1. %Let iterations = 1000;
  2. %Let seed=-1;
  3. %Let scp=5.2; /*Scale Parameter*/
  4. %Let shp=3.1; /*Shape Parameter*/
  5. %Let gammadist=&scp*rangam(&seed,&shp);
  6. %Macro GenSample;
  7. data ransample(drop=i);
  8. do i=1 to &iterations;
  9. *Gamma Distribution;
  10. f=&gammadist;
  11. output;
  12. end;
  13. %Mend GenSample;
  14. %GenSample;
  15. Proc Univariate data=ransample;
  16. run;
  17. Proc Gchart data=ransample;
  18. vbar f;
  19. Title "Distribution";
  20. run;
复制代码

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

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