This function create a residual for each observed value and also generates a residual distribution
Useful links