forked from IPKM/nmreval
fit statistics with extra term to avoid division by zero; (#186)
closes #181 Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de> Reviewed-on: IPKM/nmreval#186
This commit is contained in:
parent
789801228a
commit
9815c0df40
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user