This is an alternative goodness of fit metric described in [1].
Macro by: Matthew Rowles. All the actual work: Julian Henn
[1] Henn, J. 2016. "An Alternative to the Goodness of Fit." Acta Crystallographica A 72 (6): 696-703..
''alternative GOF value as defined in Henn, J. 2016. "An Alternative to the Goodness of Fit." Acta Crystallographica A 72 (6): 696-703. macro aGoFs(val) { prm !N_par = Get(number_independent_parameters); xdd_sum !N_ref = Yobs-Yobs + 1; ''this is the number of datapoints xdd_sum !delta_sq = (Yobs - Ycalc)^2; xdd_sum !sigma_sq_1 = Yobs; xdd_sum !sigma_sq_2 = SigmaYobs^2; ''if SigmaYobs is not defined, then this makes sure you use sigma = sqrt(Yobs) prm sigma_sq = If(sigma_sq_2 == 0, sigma_sq_1,sigma_sq_2); chi2 = (N_ref/(N_ref - N_par)) (delta_sq / sigma_sq); : val }