Clinician's
corner



Programmer's
corner
So, you use WinBUGS a lot? Want more?
Patrick Blisle
Division of Clinical Epidemiology
McGill University Health Center
Montreal, Quebec CANADA
patrick.belisle@rimuhc.ca

Last modification: 21 sep 2017















Useful tools in (almost) every day's statistician's life
Welcome to my Bayesian statistics homepage. I am a programming statistician and I have been working with Dr Lawrence Joseph in a Bayesian framework since 1994. To fill the miscellaneous tasks I have to do in my regular work, I mainly use SAS, R, WinBUGS and Perl. Over the years, I have developed several tools, programs and functions to make my life easier: I thought I would share some of them with you, as they are likely to be useful to a Bayesian audience.

WinBUGS tools

%mds2wb
A SAS macro to save multi-dimensional structures to WinBUGS list files.

WriteWinBUGSScript
A program to facilitate the writing of WinBUGS scripts.

RunWinBUGSScript
A program to facilitate the running of WinBUGS scripts.

WinBUGSlogs2HtmlSummary
A program to summarize the node statistics for each node in a series of WinBUGS log text files.

wb.stats
An R function to read node statistics from a WinBUGS text output file.

R functions

aickin.alpha
A function to compute Aickin Alpha's agreement coefficient.

bic.process
A function to process bic.glm and bic.surv outputs.

combine.lists
A function to combine/append two lists, with special attention to dimensions present in both.

dbind
A function to bind two matrices diagonally.

forest.plot.or
A function to draw a forest plot.

RSimulationHelper
A program to optimize R simulations by using multiple processors simultaneously (parallel computing).

wb.stats
A function to read node statistics from a WinBUGS text output file.

beta.parms.from.quantiles
A function to compute Beta distribution parameters fitting specified quantiles and cumulative probabilities.

gamma.parms.from.quantiles
A function to compute Gamma distribution parameters fitting specified quantiles and cumulative probabilities.


%AickinAlpha
A macro to compute Aickin Alpha's agreement coefficient.

%BICOrdinalLogistic
A macro to compute Bayesian Information Criterion (BIC) in Ordinal Logistic Regression Models.

%BICSurvTimeDependent
A macro to compute Bayesian Information Criterion (BIC) in Survival Models when one or more of the independent variables is (are) time-dependent.

%DatesDesc
A macro to compute dates variables descriptive statistics.

%mds2wb
A macro to save multi-dimensional structures to WinBUGS list files.

%MeanOf
A macro to compute the arithmetic mean of several variables in proc sql.

%MultiTranspose
A macro to transpose multiple variables in a SAS data set within a single macro call.

%ProportionsDiffCIsNewcombe
A macro to compute confidence interval(s) for difference between independent proportions.

%VennDiagram
A macro to plot 3-way Venn diagrams.

and more...

Miscellaneous tools

FieldGoal
A program for extracting a field (or column) from a text file.

Loop
A Perl program to repeat text (or code) — with slight modifications — a large number of times.

Perl programming

Most of the WinBUGS tools presented on this site and most of the Bayesian software Lawrence Joseph and I have developed are Perl-driven. Perl is a powerful and yet easy-to-learn programming language that can prove very useful to statisticians.

Indeed, aside from its use in the (relatively) elaborated programs cited above, I use it almost daily for
  • system administration;
  • data files cleaning;
  • data file preparation (e.g., read values for different variables from a bunch of files and merge them into a unique WinBUGS list file);
  • extract useful information from a bunch of files and write an easy-to-read summary, e.g., in html or Latex tables.
I will not try to convince you of the pertinence of Perl in statistics through complex examples, but rather give you a quick tour of basic applications to statistical projects.

Read my invitation to Perl, and you be the judge!