Jeromy Anglim's Blog: Psychology and Statistics


Monday, February 21, 2011

R versus Matlab in Mathematical Psychology

I recently attended the 2011 Australasian Mathematical Psychology Conference. This post summarises a few thoughts I had on the use of R, Matlab and other tools in mathematical psychology flowing from discussions with researchers at the conference.

I wanted to get a sense of the software used by researchers in mathematical psychology. What was popular? Why was it popular? From the small-n, non-random sample of conference attendees that I spoke to over coffee and cake, I concluded:

  • Many experienced math psych researchers know a bit of both R and Matlab, but most specialised in one.
  • Matlab seemed to be substantially more popular than R in math psych.
  • The general attitude seemed to be that both tools offered similar functionality.
  • Reasons given for using Matlab:
    • Consistency: several researchers commented that functions are highly consistent in Matlab, making it easier to return to coding in Matlab after a break.
    • Superior built-in documentation: There was a sense that Matlab documentation was more user-friendly.
    • Historical precedent: researchers grew up on Matlab and then taught it to their graduate students.
    • Existing packages and models: it seems like Matlab is well established in cognitive psychology where substantial existing code to guide subsequent researchers.
    • University pays: Thus, while R is free, Matlab is effectively free to the academic if the academic's university has a site licence.
    • User friendly IDE: In R it seems that most users pretty quickly start playing around with alternative editors, whether it be ESS, Vim and R, Eclipse, Tinn-R or something else. In Matlab, the built-in IDE seemed popular. While these external editors can be configured to create a really powerful data analytic environment, Matlab users appreciated having something that was productive out-of-the-box.
    • Matlab is user friendly for implementing matrix algebra based calculations.
  • Reasons given for using R:
    • Free (as in beer)
    • Open source: A few people talked about this. However, I got the sense that the ideology of open source technology could be encouraged further.
    • Sweave: Even amongst Matlab users, there was a respect and interest in the idea of Sweave in R
    • R's packages: The sheer number of packages particularly for statistics is one of R's great strengths.
    • Superior graphics
  • A few people also spoke positively of Python (see this summary of useful Python packages for statistics by Christophe Lalanne.
  • All the above links into general discussion of the relative merits of R, Matlab, and Python on SO.

From my discussions, I saw no need for me to personally switch from R to Matlab. Sweave, graphics, and all the R packages are fantastic. The community around R is also one of its great strengths.

Finally, open source just aligns better with science.

  • Open and freely modifiable source code
  • Freely available psychological measurement tools
  • Freely available data
  • Reproducible research documents using technologies such as Sweave
  • Open-access journals

It all combines to support scientific disciplines in sharing and building knowledge through accountability and trust. This applies both to sharing between researchers as well as communicating with the broader community.

I get a bad feeling when I think of researchers and interested community members who can't afford Matlab being excluded from research.

However, it was interesting to consider how issues like user-friendly documentation, development environments, and consistency could be facilitated in a massive and distributed open source project such as R.

...END RANT...

Related Posts