The genetic inferiority of stupid people

Sharon sent me Jill Filipovic’s blog post about Stephanie Grace’s “racist email” that seems to be doing the rounds of the angry internet. First of all Stephanie Grace’s email was kind of racist. Not Arizona racist, but it definitely had a racist subtext. She doesn’t state that she believes that African Americans are genetically predisposed to be less intelligent than the rest of the US population, but by raising the suggestion she… raises the suggestion. It’s kind of like me pointing out that Glenn Beck has never provided evidence that he didn’t rape and murder a young girl in 1990.

Personally I think that it’s an entirely reasonable belief that more closely related groups (for example Americans whose ancestors largely originated in the Twi-speaking tribes of West Africa, or Americans whose ancestors originated from small towns in Scandinavia) will share physical traits. We’ve spent the past year travelling the world and people in different places look different. They have significantly different features, often adapted to their environment. If we connect the fact that genes can determine traits and closely related groups of people tend to share genes it’s obvious that closely related people tend to share some traits. I really don’t think that’s a racist concept.

What is racist is attaching moral value to traits associated with groups of people.

I don’t have any reason to believe African Americans are less intelligent than the rest of the population. Any difference in performance at school or income levels or incarceration rates are easily attributable to the class issues that Americans are so afraid of talking about. I think Stephanie Grace’s suggestion that their might be a genetic predisposition to lower than average intelligence among African Americans isn’t a particularly sound or even interesting suggestion, but she didn’t directly suggest that lower intelligence lowers the worth of individuals or groups. That all came from Jill Filipovic. It was Filipovic who used took a discussion of different traits and applied language like “genetically inferior”.

To equate intelligence with value (which is what Jill Filipovic does in her post) is where I have the problem. I’m happy to assume (as Filipovic does) that Stephanie Grace also equates intelligence with value or “superiority” but that’s not what the blog post was about. It was about arguing that intelligence is the key factor in determining the value of a person in society, and in the legal system in particular.

Posted in Default | Tagged , , , | 1 Comment

Antidepressants and the placebo effect

I’m starting to shift the content of the blog beyond simple technical issues. My use of LiveJournal has diminished as everyone elses’ has. I’ll keep posting personal stuff there but more general stuff will end up here.

By Flickr user ~!. Used under A CC license.

Over the past few years I’ve heard rumors of studies that showed a negligible difference between the effectiveness of antidepressants and placebos at treating depression. Now one of the main researchers looking at this, Irving Kirsch, has published a book, The Emperor’s New Drugs: Exploding the Antidepressant Myth, so there’s more press around the question.

While Mark Morford’s take on the issue in SFGate is (as usual) hilarious yet mildly insightful, the Newsweek article it references is where the really interesting information lies.

Basically Kirsch’s research shows that antidepressants have little better than placebo effect for depression (not anxiety, bi-polar or other disorders) in people with mild to moderate symptoms. He based these conclusions on the studies that the drug companies themselves conducted in order to have the drugs approved by the FDA. Initially he used the studies published by the drug companies, but then using freedom of information laws got access to the rest of the studies. Since FDA approval only requires two positive studies (from any number of unsuccessful studies) and statistically significant benefits over placebo treatments it’s fairly straightforward to run a lot of studies and choose the favorable ones when seeking approval.

“By and large,” says Kirsch, “the unpublished studies were those that had failed to show a significant benefit from taking the actual drug.”

In just over half of the published and unpublished studies, he and colleagues reported in 2002, the drug alleviated depression no better than a placebo. “And the extra benefit of antidepressants was even less than we saw when we analyzed only published studies,”

About 82 percent of the response to antidepressants—not the 75 percent he had calculated from examining only published studies—had also been achieved by a dummy pill.

That’s pretty terrible, especially since the frequently significant side effects of antidepressant medication can actually aid their placebo effect:

That matters because belief in the power of a medical treatment can be self-fulfilling (that’s the basis of the placebo effect). The patients who correctly guess that they’re getting the real drug therefore experience a stronger placebo effect than those who get the dummy pill, experience no side effects, and are therefore disappointed. That might account for antidepressants’ slight edge in effectiveness compared with a placebo, an edge that derives not from the drugs’ molecules but from the hopes and expectations that patients in studies feel when they figure out they’re receiving the real drug.

