Friday, April 30, 2010

WotD: tropology and tropometer

From Jarrold's Dictionary of Difficult Words:

tropology, n. figurative style of writing; interpretation of Bible stressing figurative nature of language.

tropometer, n. instr. measuring rotation.

Thursday, April 29, 2010

WotD: ambry and ambsace

From Jarrold's Dictionary of Difficult Words:

ambry n. niche; cupboard, espec. containing sacred vessels in chancel.

ambsace n. double ace; lowest score; bad luck.

Wednesday, April 28, 2010

False positives

Consider an individual X who is tested for a disease.
Let D mean "X has the disease" and -D mean "X does not have the disease".
Let T mean "X has tested positive for the disease".
Let P(A) mean "the probability that A is true".
Let P(A|B) mean "the probability that A is true given that B is true".

We are given P(D), P(T|D), and P(T|-D).
(i.e.: the probability that X has the disease; the probability of getting a positive test if X really does have the disease; and the probability of getting a false positive test if X actually doesn't have the disease, respectively).
Note that P(-D) = 1 - P(D).

What is P(D|T)?
(i.e.: what is the probability that X has the disease given that X tested positive for the disease?)

Let u = P(D).P(T|D) be the probability that X tests positive and has the disease.
Let v = P(-D).P(T|-D) be the probability that X tests positive and yet doesn't have the disease.

These are the only ways X can get a positive test result. It follows that

Solution: P(D|T) = u/(u + v)
(i.e.: the probability that X has the disease given X tested positive is the fraction of positive results for X that are actually correct).

Practical application.

Since disease is rare, P(-D) will be much larger than P(D). Therefore if P(T|-D) (the chance of a false positive) is not very small, then v = P(-D).P(T|-D) will be large, hence P(D|T) will be relatively low (i.e., a positive test will probably not mean that X actually has the disease).

Bottom line: make sure your tests have a low false-positive rate.

Friday, April 23, 2010

Covariance and Contravariance

On occasion I've mixed these terms up. Taking X : T to mean "X has/is compatible with type T", then:

X : T is covariant if X can also take on a subtype of T;

X : T is contravariant if X can also take on a supertype of T.

Consider the expression Ys = map(F, Xs) where
Xs : list(Tx),
Ys : list(Ty), and
F : U -> V.

Clearly F must accept values of type Tx (or some supertype thereof), therefore U must be of type Tx (or some supertype thereof), hence F is contravariant in its argument.

On the other hand, F must return values of type Ty (or some subtype thereof), therefore V must be of type Ty (or some subtype thereof), hence F is covariant in its return type.

Monday, April 19, 2010

Ugly Betty - Nooooooooo!

Ugly Betty has aired it's final episode. We grow sad...

UB was the finest, smartest comedy I've seen on television and the cast and scriptwriters managed to maintain the level from start to end throughout all four of its seasons. Good for them for finishing it well rather than running the show into the ground.

UB was the comedy that the West Wing writers could have written. It was just that good.

Saturday, April 03, 2010

My First StarCraft On-line Win!

Kum bay yah, I have finally won a game. This is more of an achievement than you think given how bad I am at StarCraft. (I play as 'theoctopi' on ICCup if anyone's interested.)

Extended C type generator tools

I've extended my set of C tools for generating common data types. Now there are generators for list types, 'maybe' types, and expanding array types. Now with one command line invocation you can generate hundreds of lines of bug-free (!) boilerplate C code.