External function for calculating R2.  KK has a function called calccod.  This one is apparently similar.