May. 27th, 2009

haggholm: (Default)


somedb=> select date('2009-05-27') + 7;
(1 row)


mysql> select date('2009-05-27') + 7;
| date('2009-05-27') + 7 |
|               20090534 | 
1 row in set (0.00 sec)

My current task, which involves date calculations on items in the database, is going to be a bit complicated by the fact that MySQL’s date arithmetic sophistication is such that it thinks that one week from today is May 34.

Update: I can, of course, and probably will use MySQL’s builtin functions (DATE_ADD() et al), but this forces me to use non-standard functions rather than standard SQL operations. (I will get away with this because, and only because, this module is restricted to MySQL only, unlike our core system.) Furthermore, I fail to see, if they have implemented the proper arithmetic in functions, why they left the operations with a completely idiotic default.

haggholm: (Default)

During my coffee break, I read an article in Scientific American Mind called Knowing Your Chances (available online). I think it is an outstanding article, and you should read it. The most evocative part may have been a simple example:

Consider a woman who has just received a positive result from a mammogram and asks her doctor: Do I have breast cancer for sure, or what are the chances that I have the disease? In a 2007 continuing education course for gynecologists, Gigerenzer asked 160 of these practitioners to answer that question given the following information about women in the region:

  • The probability that a woman has breast cancer (prevalence) is 1 percent.
  • If a woman has breast cancer, the probability that she tests positive (sensitivity) is 90 percent.
  • If a woman does not have breast cancer, the probability that she nonetheless tests positive (false-positive rate) is 9 percent.

What is the best answer to the patient’s query?

  1. The probability that she has breast cancer is about 81 percent.
  2. Out of 10 women with a positive mammogram, about nine have breast cancer.
  3. Out of 10 women with a positive mammogram, about one has breast cancer.
  4. The probability that she has breast cancer is about 1 percent.

Before you read on, take a brief moment to think about it, but also note your gut feeling. Done? Let’s continue:

Gynecologists could derive the answer from the statistics above, or they could simply recall what they should have known anyhow. In either case, the best answer is C; only about one out of every 10 women who test positive in screening actually has breast cancer. The other nine are falsely alarmed. Prior to training, most (60 percent) of the gynecologists answered 90 percent or 81 percent, thus grossly overestimating the probability of cancer. Only 21 percent of physicians picked the best answer—one out of 10.

Doctors would more easily be able to derive the correct probabilities if the statistics surrounding the test were presented as natural frequencies. For example:

  • Ten out of every 1,000 women have breast ­cancer.
  • Of these 10 women with breast cancer, nine test positive.
  • Of the 990 women without cancer, about 89 nonetheless test positive.

Thus, 98 women test positive, but only nine of those actually have the disease. After learning to translate conditional probabilities into natural frequencies, 87 percent of the gynecologists understood that one in 10 is the best answer.

I’m happy to say that I did get it right on the first try, but I strongly agree witht the authors’ opinion that it is not intuitive when the statistics are cited as probabilities rather than natural frequencies. The reason I got it right is because I’ve done a bit of math and a wee bit of stats, I enjoy reading some blogs that talk about medical statistics, I know some of the not-quite-obvious ground rules of probabilities; I know what Type I and Type II errors are (even if I occasionally mix them up)…

…And, perhaps crucially, I’ve spent time thinking about false positives in medical testing before. When I get my periodic routine screenings for STIs (I’ve never had symptoms or tested positive for any, I’m glad to say, but I feel a responsible person should get tested anyway!), I’ve asked myself the hypothetical question What if it did show positive for, say, HIV? What are the odds that I would actually have it? (It turns out that if you’re a heterosexual male, and if you test positive for HIV, there’s about a 50% chance that you don’t have it! You should play it safe, but get re-tested and don’t panic. Some people commit suicide when they get positive test results, even though they’re as likely as not to be healthy.)

