Fitting curves with a linear model