A General Theory of Goodness of Fit in Likelihood Fits
  Maximum likelihood fits to data can be performed using binned data and unbinned data. The likelihood fits in either case produce only the fitted quantities but not the goodness of fit. With binned data, one can obtain a measure of the goodness of fit by using the $\chi^2$ method, after the maximum likelihood fitting is performed. With unbinned data, currently, the fitted parameters are obtained but no measure of goodness of fit is available. This remains, to date, an unsolved problem in statistics. By considering the transformation properties of likelihood functions with respect to change of variable, we conclude that the likelihood ratio of the theoretically predicted probability density to that of {\it the data density} is invariant under change of variable and provides the goodness of fit. We show how to apply this likelihood ratio for binned as well as unbinned likelihoods and show that even the $\chi^2$ test is a special case of this general theory. In order to calculate errors in the fitted quantities, we need to solve the problem of inverse probabilities. We use Bayes' theorem to do this, using the data density obtained in the goodness of fit. This permits one to invert the probabilities without the use of a Bayesian prior. The resulting statistics is consistent with frequentist ideas. 
Rajendran Raja