SAS中文论坛

标题: 如何用SAS生成双峰分布的数据呢? [打印本页]

作者: shiyiming    时间: 2011-3-10 21:11
标题: 如何用SAS生成双峰分布的数据呢?
求助各位高手,如何生成双峰分布的数据呢?
看到文献上是这样写的 Bimodal:  N(u=0.5;sigma=0.4) N(u=-0.5;sigma=0.4)

如何实现这样分布的数据呢?

谢谢!
作者: shiyiming    时间: 2011-3-10 22:41
标题: Re: 如何用SAS生成双峰分布的数据呢?
假设mcmc在你的sas版本可用;假设双峰的分布为0.5 和0.5:

[code:2138sk06]data have; run;
proc mcmc data=have outpost=MixtureNorm seed=11 nmc=10000 nbi =2000;
      parm x 0;
      logp = logpdf('normalmix', x, 2, 0.5, 0.5, 0.5, -0.5, 0.4,  0.4);
      prior x  ~ general(logp);
      model general(0);
   run;[/code:2138sk06]
假设一个空集的输入数据。此处设定似然值为常数(flat)。故此posterior等同于prior, a mixture of normal distribution.
作者: shiyiming    时间: 2011-3-11 17:47
标题: Re: 如何用SAS生成双峰分布的数据呢?
to jingju
非常谢谢你的回复
不过程序中nmc是最后生成的个数吧,那 nbi 是什么意思呢?
需要根据nmc相应的调整吗?
作者: shiyiming    时间: 2011-3-11 21:36
标题: Re: 如何用SAS生成双峰分布的数据呢?
that is burning number. people thint it may not be necessary when you simply generate a distribution. but it is no harm to get rid of those first ones in my understanding.
作者: shiyiming    时间: 2011-3-12 23:51
标题: Re: 如何用SAS生成双峰分布的数据呢?
京剧兄,码品好,人品也好,佩服佩服




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2