Robust method for fitting data to a model.