Chris Blattman

Search
Close this search box.

The solution to bad statistical code isn’t care, it’s standardized practice

After several years of testing other people’s statistical code at the QJPS, Nick Eubank blogs:

I myself once firmly believed the fallacy that the key to preventing errors was “to be more careful.” Indeed, I fear this belief may have colored the tone of of my past work on this subject in unproductive ways. Over the last few years, however, my research has brought me into close contact with computer scientists, and I discovered that computer scientists’ mentality about programming is fundamentally different from the mental model I had been carrying around. Computer scientists assume programmers will make mistakes, and instead of chiding people to “just be careful,” they have developed a battery of practices to address the problem. These practices — often referred to as “defensive programming” — are designed to (a) minimize the probability mistakes occur and (b) maximize the probability that mistakes that do occur are caught.

He suggests a number of basic defensive programming skills: (1) building formal tests into the code; (2) never manually transcribe numbers into your article text; (4) improve your style through indenting, commenting and spacing; and (5) never manually duplicating information. This seems helpful, but I’d like to see the more advanced suggestions too.

There was no point 3, which is either subversive or ironic. There are no cures for fallibility in blogging.

Update: Several readers point me to Matt Gentzkow and Jesse Shapiro’s Code and Data for the Social Sciences: A Practitioner’s Guide.

32 Responses

  1. Wow, these intellectually @#$%#@% people sum up nothing but are able to over emphasize the obvious. You people are frightening. You know Soooo much yet lack , duh. We knew that Common fill know more of what is important in life. You brain kids over analyze everything. You’re trying to run the world when the world was designed to run you. Astro physicist. That one kills me. PH, You can tell us about the CosmoS BUT YOU can’t figure out we need food and clean water, which ch being ruined by scientic research. Maybe u people need to lighten up and live with an Amish community for a month. You idiots will b amazed.OH, OH OH, THIS GUY STUSIES PIOR PEOPLE. STAND IN LINE FOR GOVERMENT FOOD WHEN YOUR DAMNED GRANTS RUN OUT. YOU’LL GET MORE DATA FOR SURE, YOU POMPSES SCHMUCK. I have had to resort to churches kindness to feed my family. U educated just will never know about real people because u r afraid of real people. I’m guessing u wouldn’t last 10 minutes on a bus.

  2. I myself once firmly believed the fallacy that the key to preventing errors was “to be more careful.” Indeed, I fear this belief may have colored the tone of of my past work on this subject in unproductive ways

    golu dolls
    golu dolls

Why We Fight - Book Cover
Subscribe to Blog