All of this flies in the face of the common understanding of how and why antidepressants work. Our amateur brain chemistry knowledge tells us that serotonin is the chemical that triggers happiness in the brain. Its receptors are what drugs like ecstasy, cocaine and speed target, and the popular SSRI family of antidepressants (such as Celexa, Prozac, Paxil and Zoloft) act to keep brain serotonin levels higher than they would otherwise be, “fixing the chemical imbalance”. But between research that dismisses those effects (and suggests other theories for the effectiveness of SSRIs) and evidence that SSREs (which reduce serotonin levels) are also effective as antidepressants it seems like the science to explain the actions of antidepressants is at best really weak.

The other side of this story is that antidepressants help people. I have plenty of friends who’ve had their lives significantly improved when they began taking antidepressant medication. Are they just getting a placebo effect? Does it matter if they are?

Well, the side effects of SSRIs can be fairly severe. And they’re quite expensive – Prozac is $12 per dose (or $1.40 in generic). But the problem with prescribing sugar pills is that they’re only effective when patients believe them to be an expensive, dangerous drug. I’d personally prefer for people with mild forms of depression to receive non-drug therapy initially (as the NHS in the UK now recommends). If 80% of patients aren’t getting a chemical effect, but a psychological (placebo) effect then we should be able to help them equivalently with other non-chemical methods like therapy. Of course, even at $12 a pill, using antidepressants for their placebo effect is probably cheaper than using trained therapists.

Go read the Newsweek article. It’s really good!

Posted in Default | Tagged , , | 4 Comments

Travel Tips

The wife and I have been travelling for the past year or so on a fourteen month trip around the world. I was just reading Nat Friedman’s travel tips so I was inspired to add a few of my own more back-packer-y tips.

  1. For long trips use small bags within your luggage. We used Eagle Creek Pack-It Cubes. It makes it so much easier to keep your luggage organized as you move about. Repacking becomes a 30 second effort.
  2. For power bring a single adapter (I’ve been using a universal adapter similar to this one) and then a multi-adapter from your home country. I picked up a tiny triple adapter like this one. That way I can charge two computers and a phone with a single (often scarce) wall outlet and a single adapter.
  3. An unlocked GSM phone plus a cheap local SIM card is really handy if you’re going to be in  a country for more than a week or so. You can buy a low-end Nokia that can still browse the web (poorly, but enough to check your email) for about US$30. We put our temporary numbers on Facebook so that friends and family could call us, but mostly we needed phones to call ahead to hostels and locals. Also, if you’re used to paying for phone service in North America you’ll be pleasantly amazed by how cheap it is in much of the world.
  4. If you have to pay for wifi, but have two computers then an ethernet cable plus internet sharing halves your costs. NetworkManager does the internet sharing stuff trivially, I’ve rarely gotten it to work through Windows and MacOS though.
  5. AirCrack-NG is your friend. Learn its quirks. Use it wisely. The documentation that comes in the Debian / Ubuntu package probably isn’t quite enough to get it working so you should practice somewhere where you already have access to the Internet.
  6. A travel clothesline can be invaluable in extending the length of your wardrobe. Pick up some hand laundry soap and you’ll be able to wash shirts, socks and underwear pretty easily. We found larger things like jeans harder to wash in hostel sinks, but if you can visit a laundromat a couple of time a month and wash the rest of your stuff a couple of times a week in your hotel or hostel you’ll have more time and money for fun while not turning into a completely stinky hippie.
Posted in Default | Tagged | 3 Comments

Detecting advanced CSS features

I decided to do some fancy typography in my résumé, but I wanted to have a sane fallback for browsers that don’t support the latest features. I have my name rotated 90 degrees using CSS3 transforms, but simply applying the transform: rotate(-90deg) CSS property isn’t enough to get the effect I want. To make it look right I also need to measure the text (since its dimensions will change depending on the viewer’s fonts) and absolutely position it based on that. Standard CSS fallback (where unrecognized rules are ignored) doesn’t give a good result. At all.

After a bunch of fiddling and cross-browser testing I found that testing the existence (!==undefined) of properties on element.style worked well. So I put all of my rotation rules in a CSS class that’s applied only if the style properties exist.

<style type="text/css">
  h1.rotated {
    -webkit-transform-origin: left bottom;
    -moz-transform-origin: left bottom;
    -o-transform-origin: left bottom;
    transform-origin: left bottom;

    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
    transform: rotate(-90deg);

    position: absolute;
    left: 0px;
    top: 0px;
    margin-top: 16px;
  }
