χ-Squared Fitting

<<"ErrorBarPlots`" (* Make sure to execute this cell!! *)

Sample data : (x, y, σy)

data1 = {{1,-1.3627,0.1},{2,0.0362,0.15},{3,1.1049,0.2},{4,2.3327,0.1},{5,3.4758,0.2},{6,4.487,0.14},{7,5.6337,0.3},{8,6.9495,0.24},{9,8.4043,0.16},{10,9.5793,0.2}}

MatrixForm[data1]

data2 = {{1,2.976,0.1},{2,4.9568,0.15},{3,7.5041,0.2},{4,9.6416,0.1},{5,11.5164,0.2},{6,13.6172,0.14},{7,15.3315,0.3},{8,17.0358,0.24},{9,18.4852,0.16},{10,19.8514,0.2}}

MatrixForm[data2]

Plot data with errorbars

dataPlot=ErrorListPlot[data1,PlotStyle->PointSize[0.006]]

Define χ2 and make contour plots

HW #5 Assignment

1.  For data set 1:

(a) Use LinearModelFit to find the best fit line and report the slope and intercept with uncertainties.

(b) Define χ2 as a function of m and b, and evaluate it for the value of the best fit parameters.  Turn this into the reduced χ2 and make a conclusion about the goodness of fit.

(c) Make a contour plot of χ2 as a function of m and b, and play around with  the plot range until the Δχ2 = 1 contour is visible.  Interpret the uncertainty in m and b from this contour and check how it agrees with your answer in part (a).

2.  Repeat the above for data set 2.