- PowerPoint PPT Presentation

About This Presentation
Title:

Description:

WinBUGS by Haitao Chu Presented as part of the Statistical Software Interest Group s seminar series. Visit www.sph.emory.edu/bios/ssig/ for more information. – PowerPoint PPT presentation

Number of Views:282
Avg rating:3.0/5.0
Slides: 28
Provided by: isyeGate2
Category:
Tags:

less

Transcript and Presenter's Notes

Title:


1
WinBUGSby Haitao Chu
  • Presented as part of the Statistical Software
    Interest Groups seminar series. Visit
    www.sph.emory.edu/bios/ssig/ for more
    information.
  • April 15, 2003

2
Outline
  • What is BUGS/WinBUGS?
  • Why do we want to use WinBUGS?
  • Where do we get WinBUGS?
  • How do we install WinBUGS?
  • How do we use WinBUGS?
  • Example
  • What kind of output can WinBUGS give us?
  • What kind of sampling method does WinBUGS
    implement?
  • Summary

3
What is BUGS?
4
What is BUGS?
  • Bayesian inference Using Gibbs Sampling
  • is a piece of computer software for the Bayesian
    analysis of complex statistical models using
    Markov chain Monte Carlo (MCMC) methods.
  • It grew from a statistical research project at
    the MRC BIOSTATISTICAL UNIT in Cambridge, but now
    is developed jointly with the Imperial College
    School of Medicine at St Marys, London.

5
What is BUGS?
  • The Classic BUGS program uses text-based model
    description and a command-line interface, and
    versions are available for major computer
    platforms (Sparc, Dos). However, it is not being
    further developed.

6
What is WinBUGS?
  • WinBUGS, a windows program with an option of a
    graphical user interface, the standard
    point-and-click windows interface, and on-line
    monitoring and convergence diagnostics. It also
    supports Batch-mode running (version 1.4).
  • GeoBUGS, an add-on to WinBUGS that fits spatial
    models and produces a range of maps as output.
  • PKBUGS, an efficient and user-friendly interface
    for specifying complex population pharmacokinetic
    and pharmacodynamic (PK/PD) models within WinBUGS
    software.

7
Why do we want to use WinBUGS?
  • Its ability to fit complex statistical models
    using MCMC methods.
  • Its flexibility to program, two different ways to
    specify model
  • DoodleBUGS Direct graphics
  • BUGS language
  • Free to download
  • A lot of examples in WinBUGS
  • A lot of online resources
  • http//www.mrc-bsu.cam.ac.uk/bugs/weblinks/webres
    ource.shtml

8
Where do we get WinBUGS
  • Free download
  • http//www.mrc-bsu.cam.ac.uk/bugs.
  • Package needs to be downloaded
  • WinBUGS14.exe
  • Potential useful packages for convergence
    diagnostics
  • CODA (Convergence Diagnostic and Output Analysis)
    for S or R
  • BOA (Bayesian Output Analysis) for S or R

9
How do we install WinBUGS?
  • Downloading the file WinBUGS14.exe (also
    available in S/Haitao Chu/WinBUGs)
  • Exit all other programs currently running
    (particularly if using Windows XP)
  • Go into Explore and double click on WinBUGS14.exe
  • Follow the instructions in the dialog box
  • You should have a new directory called WinBUGS14
    within Program Files
  • Inside the WinBUGS14 directory is a program
    called WinBUGS14.exe
  • Drag the pretty icon to your desktop to create a
    shortcut.
  • Double click on WinBUGS14.exe to run WinBUGS14.

10
How do we install WinBUGS?
  • Obtaining the key for unrestricted use by
    registration at
  • http//www.mrc-bsu.cam.ac.uk/bugs/winbugs/registe
    r.shtml
  • Following the instructions from automatic
    response of your registration to remove the
    restrictions in WinBUGS 1.4
  • check that the date of Keys.ocf file in
    ..\WinBUGS14\Bugs\Code\ has been updated.

11
How do we use WinBUGS?
  • Educational Example
  • Pumps conjugate Gamma-Poisson hierarchical model
  • The pumps data
  • Gamma-Poisson hierarchical model
  • Model specification in WinBUGS
  • DoodleBUGS, Direct graphics
  • BUGS language
  • Format data and specify initial values
  • Tutorial

12
The pumps data
PUMP ti xi
1 94.5 5
2 15.7 1
3 62.9 5
4 126 14
5 5.24 3
6 31.4 19
7 1.05 1
8 1.05 1
9 2.1 4
10 10.5 22
  • ti the length of operation time of the pump (in
    1000s of hours).
  • xi the number of failures