Still, while my gut told me the answer was not A (wherein I did better than most of the gynecologists), I had to think about it for a minute to figure out which was the proper answer. People need to be educated on this stuff. Meanwhile, if you haven’t had the benefit of statistical education, keep this one thing in mind: The obvious answer is not always correct, so if you’re unsure, ask someone who can do the maths. And, sadly, even your doctor may not know. I actually find it rather sad that as after learning to translate conditional probabilities into natural frequencies, 87 percent of the gynecologists understood that one in 10 is the best answer, this means that even after simplification, more than 1 in 10 gynecologists didn’t get it. Your doctor can spot the symptoms and order the right tests, but you may need a mathematically inclined friend to actually calculate the risks.

haggholm: (Default)

As regular readers here all know, I have a number of issues at work—but mostly, that’s to be expected, inevitable, and not beyond my ability to deal with. I don’t expect any job is always fun and interesting; every job is bound to have times of stress; and in spite of occasional periods of very intense frustration, there’s no co-worker I have to interact with that I never get along with. (True, some I get along with much less frequently than others…)

But there is one thing that always bugs me, and it’s my work environment. In the old office location, I shared an office with two co-workers. When we moved into the new building downtown, the three of us, again, shared an office—an improvement, even, as I now had a window. Some re-shuffling occurred, and we moved into yet another room (within the same office), but I still had a window at my back. Then, finally, too much space was needed, and support staff needed private offices to reduce noise pollution as they spend all day on the phone, and we ended up booted out of our office.

I now share a cubicle with one co-worker. Behind me and on my left side are actual walls. To my left and above me is a vent, which blows cold air on me in the winter, but fails to give any impression of fresh air. To my right is a cubicle wall; in front of me is my co-worker, and half a cubicle wall (and a “doorway”). The lighting is fluorescent. I can’t see any windows from my desk. In this little pocket, air flow is poor in spite of the vent that had me shivering in the winter, and I often feel lethargic (even by my afternoon standards); stifled as from lack of oxygen. There are people in this office I might kill for access to an open window…

At home, I tend to keep my curtains drawn to get rid of glare, but that’s still very different from this dank enclosure. I have light curtains; they remove glare, but admit enough light that I have no need for artificial lighting at home during the day. When I do turn on lights, of course, they’re incandescent, or compact fluorescent lamps that emit light more similar to incandescents than to fluorescent ceiling lights. In this cubicle, I’m stuck under unchanging fluorescent light.

When I next look for a job, whenever that may be (certainly not right now! —I’ve a project to finish), I will definitely look at the physical work environment as one criterion. I want an office—I’d like some privacy, but most of all I want real air and real light. This hole is just depressing.

haggholm: (Default)

T.H. Huxley famously said that it was extremely stupid not to have thought of Darwin’s theory of evolution by natural selection. I wouldn’t go quite that far—for several thousand years, countless extremely smart people consistently failed to think of it, until Darwin and (independently) Wallace did so—but I do agree that it is, at least in hindsight, a lot more obvious than those millennia might have us believe.

Darwin formulated his theory after many years of incredibly extensive and meticulous collection of biological facts. This is invaluable for three reasons—it’s persuasive, it provides detail, and of course it’s necessary to validate it as an empirical science—but I believe that the broad strokes of evolution by natural selection can be deduced from armchair reasoning, armed only with a few basic, biological facts—at least for bisexually reproducing organisms, to which area I shall restrict myself below. Perhaps someone will find that persuasive, and in any case I find the idea interesting enough to consider.

In brief, I believe that we need the following ideas:

  • Phenotypic (here, very roughly “biological”) traits are inherited.
  • Inheritance of non-acquired traits (trivially observed and deduced).
  • The particulate nature of inherited traits (trivially observed and deduced).
  • Traits are subject to random variation (long known).
  • The Malthusian Argument (accessible to armchair speculators)
  • The knowledge of an old Earth

Let’s go through them one by one and see if you agree with my assessment.

First, phenotypic traits are inherited. This has been known for thousands of years—like begets like.

Second, we need the inheritance of non-acquired traits, which I claim is trivially observed. Note (beware of converse error) that I am not saying that it’s obvious that no acquired traits are inherited (and while the “Lamarckian” view of evolution is clearly wrong, there are some things and some senses in which acquired traits can be inherited—by and large, they are not genetic). I’m just saying that some non-acquired traits are clearly inherited. I’m going to call this the Grandparent Argument: Children can inherit traits that clearly run in the family even though such traits may skip a generation. If I share a trait with my grandfather that my father didn’t share, and if this correlation is strong enough to be reliably observed (at some statistical frequency), then the trait can’t be simply acquired, since neither of my parents had it. Yet even though neither parent had it, it was passed down the family: Ergo, there must be something passed down in the blood (actually, of course, the genes).

The particulate nature of genetics is the observation that mixing traits is not just a matter of blending. Let me define my terms: Blending here means that the result is the intermediate of the inputs. If I mix dark blue and light blue, I get medium blue. If I mix “genes for tallness” with “genes for shortness”, I get a person of intermediate height. This was seen as a major problem for Darwin’s theory, once Mendel’s work on genetic became well-known. However, it is, or should be, completely obvious that not all traits work like that. As Dawkins points out, the most obvious way of all is to note that the offspring of a man and a woman is (in a vast majority of cases) a boy or a girl, not an intermediate between the sexes. Other traits are equally obvious; so the children of a blond and a black-haired parent may be either blond or dark, but never intermediate in colour.

Some traits appear to be “blended”. This is because there are lots of “on-or-off” gene “switches”; if my mother has 100 “on” switches for tallness, and my father has 100 “off” switches for tallness, I may end up with 50 “on” and 50 “off” switches and thus, intermediate height. Still, each gene is either the one thing or the other. Genetics is, as Dawkins says, digital. This isn’t exactly obvious—beware again of converse error: I claim that it’s obvious that particulate traits are inherited, not that it is obvious that no “blended” traits are ever inherited.

As for random variation, it’s not hard to deduce from looking at nature—whether by freak mutations, or by observing that minor new traits appear in populations of animals long and well observed, especially populations kept fairly homogenous, such as any kind of livestock, or Darwin’s pigeons.

The Malthusian argument can be very approximately paraphrased as follows: Animals tend to produce more offspring than is necessary to maintain the balance of a population. For instance, half of all geese hatched are female, and each female goose tends to have more than two offspring in her lifetime. Thus, in an ideal population with unlimited food and no predators, the population will increase geometrically—the next generation will be bigger by some factor X (e.g. twice as big); the generation after that, X times bigger again (e.g. twice as big again, or four times the original)—and so on. However, because resources are limited, this can’t go on indefinitely (or there would be infinitely many geese). Therefore, many animals die, and only some survive.

I will gloss fairly rapidly over the existance of an old Earth. Cultural background provides different views on this—some cultures have viewed the world as eternal; some as created within a finite history. In a backdrop of Christian creationism, it is perhaps not obvious that the Earth is in fact several billion years old, and this may have been a big part of the reason why Western science didn’t figure out evolution sooner than it did. Certainly, Darwin and Wallace followed fairly closely in the footsteps of geologists who discovered that the Earth was at the very least many millions of years old. Suffice to say that we now do know, through radiometric dating etc., that the Earth is very old (there’s lots of good evidence for, and no good evidence against this theory), and even if people before Darwin couldn’t account for that from their armchairs, we can.

Hopefully we can roughly agree on all of the above. My claim is that with this alone, we should be able to hash out a rough view of evolution by natural selection. It goes as follows:

Because we have the Malthusian argument, we know that not animals survive. If an animal has 20 offspring over its lifetime, and its population remains roughly constant, on average less than two of those offspring will survive to leave offspring behind (two, because the animal and on average one mate must be accounted for; less than two because generations overlap). Thus, >(18/20), or >90% of all these animals die without any offspring.

We also know that they vary a little—through random variation, no two individuals are exactly the same (almost every human on Earth carries genetic mutations—you are almost certainly a mutant, dear reader!). Now, by a trivial survival of the fittest argument we can see that who survives and who dies without heirs won’t be completely up to chance. Of course, there’s an element of luck in it. Some animals may be struck by lightning. Sometimes, who gets eaten and who gets away is down to luck.

