Why I'm not super-enthusiastic about humane meat

The argument from marginal cases asks us to consider a child with a severe mental handicap. They are able to do simple physical tasks like feed themselves and move around, but unable to communicate beyond basic grunts.

What, the argument asks, is the difference between this child and, say, a cow? There are of course many superficial distinctions, but it's hard to find some difference which could plausibly be considered relevant. And of course if some distinction were found (maybe our hypothetical child has a stronger sense of self), we can simply change our theoretical mental handicap appropriately.

Peter Singer made this argument famous, and in On Being Silenced In Germany he talks about how it makes him uniquely vulnerable to misquotation. He'll have some line like "so we should consider severely mentally handicapped people roughly morally equivalent to pigs" and his opponents will gleefully describe how Prof. Singer wants to raise mentally handicapped children in factory farms and torture them to death so we can eat their sweet, sweet flesh.1

Of course even a quick glance at Singer's Wikipedia page will make it obvious that he means the reverse: we should treat pigs with much more respect than we currently do. But it's at least a philosophically interesting question: why shouldn't we be free to kill mentally handicapped people?


While reading Nicollette Niman's article claiming that "humane" meat is ethical and the associated responses the article generated, it seems like the argument from marginal cases - which acted like a bombshell in my life - has had little impact on most people.

Most of the article is unremarkable; it solidly hits the three N's of meat eating (it's natural, necessary, and normal), but I suspect that a more careful reworking of her essay could remove some of the more ridiculous claims while still keeping the core message: "it is ethically defensible [to eat meat] -- provided we refrain from causing gratuitous suffering."

Maybe there isn't anything wrong with killing animals for food. Given that we're killing tens of billions of them per year, I desperately hope there's nothing wrong with it. But then why would there be anything wrong with killing the mentally disabled?

  1. Apparently A Modest Proposal is not required reading in German schools.

A Simple Proof: Why you will never see an eight sided snowflake

Suppose you take a bunch of equally-sized marbles and squish them from all sides. You'll get one of two shapes:

These configurations are referred to as "rectangular" and "hexagonal":

Certain crystals have a molecular structure similar to these patterns, which is reflected in their macroscopic structure:

Halite, a rectangular crystal, and quartz, a hexagonal crystal.

A theorem known as the crystallography restriction states that hexagonal symmetry is the most that any crystal can hope to have - you will never see an eight-sided snowflake.

Formalizing a crystal

