Moved rt prediction to a function.
Added script to analyze prediction error.