saiyasaibing 发表于 2010-9-30 21:51 
是啊 我试过rand('gamma',a)。 但是这种情况下另外一个参数beta默认设置为1,也就是说只能改alpha。
求教各位高手,如何定义两个参数呢?并且参数既可为整数,又可以是带小数点的数。
-
- title 'Generating random Samples with 10,000 observations from a Gamma Density';
- data _t;
- run;
- ***not or unnecessary to discard any simulated samples;
- proc mcmc data=_t outpost =Gamma_Simu seed =11 nmc =10000 maxtune =0 nbi =0
- statistics =(summary) diagnostics =none;
- parm r 0.1;
- prior r ~ gamma(a, scale=b);
- model general(0);
- 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