</style>
<script type="text/javascript">
    // rotate the title, if that's even possible
    var h1 = document.getElementsByTagName('h1')[0];
    var s = document.body.style;

    // test for the presence of CSS3 transform properties
    if (s.transform !== undefined ||
        s.WebkitTransform !== undefined ||
        s.MozTransform !== undefined ||
        s.OTransform !== undefined) {
      // move
      h1.setAttribute('style',
          'top:' + ( h1.offsetWidth - h1.offsetHeight) + 'px');
      // and rotate
      h1.setAttribute('class', 'rotated');
    }
</script>

Of course, if I could just check for transform: support rather than -webkit-transform:, -moz-transform: and -o-transform: but we’re not there yet. Anyway, based on browsershots.org it seems to do the right thing on every known browser. It shows rotated text in very recent Webkit and Gecko browsers, and in Opera nightlies, and unrotated, correctly text everywhere else.

Posted in Default | Tagged , , , , , , , , , | 2 Comments

Implementing Information Retrieval Systems

I believe that it’s valuable to implement software components that you use from scratch merely to gain a better understanding of the systems you use. I’ve never implemented an operating system from scratch or designed and implemented a programming language like many of my friends but I’d really like to one day. Part of the problem is that looking at a large, complicated, system from the outside is intimidating.

A couple of years ago I spent many months working with CLucene, the C++ port of the Lucene IR (full text search). Both CLucene and Lucene are huge, complicated and often appear to be buggy. While learning about the Lucenes I did a bunch of reading about full text search theory. It never seemed that complicated, but all of the implementations I came across clearly were.

A basic full text search engine works like this:

  • collect all of the words in the input documents
  • simplify the words so that similar ones are the same, so I can search for “look” and get “looked”, “looking” and “looker”
  • organize the words in a special tree data structure called a trie that lets you look up the words in linear time, the leaves of the trie for each word indicate which documents it’s present in
  • to search for a word you walk the trie and get the list of documents

Yesterday I spent a couple of hours walking (Tel Aviv public transport was failing me) and I worked through most of how to implement this in my head. I also thought about how to implement phrase matching. I’m not really sure how phrase matching works in other systems (like I said, they’re too complicated for me to understand easily) but I represent each instance of a word in a document and then link from one instance to the instance of the next word in the document. That way after walking down the trie to find the first word in the phrase I can walk along each word in the phrase, comparing it to the next word in the document.

Last night I implemented it in Python. I called it Tripe and it’s less than 250 lines of Python. It doesn’t have a stemmer worth talking about and it’s pretty space inefficient but it seems to generally work. There’s a library file called tripe.py and then some test utilities: tripe_add.py (add documents), tripe_search.py (search the index), tripe_dot.py (visualize the index with Graphviz). Take a look:

% echo "The cat sat on the mat." | ./tripe_add.py test.tripe 1
% ./tripe_dot.py test.tripe|dot -Tpng -o test1.png

% echo "The quick brown fox..." | ./tripe_add.py test.tripe 2
% ./tripe_dot.py test.tripe|dot -Tpng -o test2.png

% echo "There is a light that never goes out." | ./tripe_add.py test.tripe 3
% ./tripe_dot.py test.tripe|dot -Tpng -o test3.png

% ./tripe_search.py test.tripe the
matched in document 1 at 15
matched in document 1 at 0
matched in document 2 at 0
% ./tripe_search.py test.tripe cat
matched in document 1 at 4

I first implemented this as a tree in memory, but I found that implementing persistent storage was really easy too. I’ve always been hesitant to implement structured binary file formats, and I know that efficient implementation can be really complicated, but a naive implementation like I did was relatively straight-forward.

So now what? There are already a bunch of full-text search engines out there, but they all seem relatively complicated. I wonder if it’s worth tidying up what I have, extending it enough to be useful for site search applications and publishing it. In the meantime it’s on github.

Posted in Default | Tagged , , , , | 7 Comments

Flipy, a new Python library for Flickr

In the past day or so I’ve written a new Python library for Flickr. It came from some frustration using other Python libraries. They’re all great, but none of them work quite how I want.

