MH算法的matlab实现我要分享

Matlab implementation of MH algorithm

matlab 算法 实现 MH

关注次数: 412

下载次数: 0

文件大小: 1.04 kB

代码分类: 其他

开发平台: matlab

下载需要积分: 2积分

版权声明:如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

代码描述

中文说明:应用背景通过Metropolis-Hasting算法,用最基本的均匀等概分部实现任意的随机变量的概率分布的样本,随着实验次数的增多,样本点的分布就能越来越趋近于真实的随机变量分布。关键技术 1)选择一个不可约MC转移矩阵Q(i,j) = Pr(i->j),;随机选取初始状态; 2)let n = 1, X[n] = k; 3)生成随机数X,such that P(X = j) = q(X[n], j); 4)如果U<(b(X)q(X,X[N]))/(b(X[n]q(X[n],X)), 则选择 NS = X,否则选择 NS = X[n]; 5)n = n + 1, X[n] = NS; 6)go to 3)


English Description:

Application backgroundThrough the Metropolis-Hasting algorithm, the probability distribution of random variables can be realized by using the most basic uniform and homogeneous, with the increase of the number of experiments, the distribution of sample points can be more and more close to the real random variable distribution.Key Technology1) choose a Pr (I, J) = Q (i->, J), which can not be approximately MC transfer matrix, and select the initial state randomly;2) n X[n] = 1, let = k;3) to generate random numbers of such, that P X (X = J) = q (X[n], J);4) if U< (b (X) Q (X, X[N])) / (b (X[n]q, X, X[n])), then select NS = X, otherwise NS = X[n];5) n = n + 1, X[n] = NS;6) to go 3)


代码预览