No BSD License
Highlights from
mcmc
-
betalpr(p1,p2,alpha,beta)
BETALPR - Beta Distribution - Log Probability Ratio
-
gamlpr(g1, g2, alph, gam)
GAMLPR = Gamma Distribution - Log Probability Density Ratio
-
invwishirnd(S,d)
INVWISHIRND - Inverse Wishart Random Matrix
-
invwishlpr(IW1, IW2, S, d)
INVWISHLPR = Inverse Wishart Distribution - Log Probability Density Ratio
-
invwishpdf(IW,S,d)
INVWISHPDF = Inverse Wishart Distribution - Probability Density Function
-
invwishrnd(S,d)
INVWISHRND - Inverse Wishart Distribution - Random Matrix Value
-
ltindex(index, dim) ;
LTINDEX - Lower Triangular Index
-
ltvec(m)
LTVEC - Change a Lower-Triangular Matrix into a Vector
-
ltvec(v)
VECLT - change a vector into a lower-triangular matrix
-
mcmcgr(A,ng) ;
MCMCGR - Gelman-Rubin R statistic for convergence
-
mcmclt(A)
MCMLT - makes matrix of MCMC runs lower triangular
-
mcmcsumm(A)
MCMCSUMM - Summary Statistics
-
mcmctrace(A)
MCMCTRACE - trace plots
-
metrop ( logq, newval, oldval...
METROP - perform a Metropolis-Hastings step
-
mvnormlpr (x1, x2, mu, sigma)
MVNORMLPR - Multivariate Normal Distribution - Log Density Ratio
-
mvnormrnd (mu,sigma,n)
MVNORMRND - Multivariate Normal - Random Number Generation
-
wishirnd(Sc,n)
WISHIRND - Wishart Distribution - Random Matrix
-
wishrnd(Sc,nu)
WISHRND - Random Matrix from Wishart Distribution
-
Contents.m
-
mcmcacf.m
-
mcmcdemo.m
-
randrand.m
-
About_MCMC.html
-
index.html
-
View all files
from
mcmc
by David Shera
MCMC -- Markov Chain Monte Carlo Tools
|
| mcmcdemo.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 Wisharts
SIW = NaN* zeros(5,5,200) ;
% nu = degrees of freedom = precision parameter
nu = 50
% IWmode = mode of distribution of SIW
IWmode = 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 all
for ii = 1 : 200 ;
IW = invwishrnd ( IWparm, nu ) ;
SIW(:,:,ii) = IW ;
end ;
echo on
% display the dimensions of SIW
size(SIW)
% create structure of summary statistics
SIWsumm = mcmcsumm(SIW) ;
SIWsumm.mean
SIWsumm.median
SIWsumm.std
SIWsumm.min
SIWsumm.max
% SIWsumm.sorted - not printed, but available for later use.
% SIWsumm.acf - autocorrelation, not printed but available.
% create lower triangular version, upper triangle is redundant
SIWlt = mcmclt(SIW) ;
% plot trace of upper triangular version
mcmctrace(SIWlt) ;
% for a plot of the autocorrelation, use mcmctrace(SIWsumm.acf)
|
|
Contact us at files@mathworks.com