⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcmcdemo.m

📁 马尔科夫链蒙特卡洛模拟的matlab源代码
💻 M
字号:
% MCMCDEMO - small demonstration program for the use of MCMC library% Copyright (c) 1998, Harvard University. Full copyright in the file Copyright%% There is no MCMC chain set up here, just a random sample% of matricies from an inverse wishart distribution.%% The use of the summary and trace functions are demonstrated.%% The program is commented.% echo % Creating an array to hold all the values so that things run a little% faster.% SIW = Sample of Inverse WishartsSIW = NaN* zeros(5,5,200) ;% nu = degrees of freedom = precision parameternu = 50% IWmode = mode of distribution of SIWIWmode = 3*eye(5) + 2 * ones(5,5) % The inverse Wishart scale parameter = nu * the mode.% (in our parameterization)IWparm = nu * IWmode% This is not really an MCMC run, simply a random sample.echo off allfor ii = 1 : 200 ;  IW = invwishrnd ( IWparm, nu ) ;  SIW(:,:,ii) = IW ;end ;echo on % display the dimensions of SIWsize(SIW)% create structure of summary statisticsSIWsumm = mcmcsumm(SIW) ;SIWsumm.meanSIWsumm.medianSIWsumm.stdSIWsumm.minSIWsumm.max% SIWsumm.sorted - not printed, but available for later use.% SIWsumm.acf - autocorrelation, not printed but available.% create lower triangular version, upper triangle is redundantSIWlt = mcmclt(SIW) ;% plot trace of upper triangular versionmcmctrace(SIWlt) ;% for a plot of the autocorrelation, use mcmctrace(SIWsumm.acf) 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -