# R versus Matlab in Mathematical Psychology

February 20, 2011
By

(This article was first published on Jeromy Anglim's Blog: Psychology and Statistics, and kindly contributed to R-bloggers)

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

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

• Many experienced math psych researchers know a bit of both R and Matlab, butmost 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 similarfunctionality.
• Reasons given for using Matlab:
• Consistency: several researchers commented that functions are highlyconsistent in Matlab, making it easier to return to coding in Matlab aftera 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 totheir graduate students.
• Existing packages and models: it seems like Matlab is well established incognitive psychology where substantial existing code to guide subsequentresearchers.
• University pays: Thus, while R is free, Matlab is effectively free to theacademic if the academic's university has a site licence.
• User friendly IDE: In R it seems that most users pretty quickly start playing around withalternative editors, whether it be ESS, Vim and R, Eclipse, Tinn-R orsomething else. In Matlab, the built-in IDE seemed popular.While these external editors can be configured to create a really powerfuldata analytic environment, Matlab users appreciated having something thatwas productive out-of-the-box.
• Matlab is user friendly for implementing matrix algebra basedcalculations.
• Reasons given for using R:
• Free (as in beer)
• Open source: A few people talked about this. However, I got the sensethat the ideology of open source technology could be encouraged further.
• Sweave: Even amongst Matlab users, there was a respect and interest in theidea of Sweave in R
• R's packages: The sheer number of packages particularly for statistics isone of R's great strengths.
• Superior graphics
• A few people also spoke positively of Python (see this summary of useful Python packages for statisticsby 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 withthe broader community.

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

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

...END RANT...

### Related Posts

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...