Programming

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

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

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.

A Draft of ProjectTemplate v0.2-1

I’ve just uploaded a new binary of ProjectTemplate to GitHub. This is a draft version of the next release, v0.2-1, which includes some fairly substantial changes and is backwards incompatible in several ways with previous versions of ProjectTemplate. Foremost of the changes is that most of the logic for load.project() is now built into the […]

The NYC Marathon

The NYC Marathon

New York’s annual marathon took place yesterday. Watching a bit of it on television with my friends, I was struck by the much earlier starting time for women than men. Specifically, professional women started running yesterday at 9:10 AM, while professional men start running at 9:40 AM. (This information comes from the runner’s handbook.) I […]

Promising R Packages

As a quick note, here are two R packages that were mentioned to me recently and that look promising: reldist and mixtools.