Programming

Doing Maximum Likelihood Estimation by Hand in R

Doing Maximum Likelihood Estimation by Hand in R

Lately I’ve been writing maximum likelihood estimation code by hand for some economic models that I’m working with. It’s actually a fairly simple task, so I thought that I would write up the basic approach in case there are readers who haven’t built a generic estimation system before. First, let’s start with a toy example [...]

iBad: The FSF Kool-Aid and Other Dystopian Hallucinations

The people who worry that the iPad will bring about a dystopian future for home computing keep forgetting something: for the rest of humanity, their ideal world of perfectly hackable machines is already a dystopian nightmare. It’s a world in which nothing works without spending hours setting it up, in which basic features are missing [...]

Cleaning Up an iTunes Library with MacRuby

For a little more than a year now, I’ve been meaning to write a script to rename all of the files in my iTunes library so that they’re in proper English title case. In large part, this project was inspired by reading John Gruber’s post about a Perl script that he’d written to convert text [...]

Suggestions for TextMate’s Search and Replace

Like so many other programmers, I adore TextMate. For that reasons, here are two simple features that I’d enjoy seeing in the next version: A case-preserving search and replace tool. If I search for a string like my_class and want to replace it with my_new_class, I’d like my_class to transform into my_new_class at the same [...]

Two of Unison’s Quirks

As many people know, I adore the program Unison. That said, Unison has its fair share of quirks. Today I found myself confronting one that I had spent a whole day confused by about a month ago. Unison stores a cache of information about the file system for every directory that it synchronizes. On Macs, [...]

Updating R Packages Automatically

Here’s a very naive program I just wrote to update all of the R packages I have on my system after I update the core R binary. Please let me know if there’s anything obviously wrong with this, such as failing to update items with chains of dependencies. 1 2 3 4 5 6 7 [...]

iPhone 3.0 and the End of Jott

For me, one of the best features of the upcoming iPhone 3.0 software is the ability to record voice messages for myself. This will totally replace Jott, which I decided a month or two ago to abandon after their recent — and asinine — decision to only offer voice recording to paying customers. When it [...]

Text Processing in R

On a regular basis, I have to process text in R. I invariably find that I need a function whose name or usage I can’t bring to mind. To help my future self, I’m writing this review of R’s built-in text processing functions. Hopefully, this review will also be of use to others. Character Vectors [...]

Efficiency versus Readability

Every programming language — also every programmer — must trade off between writing code that is readable and producing code that executes the absolute minimum number of instructions to perform a task. This is a constant source of potential decisions, because it is almost always possible to make code less understandable while making it more [...]

Yale Courses Online

Yale has updated its impressive set of videotaped lectures. For those interested in automating downloading the videos for any course, the script below should be useful. You’ll need to install the Perl module WWW::Mechanize before you can run the script. You’ll also want to update the list of courses URLs to reflect the courses that [...]