Nonparametric estimation of mean residual functions