The end of the world... and I feel fine!

Friday, May 20, 2011 at 1:00 PM Bookmark and Share
The end is very nigh.   May 21st is upon us and as you've probably already heard in the news or elsewhere that means it's time for the rapture The Rapture! 

Predictions like these have a long track record of being correct, so best of luck to you come judgement and until then be vigilant for unmanned cars whizzing down the road, anyone flying up into the air, or any six-winged creatures covered in eyeballs.  If you happen to see any of these things, do leave a comment below!

PS: if you're still here on the 22nd consider opening your home to your ex-neighbors' earth-bound pets!

Happy Mother's Day!!

Sunday, May 8, 2011 at 1:57 PM Bookmark and Share
If you were planning on sending your mom a nerdy video, make sure you don't go overboard on the nerdiness -- unless you're mom's a super nerd, then go for it!  For example, this is an excellent choice

while this one -- although both nerdy and relevant to motherhood -- might not quite be the best choice...

Happy π Day!!! No, wait, scratch that...

Monday, March 14, 2011 at 11:15 PM Bookmark and Share
Lets face it -- π sucks. Not pie, pie is genuinely awesome and so is the fact that "pie" sounds like "π", so we can have fun with things like this.  But seriously... π?  It's totally off by a factor of 2!

For more on τ day, check out the Tau Manifest at and of course if you're still a fan of π.

A request: I need your comments!

Friday, March 11, 2011 at 4:54 PM Bookmark and Share
I need your help!  A reader recently tried to leave a comment on this blog, and despite the fact that I received an email notifying me of the new comment, it never appeared on the blog post...

Figure 1: I'm about this confused, if not more.

So, if you can spare a few moments, please head over to this post (and/or leave a comment below) and let me know the following:
Operating System:
Comment type (Anonymous, Google, etc.):
Link to your favorite recipe**:
** Totally unrelated, optional, but potentially delicious and therefore worth requesting. ;)

If the comment submission process seemed to work but your comment doesn't show up on the post, please drop me an email letting me know what happened.

Thanks! ~ Paul

Evolution is a pain in the ass, especially for herpetologists and ornithologists

Thursday, March 3, 2011 at 1:26 AM Bookmark and Share
The reason? Imagine you have a kid, and your neighbor has 2 kids, then you both find out that really, one of their kids is sort of... yours. (-- awkward pause --) That's basically the problem here:

Herpetology is the study of reptiles and amphibians, however unraveling the evolutionary history of these two groups (along with birds) has shown us that birds are actually nested in among reptiles.

Now, to be fair, I think the comic has it wrong: I mean, shouldn't this justify lumping ornithology in a sub-discipline of herpetology?

Thesis writing...

Wednesday, March 2, 2011 at 2:28 PM Bookmark and Share
... has pulled me away from blogging the past couple of months. BUT, I'll hopefully be done and back to a regular posting schedule later this spring!

Figure 1: Mascot for my recent rate of new blog posts.

In the meantime, you should check out and "like" their facebook page to get regular updates on your news feed.

Shame on you, R... again! (But not really...)

Monday, January 17, 2011 at 2:25 PM Bookmark and Share
Remember how a few months ago I lamented the fact that the round() function in R uses a non-standard rule for rounding to the nearest integer?  Instead of rounding k+0.5 to k+1 (k being an integer) R rounds to whichever integer k or k+1 is even.  Well here's another example of R offending our mathematical sensibilities... R seems to think that even though
1 * Inf = Inf
somehow it can get away with telling us that
1 * (Inf + 0i) = Inf + NaNi?

"Gasp!" I know, insane, right? What's going on here? Whatever happened to "anything times one is equal to that same number"? Granted, infinity isn't really a number so sometimes we can't assign a value to an expression like Inf*0, but deep down inside I can't shake the feeling that 1 * Inf really should be Inf!

It turns out that R and I are both right - we're just making different assumptions about how we interpret all these 1s, 0s and Infs in these two statements. Let me explain...

Despite using sound, puppy-approved logic in this case, R gives the offending result because of how it implements everyone's favorite section in Calculus class: computing limits.  To understand why, take a closer look at how the multiplication is happening in each case above.  The first case is hopefully straightforward.  In the second case 1 is treated as a complex number instead of a scalar which gives 
1*(Inf+0i) = (1+0i)*(Inf+0i)  =           
           = Inf + (0*Inf+0)i = Inf + NaNi

We could also throw in a third case and multiply these two complex numbers in the more natural context of polar coordinates. Writing each in terms of their modulus r (distance from the origin) and argument θ (angle off of the positive real axis) instead of in terms of their real and imaginary parts, we have
   1*(Inf+0i) = (1+0i)*(Inf+0i)       
             = 1exp(i0)* Inf exp(i0)
        = (1*Inf) exp (i0)
   = Inf exp(i0)
= Inf + 0i
Whew! So what's "wrong" with multiplying things in x+yi form??

R recognizes that any computations involving infinity really require the algebra of limits, and acts appropriately (albeit conservatively) to evaluate such expressions. This discord then comes from what R assumes is the result of taking some limit and what is to be treated as a constant. Unless you've taught a calculus class recently some explanation might be in order.

In general, expressions involving infinity are treated as limits where some unspecified variable is going to infinity:  For example, statements like Inf*0 can't be assigned a value because in it's most general interpretation we're asking "What is the limit of the product of x*y as x→Inf and y→0?"  Here, whether y goes to 0 from above (e.g. y=1/x) or below (y=-1/x) or neither will determine where the limit of the product goes to zero, some non-zero number, plus or minus infinity, or will have no limit at all. (Open any calculus text to the sections on limits for examples leading to these different outcomes).  Note this example does have an answer if y is always assumed to be 0, since it's always the case that x*0=0.

That means that, depending on how we interepret the zero, our example might equal either
This is exactly what's going on above.

Returning to the two statements at the top of this post, we can now understand why R gives these two different answers.  By making the zero implicit vs. explicit R treats these expressions differently. R interprets Inf as "the limit of x + 0i as x→Inf," allowing for the result that
1 * Inf = Inf
whereas in the second case R treats Inf + 0i as "the limit of x + yi as x → Inf and y → 0" which has no general answer  and therefore gets assigned a value of NaN.

The take-home message: as soon as there's an Inf in an expression, R proceeds assuming everything is a limit, even though it might be clear to the user that some of those key 1s and 0s should be treated as constants.

Data Visualization in R: Part... 0

Friday, January 14, 2011 at 3:26 PM Bookmark and Share
I haven't forgotten that I promised to do a series of posts on data visualization using R - just a bit busy catching up after some excellent holiday R&R. Hopefully I'll get a post out soon!

In the mean time, check out these two posts from the R-bloggers network.