But “chance” doesn’t differentiate between traits (that’s the point!), and some traits produce some benefit. Maybe the animal that runs slightly faster is better at avoiding predators. Maybe the one with slightly sharper eye-sight is so much better at spotting prey. The difference may be tiny, but there is a difference, and as the experience is repeated over many millions of years, we can see that in the long run, because phenotypic traits are inherited, a beneficial trait will help a “family line” to prosper. (Let me reiterate, because I have seen people have difficulty with this, that random chance does not cancel out these benefits. It’s true that lightning may strike a fast animal as easily as it may strike a slow one…but no more easily. Random chance doesn’t favour the “negative” traits, so there’s still a benefit!)

One argument that was levied against this reasoning about a hundred years ago is that continued breeding will tend to blend a trait into the population, but as we established earlier, inheritance of traits is particulate in nature, so this doesn’t really happen. It should also be noted that because there’s some “particulate pseudo-blending” going on, as also mentioned above, most dramatic evolutionary change happens in isolation—e.g. when a small population (perhaps a pair of animals) is separated from the rest (e.g. insects or birds blown by wind to an island, a herd of deer isolated by a new river…).

We haven’t even gone through my list of basic arguments yet, and already we’ve started to deduce the existence of population genetics.

We’re now ready to show that evolution must be “Darwinian”—Lamarckianism isn’t enough. If you’ve agreed with me all the way, you’ll already see that it plays a part. A second angle on it is to observe that many acquired traits are obviously not inherited—if you lose a limb, or grow a beard, your child will not inherit it. (Even aphids and stick insects, clones of their mothers, inherit the usual number of limbs from maimed ancestors). A third strike against it is that while Lamarckian evolution could (if true) explain some fairly crude traits (stronger arms, longer giraffe necks, etc.), it provides no explanation whatsoever for novel traits—the first ancestor of the eye, a light-sensitive patch, is a novel trait with potential benefits (aid in regulating circadian rhythms, detections of predators who block light sources, etc.), but cannot be explained by Lamarckianism. There must be inheritance of non-acquired traits for evolution to work, and we have already seen that it does.

The armchair argument can’t tell us that nothing Lamarckian happens, but it can and does tell us that Darwinian evolution must happen, and if Lamarckianism is true at all, it’s only in conjunction therewith.

…And so, hey presto!, we have deduced a very rough outline of Darwinian evolution with only the most basic of facts and observations, quite without the reams of data that Darwin had. Of course it really is extremely rough: We have a crude Darwinian theory, we assuredly do not have Darwin’s!—let alone modern evolutionary theory, which has a century and a half’s worth of evidence, further discoveries, statistics, integration of genetics, and roughly a gazillion other advances on what Darwin, however brilliant, had figured out. I’m sure that a lot of little holes can be poked in it, but I am after all presenting an armchair sketch, not a waterproof argument if you want that, read peer-reviewed books with peer-reviewed references (I purposely avoid giving any links or references precisely to emphasise the armchair nature). As such, I’m not going to bother refuting a lot of the usual arguments against evolution—apart from the fact that most of them are silly, this is just meant to be a rough, quick, and comprehensible (not comprehensive!) positive argument for.

There is one I want to mention briefly, though (apart from the Old Earth bit already mentioned above): It might very easily be argued that my argument lays out a good case for “microevolution”, and someone might seize upon this and exclaim that I haven’t proved “macroevolution”. To this I reply that the distinction between “microevolution” and “macroevolution” is spurious. It is true that biologists may use these terms, but that does not mean that they are distinct categories. “Macro” and “micro” just means “big” and “small”, respectively, and the “two forms” of evolution are the same, unless you can demonstrate that there is an upper limit to what “microevolution” can cumulatively achieve. Otherwise, you may as well agree that a man can walk fifty miles (with rest stops) but refuse to admit that he could possibly walk a thousand, because the former is “microwalking”, which has been observed, wheras the latter is “macrowalking”, which hasn’t and is impossible.

I hope you have found this at least evocative. Please let me know if there are any big, glaring gaps—but leave the little, niggling gaps for Talk Origins or for another time.

Most Popular Tags