Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a goodness-of-fit criterion to determine whether the model is appropriate? #27

Closed
ellot opened this issue May 8, 2021 · 3 comments

Comments

@ellot
Copy link

ellot commented May 8, 2021

When I use chi statistic in XSPEC, if the reduced chisq is approximately 1 then I will consider the model is appropriate.
I am wondering if there is such a convenient criterion in BXA? If there is no such criterion, so how to quantitively justify whether the model fits the data?

@JohannesBuchner
Copy link
Owner

You can do posterior predictive checks. It is helpful to apply some binning in the prediction (not the fit), for clarity. Here is how to make such a plot: https://johannesbuchner.github.io/BXA/xspec-analysis.html#model-checking

You can also do Q-Q plots, which avoid binning. Here is how to make such a plot: https://johannesbuchner.github.io/BXA/xspec-analysis.html#model-discovery

A further test is to leave some data out in the fit, and try to predict it.

Finally, you can do parametric bootrap: For each posterior sample, generate data and compute the likelihood there. If the loglikelihood distribution is very different than the loglikelihood distribution on the actual data, there may be a problem. This would give you a p-value (where does the most extreme loglikelihood of the data lie in the simulated distribution).

I should also say that "reduced chisq is approximately 1" is not quite correct. "chi²" follows a chi² distribution with some degrees of freedom, from which you can get p-values. However, it only follows such a distribution if the model is linear in the parameters, and if you have Gaussian distributed error bars.

Statisticians these days recommend to use visualisations and domain expertise more, rather than trying to shoehorn everything into a test.

@JohannesBuchner
Copy link
Owner

Another way to go about it is to look at some of the visualisations (e.g., Q-Q plot, posterior predictive check), and guess where the model could be improved, and fit a more complicated model. This can also be empirical, for example, adding a line somewhere where it seems needed.
Then, a model comparison between the initial and the more complicated model, e.g., with the AIC, can indicate whether the initial model was too simple.

@JohannesBuchner
Copy link
Owner

Please see https://johannesbuchner.github.io/BXA/tutorial_usage_plotbxa.html for a very nice new plotting class provided by David Homan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants