statistcal algorithm