
Bayesian Statistics: An Introduction: R programs
Computer programs (in R) relating to the book
The R language is
available free. These programs should work equally well in
S-plus.
Many of them make use of the HDR routines in the file
hdr.txt (improved on 10 January 2007 as
a result of comments by Jacob Colvin). A useful book for Bayesians
using the R language is J Albert,
Bayesian Computation with R, Springer-Verlag 2007;
see also the packages
LearnBayes,
R2WinBUGS,
boa and coda.
A useful A5 reference card for R is available here as
pdf, PostScript or
LaTeX source.
- Section 2.2 (rocks.txt - data on age of rocks)
- Section 2.3
(chests.txt - data on chest measurements)
- Section 2.7
(fig21.txt - program to draw Figure 2.1)
- Section 2.8
(ratweight.txt - data on uterine
weight of rats - mean assumed known)
- Section 2.12
(ratweight_unknownvar.txt -
data on uterine weight of rats - mean and variance both assumed unknown)
- Section 2.13 (wheat.txt - data on wheat
with a growth hormone)
- Section 3.1
(fig31.txt - program to draw Figure 3.1)
- Section 3.1 (limericks.txt - data on
limericks)
- Section 3.4
(misprints.txt - data on misprints
using reference prior)
- Section 3.5
(misprints_informative.txt
- data on misprints using informative prior)
- Section 3.6 (uniform.txt - data from a
uniform distribution)
- Section 3.8
(firstdigit.txt - data on the
first digit problem)
- Section 3.9
(accidents.txt - data illustrating
the circular normal distribution)
- Section 4.1
(w.txt - data about the W aprticle)
- Section 4.3
(ratweight.txt - data on uterine
weight of rats)
- Section 4.5
(pointnull.txt - point null hypotheses)
- Section 5.1
(ratdiet.txt - data about rat diet
with variances assumed known)
- Section 5.2
(ratdiet_equalvars.txt - data
about rat diet with variances assumed unknown but equal)
- Section 5.3
(ratdiet_unknownvars.txt -
data about rat diet with variances assumed unknown)
- Section 5.4
(hay.txt - data about hay yield)
- Section 5.5
(nitrogen.txt - data about nitrogen)
- Section 5.6
(inoculum.txt - Di Raimondo's data on
bacterial inoculum on mice)
- Section 6.2
(cuckoo.txt - data on cuckoo eggs)
- Sections 6.3 and 6.4
(rain.txt - data on York rainfall)
- Sections 6.5
(scabindex.txt - data on scab index
for potatoes)
- Sections 7.3
(fish.txt - data on recapture of fish)
- Section 8.3 and Chapter 8, Exercise 4
(baseball.txt - baseball example)
- Section 8.4
(fig81.txt - program to draw Figure 8.1;
the same is also available in LaTeX)
- Sections 9.2
(semiconj.txt - semi-conjugate prior
with a normal likelihood for wheat yield data
- Sections 9.2
(blood.txt - hierachical normal model
for blood coagulation time)
- Sections 9.2 and 9.3
(dataaug.txt - genetic linkage example
on data augmentation)
- Section 9.4
(chained.txt - example on chained data
augmentation due to Casella and George)
- Sections 9.4
(blood.txt - semi-conjugate prior with
normal likelihood)
- Section 9.4
(coal.txt - change point analysis of
coal disaster data)
- Section 9.5
(betasim.txt - simulation of beta
distribution by rejection sampling)
- Section 9.5
(reject.txt - example of rejection sampling)
- Section 9.6
(bivarnorm.txt - simulation from a
bivariate normal distribution)
- Section 9.8
(logistic.txt - example of logistic
regression)
- Chapter 9, Exercise 1
(integral.txt - crude Monte Carlo integration)
- Chapter 9, Exercise 3
(dataaug2.txt - genetic linkage
example from C A B Smith)
- Chapter 9, Exercise 5
(semicon2.txt - semi-conjugate prior
with normal likelihood)
- Chapter 9, Exercise 6
(hiernor2.txt - hierachical normal model)
- Chapter 9, Exercise 8
(dataaug2.txt - genetic linkage
example from C A B Smith)
- Chapter 9, Exercise 9
(chained.txt - example on chained data
augmentation due to Casella and George)
- Chapter 9, Exercise 10
(semicon2.txt - semi-conjugate prior
with normal likelihood)
- Chapter 9, Exercise 11
(rats.txt - rat data)
- Chapter 9, Exercise 12
(linkagemh.txt - genetic linkage
example using Metropolis-Hastings)
- Chapter 9, Exercise 14
(logistic.txt - bioassay data)
- Appendix C
(hdr.txt - R programs for HDRs
and Behrens' distribution)
Auxiliary routines and data used by the program
rats.txt
Peter M. Lee
Revised 3 June 2008