My goal was to have a library that feels like Python and the Flickr API at the same time. I think it’s worked out pretty well so far. You can make calls using the standard Flickr API calls as documented on the Flickr site, but the response objects feel like normal Python objects. For example you can do something like this:

from flipy import Flipy
flickr = Flipy(MY_API_KEY)
me = flickr.people.findByUsername(username='ianloic')
me_info = flickr.people.getInfo(user_id=me.nsid)
print 'My name is %s. I have %s photos at %s.' % (me_info.realname, me_info.photos.count, me_info.photosurl)

I’ve put more details about the mapping in the README.

Beyond simple mapping of methods to responses I’m working on decorating certain important response objects such as users and photos with more object oriented methods. For example right now if you have a user object you can call user.photos() and get a iterator for of a user’s photos. My code takes care of all of the paging behind the scenes.

Since I haven’t implemented authentication or uploading yet so right now it’s mostly useful for simple mashup-style applications, but I’ll get uploads and authentication complete when I get back from Jordan next week.

Check out the code on github and let me know what you think.

Posted in Default | Tagged , , | 2 Comments

Give me convenience

I used to track WordPress updates, plugin updates and my own manual site changes using git. I wrote a whole post about it. Either fortunately or unfortunately WordPress launched their update framework which is so much easier than what I was doing. I’ve given up on my old technique and moved to using WordPress’ update mechanisms.

Of course what I really want is to be able to white a WordPress plugin that is notified any time an update occurs or a file update completes so that I can automatically track site changes in a SCM, but I don’t think that’s easy right now.

Posted in Default | Tagged , , | 1 Comment

jQuery selector escaping

jQuery selectors are powerful and simple to use, until you have attribute
values (including ids and classes) that have funny characters. I wrote a plugin
adds a simple function $.escape that will escape any special characters.
For example if I have a string s that contains an id but I’m not sure that
all of the characters are safe I can use $('#'+$.escape(s)) to find the
element with that id. If I want to find all of the links to
http://ianloic.com/ I can do $('a[href='+$.escape('http://ianloic.com/')+']')

The first release is here. I don’t know that there will be any more releases – this is a pretty damn simple plugin.

Posted in Default | Tagged , , | 6 Comments

A brighter future for mobile applications?

Since the Chrome OS announcement the other day I’ve been thinking more about what a world with rich enough web APIs to support all general purpose applications might look like. I’m not sure that it’ll happen, but it sounds like Google is putting their weight behind it and they’ve been successful in the past at moving our industry in new directions (remember the world before GMail and Google Maps?).

A richer set of standard web APIs might form the basis for a cross-manufacturer mobile platform. The Palm WebOS stack already kind of looks like Chrome OS (though with local HTML+JS apps rather than remote ones) and the original iPhone application model was exactly what Chrome OS proposes. The limitations that forced Apple to create a native developer platform are exactly the ones that Chrome OS plans to address.

Of course Google’s own mobile platform is decidedly non-web and Apple’s much larger volume of applications discourage it from supporting standard APIs. The handset manufacturers, OS developers and carriers are all making a ton of money selling applications in a model that’s reminiscent of pre-web software models. The only real winners from a move to a web model for mobile applications would be the users.

Posted in Default | Tagged , , , , , , , | Leave a comment

Users’ names and usernames

A few years ago my friend Jack built a cute little application. It was a text message multiplexer. You could send it a text message and it would send that message to all of your friends. You signed up using your phone number and gave it your name. It was somewhere between addictive and annoying but completely social, since basically all of the users were our friends. We mostly used it as a free-form Dodgeball, to work out when friends were out at bars and inevitably they added the ability to send a message directly to a contact. There were no usernames so twttr would cleverly work out who you meant based on the first name you supplied and your contacts list. This never worked right, they added usernames and now I’m @ian. Unfortunately then the whole @reply thing happened and people do just use their friends first names. Look at how many people use @ian – most of them are not talking to me, but other Ians.

Facebook resisted giving people anything other than a free-form name and a numeric user ID for the longest time. They finally gave in and let people pick vanity URLs but still refuse to make that URL useful for anything but getting to your profile. When they added @ support they pop up UI to autocomplete friends names from your contacts list. It works really well, but it depends on a rich message composition UI, something that’s not possible on the simple mobile devices that twitter was targeting.

I wonder how the next site will approach this.

Posted in Default | Tagged , | Leave a comment