## Wednesday, September 28, 2011

### For Linux / MacOS users: Easy fix for windows() command

For users of Linux / MacOS, the windows() command in R is not recognized. The analogous command is X11(). Therefore, you could go through the programs and replace every occurrence of windows(...) with X11(...). Or, you could just tell R to do it for you, by putting this line at the top of the file (but after any remove all objects command):

if ( .Platform\$OS.type != "windows" ) {
windows <- function( ... ) X11( ... )
}

This tip was suggested by George Kachergis. Thanks George!

See additional graphics info at this more recent blog entry.

## Sunday, September 11, 2011

### Workshop, Saturday Oct. 22, Purdue University

I'll be doing at workshop at Purdue University, on the morning of Saturday October 22, 2011.

## Saturday, September 10, 2011

### Review in the British Journal of Mathematical and Statistical Psychology

Though risking hyperbole, I would describe this book as revolutionary, at least in the context of psychology. It is, to my knowledge, the first book of its kind in this field to provide a general introduction to exclusively Bayesian statistical methods. In addition, it does so almost entirely by way of Monte Carlo simulation methods. While reasonable minds may disagree, it is arguable that both the general Bayesian framework advocated here, and the heavy use of Monte Carlo simulations, are destined to be the future of all data analysis, whether in psychology or elsewhere. If this is so, then Doing Bayesian Data Analysis might be something of a harbinger, rousing psychology to the new realitites of data-analysis in the 21st century. ...
Doing Bayesian Data Analysis introduces psychology to new ways of thinking and new ways of talking about and presenting data-analysis. Anyone serious about data analysis in psychology ought to read this book. At the very least, it will serve as a welcome new perspective on the field. More probably, or so it seems to me, the ideas and methods presented here will eventually be seen as the foundations for new approaches to statistics that will becomes commonplace in the near future.
I think the reviewer has a remarkably clear view of the intellectual landscape, of where psychology (and science generally) is going, and of where the book attempts to situate itself. Thank you, Mark, for such a perceptive review. Now may everyone else see as clearly as you!

* Andrews, M. (2011). Book Review. British Journal of Mathematical and Statistical Psychology. Article first published online: 5 Sep 2011. DOI: 10.1111/j.2044-8317.2011.02027.x

### plotPost.R now has curve option (instead of histogram)

When plotting the distribution formed by an MCMC chain, the book uses a histogram. I've added a new option to the plotPost.R function so that it can make a curve instead. Get the new plotPost.R program from the book's web site.

An example. Suppose x is the vector of values in an MCMC chain:

x = rnorm( 10000 , 2.15 , 1 )

The usual plotPost would produce a histogram, like this:

histinfo = plotPost( x , breaks=30 , col="skyblue" , compVal= 0 , ROPE=c(-0.1,0.1) )

But the new plotPost has a showCurve option:

histinfo = plotPost( x , showCurve=T , col="skyblue" , compVal= 0 , ROPE=c(-0.1,0.1) )


Notice that the "breaks" argument was removed from the command when using showCurve=T, because "breaks" only applies to histograms.

Why use one form or the other? A histogram reminds the viewer that the plot represents a sample of points, not a known mathematical function (even though there is a mathematical function underlying the sample). This was the motivation for using histograms in the book. Also, the curve uses a kernel density estimation technique that blurs the distribution, so the curve will tend to be not quite peaked enough and a little too wide in its tails. On the other hand, the curve might be easier to view and more aesthetically pleasing. Ultimately the choice is yours.  Now you have the choice!