I recently wrote a review of Understanding psychology as a science: an introduction to scientific and statistical inference by Zoltan Dienes (2008). Dienes‘ book covers Neyman-Pearson null hypothesis significance testing, Bayesian inference and the likelihood method of inference (inspired by Fisher and associated with A. W. F. Edwards and more recently R. Royall).
One of the most useful features of the book is that Dienes provides Matlab code for examples of calculations in the book (e.g., for Bayes factors, likelihood intervals and so forth). This is not so useful for me because I don’t use Matlab. Matlab licenses are also quite expensive and may not be possible for students to access it in many Psychology departments. For those without access to Matlab, Dienes also provides calculators for a number of functions on his own web page for the book. (The calculators are found by following the links to the appropriate chapter, so the Bayes factor calculator is found by following the Chapter 4 link).
Danny Kaye and I thought it would be useful to write R code to compliment the Matlab code for Dienes‘ functions as a ‘bonus feature’ for the review. As these functions and the notes for them take up quite a bit of space we decided to include only one, for a Bayes factor, in the review itself (with some notes on how to use it). Danny did most of the work writing functions, which are more-or-less direct translations of the original Matlab code (and have been checked against the web versions). The full set of functions is hosted on his web site along with the notes on how to use them. Also included are page references for the examples in the book.
Why did we write the R functions? First, they offer convenient access to the functions for teachers and students (because R is free and runs on Windows, Mac OS or Linux operating systems). Second, it reduces the burden on Dienes‘ web calculator (at a marginal decrease in ease of use). Third, R is open source so it is simple to see how the code works and to edit, extend or adapt it (though it is polite to acknowledge the authors of the original code). Fourth, we want to encourage more people to start using R!
As an example, I’ve already written some alternative functions for likelihood intervals (though as I happened I re-wrote these almost from scratch to get them to plot the likelihood function and interval and to take advantage of some built-in R functions). Those functions are intended for a the book I’m working on and so should appear in due course.
For those who are interested Danny and I are presently working on implementing Bayesian t tests in R (Bayes factors with objective priors) in a user-friendly way for researchers.
Baguley, T., & Kaye, W.S. (in press, 2009). Review of Understanding psychology as a science: An introduction to scientific and statistical inference. British Journal of Mathematical & Statistical Psychology.
Dienes, Z. (2008). Understanding Psychology as a Science: An Introduction to Scientific and Statistical Inference. Basingstoke: Palgrave Macmillan.