mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
fix: chisquare, dof and p-value also calculated when dof is 0. Test for
dof and chisquare_over_dof added.
This commit is contained in:
parent
06ba2015be
commit
a7a098b861
2 changed files with 31 additions and 4 deletions
|
@ -358,11 +358,11 @@ def least_squares(x, y, func, priors=None, silent=False, **kwargs):
|
|||
if not fit_result.success:
|
||||
raise Exception('The minimization procedure did not converge.')
|
||||
|
||||
if x_all.shape[-1] - n_parms > 0:
|
||||
output.chisquare = chisquare
|
||||
output.dof = x_all.shape[-1] - n_parms + len(loc_priors)
|
||||
output.chisquare = chisquare
|
||||
output.dof = x_all.shape[-1] - n_parms + len(loc_priors)
|
||||
output.p_value = 1 - scipy.stats.chi2.cdf(output.chisquare, output.dof)
|
||||
if output.dof > 0:
|
||||
output.chisquare_by_dof = output.chisquare / output.dof
|
||||
output.p_value = 1 - scipy.stats.chi2.cdf(output.chisquare, output.dof)
|
||||
else:
|
||||
output.chisquare_by_dof = float('nan')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue