image

WinBUGS ( Windows Version of Bayesian analysis Using Gibbs Sampling) is a software that was developed less than a decade ago, in 2003, by Spiegelhalter. Today it is widely used by statisticians, researchers in various fields.  Its popularity is also directly related to increasing acceptance of Bayesian statistics. What’s the purpose of WinBUGS ?

WinBUGS lets one specify almost arbitrarily complex statistical models using a fairly simple model definition language that describes the stochastic and deterministic “local" relationships among all observable and unobservable quantities in a fully specified statistical model.

The syntax for coding models is similar to R. The basic steps that one follows are :

  • Code the model using the WinBUGS syntax.
  • Compile the model.
  • Load the data.
  • Specify the initial parameters.
  • Specify number of Markov chains to be generated.
  • Use sample monitor to specify the parameters you want to track.
  • Run MCMC.
  • Analyze a ton of statistics , both from the MCMC convergence perspective + parameter behavior perspective.

That’s about it. Given a set of dependent and covariate data, WinBUGS lets you specify any sort of structure and evaluate the model.

Ok, Now coming to this book and Why this book can be read by anyone and not ONLY ecologists ?

Firstly, you start using WinBUGS , you realize that it has a User Interface. For a newbie its good. But soon one realizes that point and click interfaces suck when you want to try out many models. Juggling between 4 to 5 popup windows is painful. Thanks to R2WinBUGS, one can do most of the analysis in R itself. Earlier I used to code the model in WinBUGS , save it as a model file and then use R2WinBUGS. This book made me use the sink() function in R so that all the relevant code lies with in a single R program. You don’t have to even invoke WinBUGS at any point in time. You use the sink() function and generate a model file and in the same R program , you can invoke WinBUGS and get all the results directly in to R.

Secondly, the author systematically shows the way to code up a model and analyze the model fit using both Frequentist AND Bayesian methods. So, you basically get to see the results from both the worlds.

There is an amazing statement in the book and it goes like this :

Analyzing data is a little like fixing a motorbike but in reverse: it consists of breaking a data set into its parts (e.g., covariate effects and variances), whereas fixing a bike means putting all the parts of a bike into the right place. One way to convince yourself that you really understand how a bike works is to first dismantle and then reassemble it again to a functioning vehicle. Similarly, for data analysis, by first assembling a data set and then breaking it apart into recognizable parts by analyzing it, you can prove to yourself that you really understand the analysis.

How very true ? If you assemble a dataset by yourself, i.e you know the true parameters , and then try out different models on the data, you get an intuitive sense of what sort of model works for what sort of data.In that spirit, the author simulates data,  creates a dataset and then analyzes using Frequentist and Bayesian Methods. This “Fixing a motorbike in reverse” activity gives one a tremendous amount of insight in to various models. You immediately can get some idea behind questions like , “Why a hierarchical model makes sense than a plain vanilla model in a few cases?” ,”Why a random effects model is better than fixed effects ?” etc.

Thirdly, the book deals with 4 broad classes of models,Linear Models, Generalized Linear Models, Linear Mixed Models and Generalized Linear Mixed models.  These 4 classes of models form the core of modern applied statistics. If not for anything, this book teaches a way to specify the model structures for these four classes.

Everyone of us tries to understand the world we live in, using some sort of model be it explicit or implicit. When it comes to analyzing data and relationship between variables, WinBUGS indeed frees the modeler in you. You can try whatever model you want for the data and WinBUGS quickly shows whether your thought process is in the right direction or not. This book invites the reader to explore multiple models on a ONE single real-life dataset. I like such books where a single example/ single case study/ single dataset is used to explore various concepts right from simple univariate estimation/inference to multivariate stuff.

Overall, I think the book is very useful as it equips the reader to utilize the power of WinBUGS for developing and testing any statistical model.

Advertisements