Opened 3 years ago

Closed 19 months ago

#930 closed defect (fixed)

fitting help says chisq is normalized to number of points

Reported by: pkienzle Owned by: butler
Priority: critical Milestone: SasView 4.2.0
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description

The following sentence appears in fitting_help.rst:

As the fit of the theory to the experimental data improves the value of 'chi2/Npts' will decrease. A good model fit should easily produce values of 'chi2/Npts' that are close to one, and certainly <100. See :ref:Assessing_Fit_Quality.

Check whether GUI is reporting chisq/Npts or chisq/DOF; correct docs or code and docs.

Change History (7)

comment:1 Changed 3 years ago by pkienzle

  • Priority changed from major to trivial

comment:2 Changed 3 years ago by wojciech

complete1D in fitting.py function says:
chisqr = np.average(residuals * residuals)
where residuals=res = (fn - gn) / en
fn = data, gn = computed intensity, en = error

So in a word our chisqr is divided by number of points

comment:3 Changed 2 years ago by butler

I don't know where it is happening exactly but the reported chisqr on the GUI IS in fact correctly displayed as chisq/DOF not chisq/Npts.

You can check this by pulling up a data set, for example AOT_Microemulsion-Core-Contrast.xml from the test folder and fit to a sphere with 3 parameters varying: scale, background and radius. Note the Chi2/Npts reported. Multiply this by [Npts(Fit)-DOF]/Npts(Fit). Now press compute (same parameters as were just fit and watch the Chi2/Npts change. Compare the new number to the one you just calculated….. So clearly it is doing this …. somewhere.

Would like to find where it is doing this before closing the ticket but we need to fix the docs and the GUI panel info.

Note that the sizers are in fitpage.py

comment:4 Changed 2 years ago by butler

  • Owner set to butler
  • Priority changed from trivial to critical
  • Status changed from new to assigned

comment:5 Changed 19 months ago by butler

This is now sasmodels pull request 63 and awaits verification before merging to master. Once done this ticket can be closed.

comment:6 Changed 19 months ago by butler

In 47ace500b69b84227cf32c9ef9bb1118c093b7e2/sasview:

fix as per comments.

addresses #930

comment:7 Changed 19 months ago by butler

  • Resolution set to fixed
  • Status changed from assigned to closed

the last changes were approved and the pull request merged but forgot to set automatically close with Closes #930. Closing now.

Note: See TracTickets for help on using tickets.