Mean and probability calculation