WinBUGS - Code examples -
1 Normal
distribution
l Both mean and
variance are unknown. (Section 4.2) Code (file) Output
l Unknown variance
(with known mean). (Section 3.2) Code (file) Output
l Comparing two
populations. Code (file)
Output
2 Binomial
distribution
l Beta prior
(Section 2.4) Code (file)
Output
l Discrete prior
(Section 2.3) Code (file)
Output
3 Poisson
distribution (Section 3.3)
l Hospital A Code (file) Output
l Hospital B Code (file) Output
4 Multinomial
distribution (Section 4.3)
l 2008 presidential
election poll: Code (file)
Output
5 Grouped Data
(Section 6.7-6.8)
l Using multinomial
distribution Code (file)
Output
l Using I(,)
function Code (file)
Output
6 Cauchy
Distribution (Section 6.9)
l Mixture
representation Code (file) Output
l 0fs trick Code (file) Output
l 1fs trick Code (file) Output
7 Heart Transplant
Data (Section 6.10)
l Using 0fs trick Code (file) Output
l Using 1fs trick Code (file) Output
8 Hierarchical
models
l Common mortality
(Section 7.4) Code (file)
Output
l Heterogeneous
mortalities (Section 7.5-7.10) Code (file) Output
l Heterogeneous
mortalities using 0fs trick for the prior (Section 7.5-7.10) Code (file) Output
9 Regression
example
l Regression model
(Section 9.2) Code (file)
Output
l Survival model
(Section 9.4) Code (file) Output
l Robust regression
using mixture representation (Section 11.5) Code
(file) Output
l Robust regression
using t-density with df>=2 (Section 11.5) Code
(file) Output
10 Probit model
(Section 10.3) Code
(file) Output
11 Logit model
(Section 11.6) Code (file)
Output
12 Table of Means
(Sections 10.4.3-10.4.4) Code (file) Output
13 Change point
model (Section 11.4) Code (file) Output
14 Ordered Probit
model Code
(file) Output
15 Ordered Logit
model Code (file) Output
16 Multinomial Logit
model Code (file) Output
17 Tobit model (Type
I Tobit)
l Using 0es trick Code (file) Output
18 Sample Selection model
(Type II Tobit) Code (file)
Output
19 Stochastic
volatility model
l Without leverage
( = symmetric SV model): Code (file) Output@
l With leverage ( =
asymmetric SV model): Code (file) Output
# If there are multiple
datasets, repeat gload datah step for each dataset as many times as needed.