fit statistics with extra term to avoid division by zero; (#186)
All checks were successful
Build AppImage / Explore-Gitea-Actions (push) Successful in 1m53s

closes #181

Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de>
Reviewed-on: #186
This commit is contained in:
Dominik Demuth 2023-12-17 16:10:35 +00:00
parent 789801228a
commit 9815c0df40

View File

@ -157,15 +157,12 @@ class FitResultCreator:
'chi^2': chi, 'chi^2': chi,
'R^2': r, 'R^2': r,
'AIC': loglikehood + 2 * nvar, 'AIC': loglikehood + 2 * nvar,
'BIC': loglikehood + np.log(nobs) * nvar 'BIC': loglikehood + np.log(nobs) * nvar,
'adj. R^2': 1 - (nobs-1) / (dof+1e-13) * (1-r),
'red. chi^2': chi / (dof + 1e-13),
} }
if dof != 0: stats['AICc'] = stats['AIC'] + 2*(nvar+1)*nvar / (dof - 1 + 1e-13)
stats['adj. R^2'] = 1 - (nobs-1)/dof * (1-r)
stats['red. chi^2'] = chi / dof if dof != 0 else 0
if dof != 1:
stats['AICc'] = stats['AIC'] + 2*(nvar+1)*nvar / (dof-1)
return stats return stats