The Psychology of Music and the ‘tuneR’ Package
Introduction This semester I’m TA’ing a course on the Psychology of Music taught by Phil Johnson-Laird. It’s been a great course to teach because (i) so much of the material is new to me and (ii) because the study of the psychology of music brings together so many of the intellectual tools I enjoy, including [...]
Visualizing Periodic Data
Yesterday the Princeton machine learning reading group went through a paper by Tukey on “Some graphic and semigraphic displays”. One issue we talked about at length was Tukey’s idiosyncratic approach to visualizing periodic data in a circular format to emphasize the connections between the “start” and the “end” of the data set. Allison Chaney pointed [...]
ProjectTemplate News
The news below was recently reported on the ProjectTemplate mailing list. For completeness, I’m also reporting it here. The first piece of ProjectTemplate news is that I won’t be the exclusive maintainer for ProjectTemplate anymore. Allen Goodman, who works at BankSimple, is now my co-maintainer and he has full commit privileges. In the next few [...]
Speeding Up MLE Code in R
Recently, I’ve been fitting some models from the behavioral economics literature to choice data. Most of these models amount to non-linear variants of logistic regression in which I want to infer the parameters of a utility function. Because several of these models aren’t widely used, I’ve had to write my own maximum likelihood code to [...]
Problems with ggplot2 0.8.9 and R 2.13.0 on Mac OS X via plyr 1.5
This morning I tried to completely update my R installation. I first dumped a list of all the packages I have on my system using the installed.packages() function. Then I installed R 2.13.0 using the OS X disk image. And finally I reinstalled all of my packages from scratch. Unfortunately, I ran into some serious [...]
A Request for Foursquare Data
[UPDATE 3/28/2011: Fixed an enormous bug in the R code.] I’m trying to collect data sets that showcase how the classical statistical distributions appear in modern contexts. I’ve already got some data that shows how the gamma distribution appears in video game scores, and now I’m hoping to find an example where the exponential distribution [...]
A 3D Version of R’s curve() Function
I like exploring the behavior of functions of a single variable using the curve() function in R. One thing that seems to be missing from R’s base functions is a tool for exploring functions of two variables. I asked for examples of such a function on Twitter today and didn’t get any answers, so I [...]
Canabalt Revisited: Gamma Distributions, Multinomial Distributions and More JAGS Goodness
Introduction Neil Kodner recently got me interested again in analyzing Canabalt scores statistically by writing a great post in which he compared the average scores across iOS devices. Thankfully, Neil’s made his code and data freely available, so I’ve been revising my original analyses using his new data whenever I can find a free minute. [...]
Review of R Graphs Cookbook
The kind people at Packt Publishing recently asked me to review one of their newest R books: the R Graphs Cookbook. In general, I think pretty highly of the book: it provides a nice overview of the basic tools for visualizing data in R. If you’re just getting started with creating graphs in R, this [...]
Useful One-Line for Mac OS X Users
Today I needed to quickly reverse the order of rows in a LaTeX table. This command nicely did the trick: 1 pbpaste | awk ‘{ line[NR] = $0 } END { for (i=NR;i>0;i–) print line[i] }’ I stole the awk piece from here.