Bayesian Statistics: Reopsitory of Programs/Codes
MATLAB Codes
- "Two-headed" coin: bayes1_1.m
See Handout #1 (page 8) for descripton.
- Sampling from bivariate Normal-Inverse Gamma Posterior
nig1.m
The analytic expression for the posterior is known but the sampling is done to illustrate
how to sample from a bivariate distribution if marginal distribution of
one parameter and the conditional distribution of the second, given the first,
are given and easy to sample from.
To run this sampling you will need more extensive library of
random number generators than it is provided in matlab.
One such is NPLab.zip.
This matlab suite was used to teach Nonparametric Statistics (ISyE6404) at Tech.
Expand the zip file in your matlab/toolbox/ as NPLab directory and put NPLab and
subdirectories on your matlab path (check matlab/toolbox/local/pathdef.m).
The suite BayesLab is under development.
- Multivariate Normal/Multivariate Normal Case: Student Scores Data from Mardia, Kent, and Bibby (1978)
Multivariate Statistics book.
Matlab code is: bayes6_1.m
Program is used in HANDOUT6 for illustration of MVN/MVN model and related figure.
Data are part of the m-file.
- Matlab m-code for comparing the Empirical Bayes estimators of Poisson mean $\theta$.
Two estimators parametric and nonparametric are compared with the MLE.
The code eb.m
is annotated.
- METROPOLIS: Matlab m-codes for several Metropolis examples.
The codes albertmc1.m,
albertmc2.m,
and metro2.m
illustrate Metropolis and Metropolis-Hastings Algorithm. Descriptions are
provided in Handout 10.
- Matlab m-codes for Handout 11.
The codes albertmc3.m,
mcmc2.m,
and slice.m
illustrate Gibbs sampler and Different models. Codes will be annotated and descriptions are
provided in Handout 11. To run albertmc3.m you will need truncated normal simulator
rand_nort.m
- Matlab m-codes for Handout 12.
emexample.m
illustrates the EM algorithm on Fisher genomic MLE, described in Rao.
mixture_cla.m
is an example of EM treatment of mixtures. The solution is MLE and of course
not Bayesian.
gibbs.m
illustrate Gibbs sampler in a mixture problem.
All programs are described in the handout.
To obtain normalized histograms you will need
histo.m
taken from STIXBOX.
- Matlab m-codes for Handout 16.
ising2.m Realization of Binary Markov Random Field by Metropolis;
ising3.m Realization of Binary Markov Random Field by Gibbs Sampler
ising4.m Realization of Anisotropic Binary Markov Random Field
mcmc7.m MRF in Image Denoising (1)
mcmc71.m MRF+Ising Prior in Image Denoising (2)
lettera.bmp Letter A in BMP
gt.bmp Georgia Tech (GT) in BMP.
- Matlab m-codes for Handout 20 (Wavelets). StandAlone DWTR/IDWTR.
dwtr.m Forward
Wavelet Transform.
idwtr.m Inverse
Wavelet Transform.
N-Dimensional WRAPPER written by our own Tarik and Bugra.
dwtr_n.m Forward
Wavelet Transform N-dim.
idwtr_n.m Inverse
Wavelet Transform N-dim.
MakeONFilterExt.m
Make Wavelet Filter.
demo2.m
Illustration of Wavelet Transform, dwtr.
demo3.m
Link between wavelets and Fourier.
m0.m
Function needed for demo3.m.
The program demo4.m
does hard (universal) thresholding.
The program demo5.m
does linear Bayes shrinkage.
BUGS Codes
ODC codes need BUGS to be properly previewed. With each ODC corresponding text file
is attached.
Mathematica Codes
-
Mathematica Notebook mathematic2.nb
Supporting Example: Binomial n from a single observation in
Handout 7.
-
Mathematica Notebook cauchycredo.nb
Supporting Example: Credible Sets, Cauchy Bimodal Example
Handout 7.
-
Mathematica Notebook hierarchical.nb
Supporting Example: Hierarchical Bayes, Elections.
Handout 8.
-
Mathematica Notebook jeremy.nb
Supporting Example: Jeremy, the IQ freak!
Handout 8.
Last Updated: September 15, 2004.
Back to the course main page.