This theorem involves only basic trigonometry, but it does require us to most formally state what we mean by a "crystal". (If you know some basic linear algebra, most of this won't be a surprise to you.) The concept we're looking for is a discrete lattice, which has two relevant properties:

  1. Every two points are some finite distance apart (i.e. points aren't infinitely close together).
  2. The structure repeats along some line, meaning that you can slide the entire thing some finite distance along that line and get back what you started with. Another way of describing this is like an abstract version of addition. Basically, draw two lines which both start and end in the center of some circles. When you place the lines end to end, the last one will still be in the center of some circle. (So "adding" two lines together gets a valid third line.)

The blue line and the red line can be "added" together to create the valid green line.

Lastly, we need some way of describing what exactly we mean by having a "six-sided" crystal. Just like we can describe "sliding" repetition with addition of lines, we can describe rotational symmetry with rotations of lines.

The blue line can be rotated to create the valid green line.

Down to earth

As a warm up to our theorem that 6 is the most sides that a crystal can have, let's prove that no crystal has 5 sides.

Suppose we have something with five sides (i.e. a pentagon). If it were a lattice, we could add any two lines together to get a third line. So let's bring the yellow line down as the red one, and add it to the blue one. But this doesn't terminate on a point. So we can't add any two lines together, meaning it can't be a lattice. QED.

The general case is only somewhat more complex. Start with the yellow line, then rotate it by some angle θ to get the blue line. Subtract the yellow line from the blue line to get the green line. If θ is less than 360/6, the green line will be shorter than the yellow line.

We stated in our definition of "discrete lattice" above that every two points must be some finite distance D apart from each other. Phrased differently, every line must have a length of at least D. But we showed above that, if a rotation by θ is legal, we can get smaller and smaller lines - eventually we will get one smaller than D, causing a contradiction.

Therefore, any lattice must not have a rotation smaller than 60 degrees. QED.

So if anyone tries shows you an octagonal snowflake this holiday season, either they're lying, or they violated the laws of math to make an xmas miracle.

Appendix

I didn't really prove that the green line would be smaller. It's not too long, but it's not terribly interesting, so I'll just leave a link to wikipedia.

Update: I was worried that this would make the post too long, but here's a proof that the green line will be shorter. Starting from O, draw some line out to A. We only care about if the line gets shorter, not its absolute length, so let's just assume that the line $\overline{OA}$ has length one. Rotate $\overline{OA}$ to find point $B$, and subtract $\overline{OB}-\overline{OA}$ to get $C$. Since $\overline{BC}$ and $\overline{OA}$ are parallel, the angles $\angle AOB$ and $\angle OBC$ are equal. By the law of cosines, $\overline{OC}$ has length $\overline{OB}^2 + \overline{BC}^2 - 2 \overline{OB}\cdot\overline{BC}\cdot\cos\theta$. Recalling that $\overline{OA}=\overline{OB}=\overline{BC}=1$, we get that $\overline{OC}=2-2\cos\theta$. If $\theta\lt 60^{\circ}$, then this value will be less than one, meaning that $\overline{OC}\lt\overline{OA}$. So $\theta\geq 60^{\circ}$. QED.

The ugly pictures were created by me. The good-looking pictures courtesy of Wikimedia.

You might also like

Using Modular Arithmetic to Improve Card Games

There was recently a discussion on patterns in modular arithmetic, in which the author showed some interesting pictures that result from plotting various functions. They introduced modular arithmetic by the standard appeal to time (an example wikipedia follows too) including the awesome fact that Japan uses neither a 12 nor a 24-hour clock - they will talk about things occurring at 28 o'clock (four AM tomorrow).

I get tired of hearing the same examples as common applications of modular arithmetic, so here's my contribution.

The basic point is that, for some applications, discreteness matters. If you want to divide up $5 among 3 people, and you are writing checks, you can just give each of them a fractional dollar amount. Problems only occur if you have 5 $1 bills and you can't make change.

A common example of this is card games - you frequently want to deal an equal number of cards to everyone and you can't exactly rip a card in half to make it work. Our standard deck has an abysmal 52 = 2*2*13 cards, which means that it's evenly divisible among 2, 4 or 13 players, resulting in our inability to play Hearts with 3 or 5 players.

What you really want is a number with a lot of prime factors, an idea roughly captured by the number's abundance. If our deck had 60 = 2*2*3*5 cards, we could play hearts with two, three, four, five or six players.


This idea occurred to me while playing Clue (apparently known as "Cluedo" outside the US). The game involves taking three cards out of the deck and then dividing the rest among the players. It supports 3-6 players, so finding the optimal number of cards involves finding a number that:

  1. Has a remainder of three when divided by 3
  2. Has a remainder of three when divided by 4
  3. Has a remainder of three when divided by 5
  4. And has a remainder of three when divided by 6

The solution to this problem can be found using the Chinese remainder theorem which, like all theorems discovered by people with foreign-sounding names, is titled after the discoverer's country (cf. Polish notation). It turns out that the first two solutions are 3 and 63 cards, which would make for either a really short or a really long game of Clue[do].

According to Wikipedia, the original design of the game called for 29 cards which leaves 26 after removing the three to hide in the envelope. The astute reader will see that 26 = 13 * 2, meaning the game could only work correctly if there were two or thirteen players!

Parker Brothers revamped the game to have 21 cards total, leaving 18 to divide among the players. This works out perfectly for three and six players, but leaves a couple extra cards when four or five people play. An improvement to be sure, but better options include 15 and 27 cards, both of which fail to divide in only one case.


Anyway, these are a couple examples of why we you might find the integers interesting. Of course there are many more (virtually every form of modern cryptography springs to mind) but hopefully these are some easy to understand instances.

Angle trisection for dummies

Continuing my line of posts explaining complex proofs by skipping the hard part, this post gives a proof that certain angles cannot be trisected. Terry Tau recently had a post on the same subject, which contained a very long proof using only basic geometry and a very short proof using Galois theory. The proof I use here is between the two he presents in both difficulty and length. It's a remarkable proof in that there's very little geometry per se, most of the proof would usually be classified as algebra.

As a crash course on what we mean to say an angle can be trisected: We start by assuming you have a line of length one, a ruler and a compass. A number $n$ is "constructible" if, starting with these things, you can construct a line of length $n$. It's simple to see that if $a$ and $b$ are constructible, then $a+b$ is as well (just stick the two lines together). This means we can repeatedly add 1 to itself to generate all the natural numbers.

It's also possible to construct $ab$ and $a/b$, although this piece is harder to show. To start things off on the trisection proof, let's place a limit on what numbers can be constructed:

Lemma 1: All constructible numbers are the solution to either a linear or quadratic equation with constructible coefficients

To construct some points we can either:

  1. Draw two lines and find their intersection
  2. Draw a line and a circle, and find their intersection
  3. Draw two circles, and find their intersection

The intersection will always be a solution to an equation of degree at most two. For example, if we have the lines $y=m_1 x + b_1$ and $y = m_2 x + b_2$ their intersection has x coordinate $m_1 x + b_1= m_2 x + b_2$ or $(m_1 - m_2) x + (b_1 - b_2)=0$, so $x$ is the solution to a linear equation with both coefficients constructible.

In cases 2 and 3, the x and y coordinates will be solutions to quadratics.

Lemma 2: The only constructible points are solutions to equations of degree $2^n$ for some integer $n$

For example, we could find the point which satisfies $x^2-2=0$ which is $x=\sqrt{2}$. Now that we can construct $\sqrt{2}$, so we can use it in our equation; for example we can find $x=\sqrt[4]{2}$ by solving $x^2-\sqrt{2}=0$.

We can repeat this process to find the eigth root, sixteenth root etc. but we can only find roots that are powers of two. More generally, we can only construct equations of degree two; their coefficients might themselves be solutions to quadratics so we have an equation of degree 4 over our original set, but we can never create an equation of degree 3 or 5 or 379.

Lemma 3: If an angle $\theta$ is constructible, then $\cos\theta$ is constructible.

$\cos\theta$ represents the adjacent side of a right triangle with hypotenuse 1 and adjacent angle $\theta$; since we can draw a line of length 1 we can use that as a hypotenuse, and if we could draw the angle $\theta$ we can construct the entire triangle.

Proposition: $\cos 20^\circ$ is not constructible

Once we've proven this, we'll have proven that $20^\circ$ is not constructible, and so an angle of $60^\circ$ cannot be trisected.

I'm sure you all remember the triple angle formula $\cos 3\theta = 4 \cos ^3\theta-3\cos\theta$, plugging in $\cos 60=1/2$ and rearranging we get that $4\cos ^3\theta - 3\cos\theta - 1/2 = 0$; to make it more obvious I'll substitute $x$ for $\cos\theta$: $4x^3 - 3x - 1/2 = 0$. So $x$ is the solution to this cubic equation, but Lemma 1 told us that constructible points are only solutions to equations of degree $2^n$. So $x$ is not constructible. QED.

Undecidability for dummies

It's been my experience that many important "complex" theorems are complicated in only one or two parts. Oftentimes, if you're willing to accept a lemma or two without proof, you can understand the entire thing. So this is a post explaining what I think is a fairly complicated topic, but there is a piece I don't try to prove. I hope the result is something that's understandable to anyone with a little programming experience.

One of the things which fascinates me most are "incompleteness" theorems. I understand how we can look at some individual solution and determine that it doesn't solve some problem, but the proof that no solutions exist seems a lot harder.

A foundational result in theoretical computer science is the undecidability of the halting problem. This states that, given some program P, there is no general way to tell if P will run forever or if it will eventually stop. For example, the following program:

for each integer x:
	if x + 1 = x, then halt
	else go on to the next integer

will run forever, because there's not integer which is the same as itself with one added to it. This program:

for each integer x:
	if x + 0 = x, then halt
	else go on to the next integer

will halt immediately.

So how can we prove that there is no general method to tell whether a program will halt? It's a proof by contradiction: suppose we have some method, let's say M, of telling if a program will halt. Consider the following program:

if M says *this program* will halt, then run forever
else if M says this program will run forever, then halt

For any method M, it will fail to correctly predict the behavior of our program. So for any method M, there must be at least one program whose behavior it fails to predict, which proves our theorem.


When I first learned this, I felt (and to a certain extent still feel) that it was kind of a cheap trick. In retrospect, I think this was due to the program's ability to refer to itself. This is the complexity that I left out of the post, but the basic idea isn't that hard: we can assign a natural number to every program (i.e. there's a "first" program, a second program, ...). Once we've done that, a program "referring to itself" can be accomplished via these numbers, e.g. program 12345 referring to program 12345.

One simple yet important extension to the halting problem is Rice's Theorem, which basically says that you can never prove anything about a program. Want to prove that your program won't crash? Tough. Someone asks you to prove your algorithm always gives the right answer? No can do.

If you're interested, you can see a list of undecidable problems, the most famous of which is Hilbert's tenth.

E[Impact]

Robin Hanson talks about how economists signal:

Economists like to point out there’s almost no chance that your vote is going to determine an election. So one of the things an economists like to do to show off that they’re clever economists is to not vote and to say to everybody, hey I’m smarter than all the rest of you! See, I understand that by voting, it’s not going to make any difference, anyway.

I'll trust his analysis that, psychologically, not voting is the economist version of a peacock's tail. But the more interesting question is: are these economists right? Is voting a bad idea?

It's hard to make a consequentialist case for voting in elections, but a related concept - voting with your dollars - doesn't fall victim to the same trap.

Suppose a large chicken producer like Tyson hires farmers to grow as many chickens this year as it sold last year. So if they sold 50k chickens last year, they'll buy 50k chickens to resell this year. Because they are a big company, they only track these numbers to the nearest thousand. So 999 times out of a thousand, your purchases don't even show up on Tyson's radar.

The vast majority of the time, your purchases won't affect anything. So there can't be any moral imperative to not eat chicken, since it will almost certainly have no impact, right?

The problem is: sure, there's only a one in a thousand chance that you'll impact Tyson's chicken production. But if you do have an impact, you'll lower their production by a thousand chickens.

Your expected impact is the likelihood you make any change, multiplied by size of that change. If you have a 1/1000 chance of making an impact, and you impact their production by 1000 chickens, then your expected impact is 1/1000 * 1000 = 1. The same goes for if your odds are one in two or one in a billion - your expected impact is always 1.

So stay home from the polls next November if that will get you into the cool kid crowd in the economics department. But make sure you stay home with a vegan dinner.

Divisible by 3

You probably know the rule of thumb to check if a number is divisible by three: add the digits and see if that number is divisible by three. E.g. 3627 is divisible by three since 3+6+2+7=18, which is divisible by three.

Here is a short proof of this, as well as some extensions. Note that $3627=3*10^3+6*10^2+2*10+7$; if we consider $p(x)=3x^3+6x^2+2x+7$, then $3627=p(10)$. Finding the sum of the digits is equivalent to finding $p(1)$. Our claim is that $p(10)$ is divisible by three if and only if $p(1)$ is divisble by three.

A more general theorem holds, in fact: if $a\equiv b \bmod m$ then $p(a)\equiv p(b) \bmod m$ for any polynomial $p$. A colloquial phrasing is "if a and b have the same remainder after dividing by m, then $p(a)$ and $p(b)$ have the same remainder after dividing by m." In our case, we're just interested in the case where the remainder is zero. The proof of this follows directly from the properties of modular arithmetic, so I won't bore you with it.

Using this theorem, we find that $10\equiv 1 \bmod 3$, so $p(10)\equiv p(1) \bmod 3$, just like we wanted. Note that $10\equiv 1\bmod 9$ as well, so the same "add up the digits" shortcut works with division by 9.

We can extend this to more complicated shortcuts. You might know the trick for divisibility by 11: alternately add and subtract the digits. For example, $1-2+1=0$ so $121$ is divisible by 11.

This is just another instance of our theorem. Since $10\equiv -1 \bmod 11$, $p(10)\equiv p(-1)\bmod 11$ and $p(-1)$ is just alternately adding and subtracting the digits.

Wikipedia has an extensive list of divisibility "shortcuts", some of which seem more complex than just doing long division, but hopefully this illuminates the reasoning behind some of them.

The Meta-Diet: Was Pollan Right?

Michael Pollan wrote a very popular book which made the claim that there are only three imperatives about diets that we can know with any certainty:

  1. Eat Food: That is, avoid processed foods.
  2. Not too much: limit calories.
  3. Mostly plants. This one's pretty self explanatory.

Not that I don't trust Pollan and all, but I would've like to see a survey of nutritionists or something which would indicate that people who have formal training in the subject agree with him. Fortunately for us, US News and World Report surveyed a bunch of nutritionists and had them rank various diets. From this ranking, I tried to divine how nutritionists feel about his three commandments. The results:

DietOverall RankNo processedLimit caloriesLimit meat
DASH1YYY
Mediterranean2YYY
TLC2YYY
Weight Watchers2YYY
Mayo Clinic5YYY
Volumetrics5YY
Jenny Craig7YY
Ornish8YY
Vegetarian9YY
Slim Fast10YY
Nutrisystem11YY
Vegan12YY
South Beach13YYY
Eco Atkins14YYY
Zone14YYY
Glycemic Index16
Medifast16YY
Raw food18YYY
Atkins19Y
Paleo20Y
Methodology

For the most part, I just read the descriptions of each diet. The most controversial thing I did was including "collateral damage" - e.g. I said that the vegan diet is calorie-restricted since the dietitians said that vegans eat fewer calories. I think this is a better way to go about it, since we want to find out the nutritionist's opinions about these commandments, not about how some diet theoretically could be followed. If a diet had less than 1,500 calories per day for the average person, I considered it calorie-restricted.

In the ranks of "collateral damage" I also included a "low sodium" requirement as a restriction on processed foods. Four diets (Slim Fast, Nutrisystem, Zone, Medifast) limit saturated fat (i.e. their limit is significantly below the recommended daily max) so I considered these as having restrictions on meat, since a saturated fat restriction usually (but not always) results in eating less meat.

My notes and sources that weren't within the USN pages can be found here.

Discussion

I'd say Pollan's rules hold up pretty damn well. The top 5 diets all follow all three of them, and the most anti-Pollan diets are ranked 16th, 19th and 20th.

It seems like the no-processed-food rule is the least followed, but I think that's just because the rankings include a number of companies whose sole mission is to sell processed foods.

I wish they had included a "control" or "do nothing" diet to tell whether any of these diets are actually harmful, or whether the bottom of the list is good but not great. Here's what they said about the worst diet:

Experts took issue with the Paleo diet on every measure. Regardless of what a dieter's goal is—weight loss, heart health, or finding a diet that's easy to follow—most experts concluded he or she is better off looking elsewhere.

Does "elsewhere" include "not going on a diet"? I don't know, but if it does this might be a mark against Pollan, since the paleo diet excludes processed foods. (An alternative explanation: since the paleo diet tends to be meat-heavy, maybe the "mostly plants" maxim is stronger than the "eat food" one.)

Quantification

I scored the diets 0-3 on how many of the rules they followed and tested how well this score correlated with their ranks. Because there are a lot of ties, I used the Pearson product-moment metric. This yielded a correlation of -.52, significant at p=0.018. So it appears unlikely that the relationship between rank and extent to which they follow Pollan's criteria is random chance. However, the relationship isn't incredibly strong.

Kendall's tau and Spearman's rho tests were significant at p=.035 and .033 respectively, but keep in mind that ties are excluded, and there are lots of ties.

Conclusions

Go ahead: eat food, not too much, mostly plants.

A clever proof of Euler's Theorem

I've been learning abstract algebra for the last six months or so - and I have learned a lot - yet I get the distinct impression that if Euclid were to appear before me and demand to know why he should care about groups or rings or what have you I wouldn't have much to say. So I was happy to learn of a simple proof of Euler's theorem, which relies solely on Lagrange's theorem, a basic result of group theory.

Euler's theorem deals with $\phi$, the Euler totient function, where $\phi(n)$ is the number of integers less than $n$ that are coprime to $n$. For example, $\phi(6)=2$, since 1 and 5 are the only integers less than 6 that are coprime to 6. If $p$ is prime, $\phi(p)=p-1$ since every number less than $p$ is relatively prime to $p$.

Upon first hearing about this function, I thought it was too insanely complex to know anything about. How the hell should I know what $\phi(n)$ is? There's no easy formula. But it turns out that we can prove the following theorem quite easily:

Euler's theorem: Suppose $a,n$ are coprime. Then $a^{\phi(n)}\equiv 1 \pmod{n}$.

Note that, since $\phi(p)=p-1$, this is just a generalization of Fermat's little theorem. Here's a three-step proof:

  1. An integer $a$ is invertible modulo $n$ if and only if $gcd(a,n)=1$ ("invertible" means there's some $a^{-1}$ such that $aa^{-1}\equiv 1 \bmod n$). This is the Linear Congruence Theorem.
  2. Consider the group $G$ of all positive integers less than $n$ which are invertible modulo $n$ (formally, $G=\left(\mathbb{Z}/n\mathbb{Z}\right)^{\times}$). $\phi(n)$ simply counts the number of positive integers $a$ where $gcd(a,n)=1$, so by (1) there are $\phi(n)$ elements in $G$ (the order of $G$ is $\phi(n)$). You can satisfy yourself that $G$ follows the group axioms quickly.
  3. Lagrange's theorem says that there must be some $k$ such that $a^k=1$ where $k$ divides the order of the group, namely $\phi(n)$; let's say $km=\phi(n)$. Then $a^{\phi(n)}=a^{km}=\left(a^k\right)^m=1^m=1$ which proves our theorem!

Isn't that cool? I went from thinking that $\phi$ was an impossibly complex function to knowing a foundational result about it within 5 minutes, all because of what seemed like an esoteric result in group theory. 90% of this short post is explaining the terms, the proof itself is only a paragraph!

Does Peta Kill Animals?

There is a site run by the Center for Consumer Freedom called Peta Kills Animals which states that peta kills a large fraction of the animals surrendered to its shelters. You may remember CCF as the group organized by big tobacco to convince us that cigarettes were safe. They don't have the strongest adherence to the truth.

Let's take the first number on their website. They say in 2010, peta received 2,345 animals. They even have a Skeptical? Click here to see the proof! link. Being skeptical, I clicked there to see the proof. And wouldn't you know it, on the very first damn page, the numbers were different - peta actually took in 4,569 animals.

CCF has a dagger saying they removed spay/neuter animals from their total. Redoing some math, it seems like they removed the animals surrendered by their owners. To put it mildly, not all animals surrendered by their owners are there to get spayed or neutered. Of the 2,243 animals surrendered by their owners, only 7 were reclaimed.

So either Virginians are really confused about what "neutering" means, or the CCF is being a little misleading.

On the front page, the CCF says "During all of 2010, PETA found adoptive homes for just 44 pets." If you click the "skeptical" link, you can see that in 2010 peta actually found adoptive homes for 838 animals. I have no clue how they got from 838 to 44 - divide by 20 then round up?

The moral of the story? Don't believe everything you read. And if someone cites a source, actually look at the source. Especially if the citer is the Center for Consumer Freedom.

Why do people care about meat?

I've been working on a project to attempt to quantify the best way to reach people involving the use of animals in agriculture. I'd like to share some preliminary results here, in the hope that it will inform your pamphleteering, questions or just plain curiosity.

One interesting datum is to ask what the most popular stories on social news sites involving meat production/consumption are. Here are the 9 most highly voted stories regarding this on Reddit in the last few months (see Methodology section below for remarks on how this, and all other data, was collected):

  1. If a new Minnesota bill becomes law, anyone caught going undercover to film or record animal abuses at a factory farm could be sentenced to five years in jail.
  2. Costco announces that it won't carry pork from farm that abuses pigs
  3. The single state of North Carolina uses more antibiotics for livestock than the entire United States uses for humans.
  4. Breaking undercover investigation - an inside look into the nation's fourth largest pig factory farm. Pork from these abused animals is being sold by grocery giants Kroger, Costco, Safeway, and Hy-Vee.
  5. Tyson caught bribing meat inspectors
  6. Today's Onion: Just eat a goddamn vegetable
  7. TIL that India has more Vegetarians than there are people in the United States, and that the majority of others rarely eat meat anyway
  8. Factory Farming Is Manufacturing Superbugs -- and Endangering Us All
  9. Documentary: A River of Waste, exposes a huge health and environmental scandal in our modern industrial system of meat...some scientists have gone so far as to call the condemned current factory farm practices as "mini Chernobyls."
  10. For the First Time, the FDA Tracks Antibiotics in Our Meat

An interesting point is that all of these top 10 stories reflect meat production/consumption in a negative way. If you go down a bit you can find some pro-paleo-diet stuff though.

Something which might be remarkable is that these stories focus on "big corporations" being the problem - stories like "if you shove pounds of bacon in your face you'll have a heart attack" are not so highly voted. 17 of the 330 stories which mention meat in some context contained the word "factory" or "CAFO". They have an average score of 131, which is significant compared to the average meat story's score of 37 at p = .02 and significant vs. the average story's score of 53 at p=.08.

There were 32 stories containing the word "antibiotic" or "superbug" in the title. These 32 had an average score of 67. The distinction between these and normal meat stories is significant at p=.03, but not significant compared to all stories (p=.45).

Google trends for "superbug". You can see that interest is quite sporadic.

(The standard deviation of all stories is a very high 198, so consider that when examining significance.)

Something that will probably not surprise activists is that meat stories aren't as popular. Nonetheless, certain types of stories seem to do quite well.

Methodology

Once an hour, I take a snapshot of the front pages of the environment, health, green and food2 subreddits using Reddit's awesome API. Because I only look at the front page, the vote information is slightly wrong (since stories continue to get votes after falling off the front page). I manually (and quite laboriously) mark ones which have to do with meat. I have been doing this for the past 6 or so months, albeit with a few interruptions due to technical difficulties.

The dataset consists of 24,417 stories, 330 of which relate to meat. It is in a rather rough form, but if you want a copy please let me know. If there is enough demand, I can try to post a cleaned-up version for public consumption. Update: by popular demand, the data can be found here. It's been a while, so the data isn't exactly what was discussed here, but it's close (and you can always remove newer stories to validate my results, if that's what you're checking).

Conclusions

It will probably come as no surprise that people are interested in saying bad things about CAFOs. It might be somewhat more surprising that antibiotics are such a hot-button issue.

Please keep in mind that the people who vote on these stories are self-selected to have been interested in health and/or the environment. As always, know your audience.

PS: When I look at who submits these stories, a few names keep coming up. You and me are hanging hard.

Make LocalLinks work for \\ links

LocalLinks is an add-on for Chrome which lets you open local files in Chrome. There is one minor problem: it doesn't work for links which start "\\". Fortunately, there's a simple fix: add the following lines to your locallinks_estension.js file (for me, this was in C:\Users\me\AppData\Local\Google\Chrome\User Data\Default\Extensions\jllpkdkcdjndhggodimiphkghodgcpida\1.1_0\content_script\locallinks_estension.js):

$('a[href^=\\]').
    live('mousedown', handleMousedownOnLink).
    live('mouseout', handleMouseoutOnLink).
    live('mouseup', handleMouseupOnLink).
    live('click', handleClickOnLink);

Can medical research be justified?

Abstract

I investigate the cost-effectiveness of medical research, using methods based on Lichtenburg, Murphy and Topel, and compare this to other charities. I find that the returns on investment in medical research are significantly lower than comparable investments in existing charities.

Introduction

People who study technology are somewhat spoiled when it comes to returns on research investments. The number of transistors we can fit on a chip has roughly doubled every year for the last 50 years - if life expectancy had kept up, people born today would expect to live for about $6*10^{15}$ years (that's a six followed by 15 zeros). To put it mildly, medical research hasn't quite kept up that pace. What's worse is that we're spending tons of money to keep up this less-than-awesome advancement.

Red line is NIH funding and black is the percentage change in life expectancy. All prices in 2010 dollar equivalents. We're spending more and more on medical research without seeing increasing returns.

So it's reasonable for us to ask if there isn't some way of investing our money more wisely when it comes to medicine. Sendhil Mullainathan has an excellent talk arguing that the type of research we need is not: "What drug will cure this disease?" but "How can we get people to use existing drugs to cure their diseases?" There are some interesting results like Giving Everyone the Health of the Educated and The health impact of resolving racial disparities which suggest that changes in social structure may be more effective than medical research itself.

Now, how do the benefits of research into new drugs stack up? I found a paper by Lichtenberg which discusses the role of pharmaceutical innovation in mortality reduction. A more general paper by Murphy and Topel provide a framework that I'll reuse here.

Essentially, we assume that all increases in health are due to medical research, and that medical research takes 10 years from when it's done to when it affects the world. For example, the health increases from 1990-2000 were the result of research done during the 80s.

A discount rate of 3% per year is used for both costs and benefits. A critical point is that they only considers fixed costs of research, ignoring the costs of treatment itself. (e.g. a treatment which costs a dollar is considered equivalent to a treatment which costs $1,000,000.) I include both costs here.

A few points: The benefits of medical research are measured in QALYs, and the cost is dollars, which gives us something called an ICER. You may remember ICERs as "the thing which Sarah Palin called 'Death Panels'." If you dislike putting a price tag on people's lives, you won't like the rest of this article.

Costs

The formula I use is as follows: let $r_t$ be the cost of researching treatment $t$, and $v_t$ be the increased marginal cost of creating the treatment and $p_t$ the number of people who use the treatment. So any treatment $t$ costs $r_t + v_t p_t$ - note that it's entirely possible for the research cost to be negative, assuming the decreased variable cost offsets the increased fixed cost.

To find the sum $\sum_t r_t + v_t p_t$ we can break it into the research cost, which is just the amount spent on research, and the change in variable cost, which is the change in medical expenditures per person multiplied by the total number of people. To prevent a "change in cost" occurring due to population change, the total number of people is defined as the population of the US at the end of the time period.

Benefits

The benefit is similarly defined by the product of the change in QALYs $q$ with the population $p$. We need to project it forward, so the total benefit is $\sum_{t=0}^{\infty}(.97^t)qp_t$, using our 3% discount rate. To avoid double-counting people, I actually use the formula $qp_0+\sum_{t=1}^{\infty}(.97^t)qb_t$ where $b_t$ is the number of people born in year $t$.

Something to keep in mind is that the benefits of medical research apply not just to everyone who is currently alive, but to everyone who will ever live. So even small advances in life expectancy result in huge benefits (as measured here).

Data

From 1985 to 1994 the US spent about two trillion dollars on medical research (both public and private) and from 1995 to 2005 QALE increased by .7 years, for total ratio of $7,317 per added QALY.

So is that good?

The World Bank and WHO collectively publish a report entitled Disease Control Priorities. Based on this data, and studies performed by charities themselves, an organization called Give Well evaluates which charities and methods are effective. Unfortunately, they use a measure related to QALY but not identical: disability-adjusted life years. Nonetheless, we can get a rough measure of how effective medical research is from their criteria:

We feel that a program can be considered extremely cost-effective if estimates put it in the range of $100 per disability-adjusted life-year (DALY) averted, $50 per life-year significantly changed, or $1000 per life significantly changed. - Give Well on Cost Effectiveness

To put it mildly, $7,317 is slightly larger than $100, giving us a fairly firm answer that no, medical research isn't a good way to spend our money.

Discussion

Murphy and Topel do a pretty good job of discussing the limitations of this method, so I'll just add that my calculated ICER for medical research is more than two orders of magnitude worse than the best charity, so it's unlikely that minor changes will affect the conclusion.

I hope this article helps inform your decision when a local university requests government money to expand its research program, or you're torn between donating to Race for the Cure and Village Reach.

References / Data

Probably the simplest way to see what I did is to check out the github repo - if you can read R, readYear.r should be able to explain pretty much everything. The function estimates will return the value I gave here.

I wrote down the sources of all the data I used in that R file, but here's another list:

  • ftp://ftp.bls.gov/pub/special.requests/cpi/cpiai.txt
  • http://www.nih.gov/about/almanac/appropriations/index.htm
  • http://www.cms.gov/NationalHealthExpendData/downloads/nhegdp09.zip
  • http://www.cdc.gov/nchs/products/life_tables.htm

Please don't hesitate to contact me with questions or concerns.

How I Figured out the Y Combinator

The Y Combinator is among the most famous functions in theoretical computer science, which is quite ironic given that it's anonymous (and only really useful because it's anonymous). There's even a massive venture capital firm that took its name. And - somewhat unusually for theoretical CS constructs - it's quite useful.

There are no shortage of tutorials describing how it works, but I couldn't find many which worked through an example. So here's my go at it.

Here's a definition of the combinator that you've probably seen before:

Let's roll it out to see what happens when we actually use it:

So basically, what the Y combinator does is apply a function with itself an infinite number of times. That's already remarkable, because it essentially allows for an infinite amount of recursion with only anonymous functions.

In order to really make it useful though, we need to create an analogy to convergent sequences like $1/2, 1/4, 1/8, \dots$.

A functional equivalent in haskell is something like:
f g x = 1/2 * (g x)
This just uses recursion to generate the next term in the sequence. We can try it out:
Prelude> f id 1
0.5
Prelude> f (f id) 1
0.25
Prelude> f (f (f id)) 1
0.125
The sequence f, f(f), f(f(f)), ... is analogous to the sequence $1/2, 1/4,\dots$ and so it converges to $f^\infty(x) = 0$. To generate an infinite application of f with itself, we can use a fixed point operator:
Y f = (\x -> f (x x)) (\x -> f (x x))
    = f $ (\x -> f (x x)) (\x -> f $ x x)
    = f $ f $ (\x -> f $ x x) (\x -> f $ x x)
    = f $ f $ f $ (\x -> f $ x x) (\x -> f $ x x)
    = f $ f $ f $ f $ (\x -> f $ x x) (\x -> f $ x x)
If we try to use this on our specific $f$ though, Haskell will hang, since, well, it takes an infinite amount of time to converge.

The only kind of convergent sequences that we can use in the "real world" are those which converge in a finite amount of time. No article about functional programming would be complete without a factorial implementation, so here's an example which is readily convergent:
fact g x = if x == 1 then 1 
    else x * (g (x-1)) 
Two examples which give us insight:
Prelude> fact undefined 1
1
Prelude> fact undefined 2
*** Exception: Prelude.undefined
The function $fact(undefined)$ looks like the following:
if x == 1 then 1
else x * (undefined (x-1))
Since Haskell is lazy, the else branch is never evaluated if x = 1, so we don't need to worry about whether the else is well-defined. It's only when we try to call $fact(2)$ that we're going to get an error.

We can consider the sequence $f(\perp), f\left(f(\perp)\right), f\left(f\left(f(\perp)\right)\right), \dots$. ($\perp$ being the formal way of saying "undefined".) In code, this looks something like:
if x == 1 then 1
else x * (
  if x-1 == 1 then 1
  else (x-1) * (
    if x-2 == 1 then 1
    else (x-2) * (
      ...
    )
  )
)
The $n$th term in this sequence has $n$ of these else clauses. As $n$ goes to infinity, the function approaches the real factorial function, as it has fewer and fewer undefined segments. So we can say that this sequence of functions "converges" to the factorial function.

And the key point is that we only need as many function applications as we need recursive calls, i.e. $fact(n)$ needs only $n$ applications of $fact$ as an input - the $n+1$th can all be undefined. So even though this sequence takes an infinite amount of time to converge, the approximation is "good enough" for finite $n$.

To come full circle: in order to make our approximation arbitrarily correct, we need an arbitrary number of function applications as an input. And this is of course what $fix$ does.

Here is another usage which might make more sense: The idea is that we have an infinite list of functions to apply, and when we need a new one we just pop one off. Which just gives us the arbitrary number of function applications that we need.

To summarize:
  • The Y combinator is just a higher-order function which applies functions to themselves
  • By applying functions to themselves, we get a sequence which converges to the "normal" recursive function.
  • So the Y combinator (as well as any fixed-point operator) can create an "arbitrarily good" approximation of a recursive function.

Toggle arbitrary attributes in jQuery

jQuery has a toggle function, which toggles whether an element is visible or not, as well as toggleClass, which toggles whether an element has a class. But I frequently want to toggle other attributes, particularly the title. This plugin lets you do that.

Booth's multiplication algorithm in Python

I had difficulty finding a readable implementation of Booth's algorithm; hopefully this will prove useful to others.

Theorems named after the wrong people

In the graph below, an edge from A to B indicates that a theorem named after B was actually proven by A.

You can see the graphviz source file here. Inspired by this question on Math Overflow.

There is actually a formal name for this phenomenon: Stigler's Law of Eponymy. Ironically enough, the law was proposed by Stigler.