13
Gamma-Poisson hierarchical model
14
Model specification through DoodleBUGS
  • Nodes
  • Constants, denoted by rectangles
  • Stochastic nodes, denoted by ellipses
  • Deterministic nodes, logical function of other
    nodes
  • Edges
  • Directed links
  • Solid arrow stochastic dependence
  • Hollow arrow logical function
  • Undirected links, dashed line
  • representing an upper or lower bound
  • Plates, repeated parts of the graph
  • Read the User Manual Doodle help at the Help
    menu

15
Model specification through DoodleBUGS
Stochastic node
Stochastic dependence
Constant node
logical function
Deterministic node
Plate
16
Model specification through BUGS language
17
Format data and specify initial values
  • Data format
  • S-Plus format
  • list(t c(94.3, 15.7, 62.9, 126, 5.24, 31.4,
    1.05, 1.05, 2.1, 10.5), x c(5, 1, 5, 14, 3,
    19, 1, 1, 4, 22), N 10)
  • Rectangular format
  • Please see formatting of data at model
    specification at User Manual
  • Initial values
  • list(alpha 1, beta 1)
  • list(alpha 10, beta 10)

18
Tutorial Interactive submission
  • Standard windows point and click method
  • Example
  • Pumps conjugate Gamma-Poisson hierarchical
    model in Example Volume I at Help menu
  • S/Haitao Chu/WinBUGS/pumps/pumps.odc

19
Tutorial Batch mode submission
  • Files required
  • The script itself, S/Haitao Chu/WinBUGS/pumps/pum
    psbatch.odc
  • Model file, S/Haitao Chu/WinBUGS/pumps/pumpsmodel
    .txt
  • Data file, S/Haitao Chu/WinBUGS/pumps/pumpsdata.t
    xt
  • Initial values file
  • S/Haitao Chu/WinBUGS/pumps/pumpsin1.txt
  • S/Haitao Chu/WinBUGS/pumps/pumpsin2.txt
  • Format of the files
  • native WinBUGS format with .odc extension
  • text format with .txt extension

20
Tutorial running WinBUGS from R and other
programs
  • From R
  • http//www.stat.columbia.edu/gelman/bugsR
  • S/Haitao Chu/WinBUGS/bugsR
  • From other programs
  • http//www.mrc-bsu.cam.ac.uk/bugs/winbugs/remote14
    .shtml

21
What kind of output can WinBUGS give us?
  • Samples at Inference Menu
  • trace plots the variable value against iteration
    number.
  • history plots out a complete trace for the
    variable.
  • density smoothed kernel density estimate for
    continuous variable or a histogram for discrete
    variable.
  • auto cor auto correlation, up to lag-50
  • stats Summary statistics, pooling over the
    chains selected.
  • coda output the monitored values to CODA or BOA

22
What kind of output can WinBUGS give us?
  • Samples at Inference Menu
  • quantiles plots out the running mean with
    running 95 confidence intervals against
    iteration number.
  • bgr diag Brooks-Gelman-Rubin convergence
    statistic
  • Brooks and Gelman (1998)
  • Green the width of the central 80 interval of
    the pooled runs
  • Blue the average width of the 80 intervals
    within the individual runs
  • Red their ratio R ( pooled / within).
  • Convergence R to 1, and with convergence of both
    the pooled and within interval widths to
    stability.

23
What kind of output can WinBUGS give us?
Compare at Inference Menu
Box Plot
Caterpillar Plot
24
What kind of output can WinBUGS give us?
  • Rank at Inference Menu
  • stats the distribution of the ranks of each
    component of the variable.
  • histogram the empirical distribution of the
    simulated rank for each component
  • DIC at Inference Menu
  • Deviance Information Criterion

25
What kind of sampling method does WinBUGS
implement?
Sampling methods are used in the following
hierarchies Continuous target distribution Conju
gate Direct sampling using standard
algorithms Log-concave Derivative-free adaptive
rejection sampling Non-log-concave (restricted
range) Slice sampling Non-log-concave
(unrestricted range) Metropolis Discrete target
distribution (I have no experience) Finite upper
bound Inversion Shifted Poisson Direct sampling
using standard algorithm
26
Summary
  • What is BUGS/WinBUGS?
  • Why do we want to use WinBUGS?
  • Where do we get WinBUGS?
  • How do we install WinBUGS?
  • How do we use WinBUGS?
  • What kind of output can WinBUGS give us?
  • What kind of sampling method does WinBUGS
    implement?
  • MCMC can be dangerous

27

The End
  • Thank you very much for attending and
    participating in this Statistical Software
    Interest Group seminar
  • More volunteers!
Write a Comment
User Comments (0)
About PowerShow.com