z*****h 发帖数: 17 | 1 f(x) is proptional to
exp{-sum(v_i*(x-b_i))-(x-c)^2/(2s)}/product{1+exp(b_i-x)}
i=1 to 20, v_i, b_i, c, s 已知。sum表示和,product表示积。
请问有什莫方法可以模拟这种复杂的分布?可以用ratio of uniforms吗?
多谢您的任何帮助!!! |
f***a 发帖数: 329 | 2 可以先试试accept-reject algorithm吧
【在 z*****h 的大作中提到】 : f(x) is proptional to : exp{-sum(v_i*(x-b_i))-(x-c)^2/(2s)}/product{1+exp(b_i-x)} : i=1 to 20, v_i, b_i, c, s 已知。sum表示和,product表示积。 : 请问有什莫方法可以模拟这种复杂的分布?可以用ratio of uniforms吗? : 多谢您的任何帮助!!!
|
z*****h 发帖数: 17 | 3 多谢!是不是可以把它看作两部分:Normal+其他. 其他小于1。只要generate Normal
and Uniform? Thank tremendous!!! |
z*****h 发帖数: 17 | 4 Sorry. I think the problem is that the function is not normalized and it is
impossible to calculate the normalization constant. Can I still use accept-
reject? Any help will be high appreciated, |
h***i 发帖数: 3844 | 5 why need normalized?
is
【在 z*****h 的大作中提到】 : Sorry. I think the problem is that the function is not normalized and it is : impossible to calculate the normalization constant. Can I still use accept- : reject? Any help will be high appreciated,
|
z*****h 发帖数: 17 | 6 I'm using the algorithm for accept-reject:
1. generate X~g, U~U(0,1)
2. Accept Y=X if U<=f(X)/Mg(X)
3. Return to 1, otherwise
Here f(x) <=Mg(x) for some constant M>=1. My understanding is f(x) and g(x)
are both normalized density functions. If they are not normalized, can I
still use this algorithm?
Thanks a lot for your help, |
h***i 发帖数: 3844 | 7 找个和f(X) 定义域一样的分布做g,然后找个M,让f(X)/Mg(X) 永远小于1
f(x) and g(x)are both normalized density functions 这条不需要,反正有M,怕什么
)
【在 z*****h 的大作中提到】 : I'm using the algorithm for accept-reject: : 1. generate X~g, U~U(0,1) : 2. Accept Y=X if U<=f(X)/Mg(X) : 3. Return to 1, otherwise : Here f(x) <=Mg(x) for some constant M>=1. My understanding is f(x) and g(x) : are both normalized density functions. If they are not normalized, can I : still use this algorithm? : Thanks a lot for your help,
|
s*r 发帖数: 2757 | |
z*****h 发帖数: 17 | 9 If f(x) need not to be normalized, can I use the following algorithm?
1. Generate X~N(c,s), U~U(0,1)
2. Accept Y=X if U<=1(or sqrt(2pi*s)?)
3. Return to 1, otherwise
I'm confused about how to determine M. If f(x) is density function, there
will be no confusion. But here f(x) is proptional to ...
Any help will be highly appreciated, |
t****r 发帖数: 702 | 10 You can use Metropolis-Hasting algorithm b/c the rejection sampling method c
an be very inefficient.
It seems to me that your density function is log-concave, but not sure, you'
d better check it your self. If it is log-concave, a more efficient way of g
enerating random numbers would be Adaptive rejection sampling (google it).
Hope that helps.
【在 z*****h 的大作中提到】 : If f(x) need not to be normalized, can I use the following algorithm? : 1. Generate X~N(c,s), U~U(0,1) : 2. Accept Y=X if U<=1(or sqrt(2pi*s)?) : 3. Return to 1, otherwise : I'm confused about how to determine M. If f(x) is density function, there : will be no confusion. But here f(x) is proptional to ... : Any help will be highly appreciated,
|
|
|
z*****h 发帖数: 17 | 11 Thanks a lot. I'll check the adptive rejection sampling. Thank you!!! |
z*****h 发帖数: 17 | 12 Google了一下ARS and AMRS。发现R里有现成的function。有人用过吗?谢谢! |
h***i 发帖数: 3844 | 13 真强,都到这一步了why不花时间自己figure out?
【在 z*****h 的大作中提到】 : Google了一下ARS and AMRS。发现R里有现成的function。有人用过吗?谢谢!
|
n****6 发帖数: 570 | 14 Gilks has a c source code for arms, it seems very stable. You can google it.
I know some people using it for MCMC sampling. Actually, if you only sample
one parameter, maybe numerical integration is very efficient. |
z*****h 发帖数: 17 | 15 是Gibbs Sampling其中一个parameter。平时工作用SAS,C和R用的很少。见笑了。谢谢
大家的帮助!!!会再check一下doing sampling using numerical integration. 谢
谢!!! |
h***i 发帖数: 3844 | 16 SAS 也可以做
【在 z*****h 的大作中提到】 : 是Gibbs Sampling其中一个parameter。平时工作用SAS,C和R用的很少。见笑了。谢谢 : 大家的帮助!!!会再check一下doing sampling using numerical integration. 谢 : 谢!!!
|