Data Fitting
Exercise 03

I solved this by writing two bits of code. One liniearfit.py is a module that contains two functions. One (func) defines the function to fit. The other (linearfit) takes two requred arguments x and y that contain the data to be fit. The third optional argument yerr takes an array of uncertainties in y if it is given. If yerr is given then the function calls curvefit using yerr to compute the weightihg, otherwise it calls curvefit without weighting.

Exercise03.py is used to generate the plot and outputs for the exercise by imporing then calling linearfit(). The plot with the best fit parameters is in the file Outlier_plot.pdf. It shows that point with the large error bar seriously bias the fit if weighting isn't included, but the biasing disappears when weighting is included. the uncertainties on the fit parameters are small with weighting. The values of a and b used to generate the fake data set in Outlier.txt were a = -0.5 and b = 1.1. As you can see, the fit values with weighting match the input values within the estimated uncertainty.
