Markov Chain Monte Carlo sampling of posterior distribution

버전 1.5.0.0 (4.29 KB) 작성자: Aslak Grinsted
MCMC sampling of using a cascaded metropolis
다운로드 수: 3.8K
업데이트 날짜: 2015/5/4

라이선스 보기

NOTE: I recommend using my new GWMCMC sampler which can also be downloaded from the file exchange: http://www.mathworks.com/matlabcentral/fileexchange/49820-the-mcmc-hammer--gwmcmc
Markov Chain Monte Carlo sampling of posterior distribution

A metropolis sampler
[mmc,logP]=mcmc(initialm,loglikelihood,logmodelprior,stepfunction,mccount,skip)
---------
initialm: starting point fopr random walk
loglikelihood: function handle to likelihood function: logL(m)
logprior: function handle to the log model priori probability: logPapriori(m)
stepfunction: function handle with no inputs which returns a random
step in the random walk. (note stepfunction can also be a
matrix describing the size of a normally distributed
step.)
mccount: How long should the markov chain be?
skip: Thin the chain by only storing every N'th step [default=10]



EXAMPLE USAGE: fit a normal distribution to data
-------------------------------------------
data=randn(100,1)*2+3;
logmodelprior=@(m)0; %use a flat prior.
loglike=@(m)sum(log(normpdf(data,m(1),m(2))));
minit=[0 1];
m=mcmc(minit,loglike,logmodelprior,[.2 .5],10000);
m(1:100,:)=[]; %crop drift
plotmatrix(m);


--- Aslak Grinsted 2010

인용 양식

Aslak Grinsted (2024). Markov Chain Monte Carlo sampling of posterior distribution (https://www.mathworks.com/matlabcentral/fileexchange/47912-markov-chain-monte-carlo-sampling-of-posterior-distribution), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Pseudorandom and Quasirandom Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.5.0.0

updated link in description again

1.4.0.0

updated GWMCMC link in description

1.3.0.0

changed description

1.2.0.0

changed title

1.1.0.0

Bugfix for small values of skip

1.0.0.0