Add in the hazard penalty to R code (not yet implemented in C++)