2

Haskell で Metropolis アルゴリズムに基づいて MCMC プログラムを作成しようとしていますが、確率分布からのサンプリング (疑似乱数の生成) とプログラムの構造化に問題があります。今のところ、IO を処理する複雑さに対処するよりも、ハードコードされたシードを持つジェネレーターを使用することに満足しています。

It seems that I should use the state monad to keep track of the random generator state, the previous markov chain state, chi squared value and the acceptance count between each step of the algorithm and then finally collect all the markov chain states and the last acceptance count. Is this the best/idiomatic way to do this? and if so what should the layout of the program should be (i.e. type signatures of the proposal function and the metropolis step function etc.).

I have seen some sample programs that deal with random numbers where a list of random numbers of a particular length is generated from some kind of a probability monad and then threaded through some simple functions to perform the computation. I really would like to avoid this inside out form of the program if it possible.

Edit: Temporarily removed WIP code.

4

1 に答える 1