Curve fitting with weighting waves
I am attempting to compare two fits to the same data set. The fit functions are user-defined, and one is the sum of three exponentials, the other the sum of four exponentials using a user-defined exponential function that is the convolution of the error function with an exponential. I am performing a global fit on fourteen waves where the exponential decay time constants are global parameters, and the amplitudes of the exponential decay are local parameters. To start, I used no weighting wave and got chi square values on the order of 10e-6. And, without weighting of course the four-exponential fit had a lower chi square value because it has 15 more fit parameters (fourteen extra amplitudes and one extra time constant). So, I applied the same weighting wave to each fitting function (the standard deviation for each wave used in the global fit, since the data I am fitting is the result of averaging 20 repeated measurements) and found that the chi square values are now on the order of 400. However, the fitted values along with the errors remain quite similar regardless of whether or not I apply the weighting wave. I'm a bit confused why the chi square would increase by so many orders of magnitude after applying a weighting wave?
The computation of chi-square is sum(yi-y0/sigmai). If you don't provide a weighting wave, sigmai is simply set to 1. So you must have weights of about 0.0025.
What you are looking for is an F test. It computes an F statistic from the chi-square and degrees of freedom and compares that.
Beware, though. All those tests like the F test assume a function linear in the coefficients and errors that are constant and gaussian. You describe a pretty nonlinear function (but maybe not fatally). But in fact, remember that statistics reported after a fit make that assumption. For a nonlinear fit, those statistics are based on a linearization- they assume a quadratic chi-square surface, and for nonlinear fits approximate the actual chi-square surface with the local quadratic approximation. So any such statistics you might use are based on an estimate that based on an approximation.
Pretty often the approximation is pretty good, so a lot of folks don't really pay attention to that nicety.
February 1, 2021 at 02:28 pm - Permalink