M_estimate function

Calculate algB