Create probability

Added functions from sp_fn.R