M-estimation weight function