the chi-squared statistic
/ KY-squared /
You have fitted a curve through a cloud of data points that carry error bars, and you want a single honest number that answers the question 'how well does this model actually agree with the data?' The chi-squared statistic is that number. It adds up how far the data sit from the model, but crucially it measures each gap in units of that point's own error bar, so a large deviation on a precise point counts far more than the same deviation on a sloppy one.
For data points y_i with uncertainties sigma_i and model predictions f(x_i), the statistic is chi^2 = sum of (y_i - f(x_i))^2 / sigma_i^2. If the model is correct and the errors are independent and Gaussian, chi^2 follows the chi-squared distribution with nu = (number of data points) - (number of fitted parameters) degrees of freedom, whose mean is nu. So the reduced chi-squared, chi^2 / nu, should come out near 1 for a good fit. A value much greater than 1 means the model fits poorly or the error bars were underestimated; a value much less than 1 hints that the errors were overestimated or the model is over-fitting the noise.
This makes chi-squared the standard goodness-of-fit measure and the very quantity minimized in weighted least-squares fitting; converting chi^2 and nu into a p-value tells you how improbable a deviation this large would be by chance. The honest caveat is twofold. A near-1 reduced chi-squared does not prove the model is correct, only that these data at this precision do not refute it. And the whole interpretation rests on correctly estimated, Gaussian, independent errors, so wrong error bars make chi-squared meaningless: a 'bad' chi-squared often indicts the uncertainties rather than the model.
Fit a straight line to 12 data points and obtain chi^2 = 9.5 with nu = 12 - 2 = 10 degrees of freedom; the reduced chi-squared 9.5 / 10 = 0.95 sits close to 1, so the linear model is consistent with the data.
Reduced chi-squared near 1: the model is consistent with the error bars.
A reduced chi-squared near 1 signals a plausible fit only if the error bars are trustworthy; underestimated errors inflate chi-squared and can make a perfectly good model look rejected, so a 'bad' chi-squared frequently indicts the uncertainties, not the model.