Good day to developers and users of Ifeffit,
I'd like to get help with my question of statistical calculations in Ifeffit (I use the version embedded in Demeter, but in console mode or from my Fortran little program: think of Larch using but there are no some features and I'm not sure).
The task is to try making Bayes statistics, in the sense that was published in Krappe et al. papers from 1999,2002,2004 years and the book of Bretthorst. I haven't found the software for it and my own tries to write it are not completed because of no experience. I saw something in papers about BFEFFIT, an extension for such statistics, but haven't found it in the web or any other information. May be somebody knows what stage is it on.
I need it because of complicate model (4 spheres, may be splitting of spheres because it is many-phase system with dopant phase) and need of regularization in Tikhonov sense (parametra are correlated and I can not determine which constraint or model is better without statistics, and with nonconstrained parametra it simply will not fit)
I understood that it can be emulated in Ifeffit with help of restraints. All thing is to:
-minimize chi**2=(dat-model)**2/epsilon_k**2+A*sum(xi-x0i)**2, where A is regularizer, xi - parametra in fit end, x0i - a priori values of parametra.
-calculate pair correlations and errors so that we can calculate the second derivatives and variance matrix of chi**2 determines in this sence.

But I can not understand about how restraint goes in fit and how IFEFFIT calculates chi_square (not reduced) and errors. From manuals of FEFFIT and IFEFFIT I supposed that there goes:
-LS minimisation of (dat-model)**2+restraint**2, may be normed, but it doesn't matter
-chi_square is this value divided by eps_k**2, may be divided by points num
-for errors found variance of chi_square defined above, but then error bars are scaled to chi_reduced to eliminate noise dependence
-pair correlations are corr(i,j)/sqrt(corr(i,i)*corr(j,j) and doesn't depend of normalisations

What is right? I need the above defined chi**2=(dat-model)**2/epsilon_k**2+A*sum(xi-x0i)**2 and its variance matrix, because it defines my statistics, optimal A,errors and 'projections' of parametra that I need to verify model.

I use the fit in k space (not q) without Fourier transforms or k weight, because it is hard to do for this statistics. (Filtration of high fr3equency components I can do with rectangle windows if needed, I think, but it is not much bigger than noise)
I thought (dat-model)**2 in k space is in real part for points from kmax to kmin for defined dat array(my_spectrum.chi for instance) and fit.chi array. But I calculated chi_square in hand from these arrays and there was no right number. for test of 1 sphere chi_square=8e-3, (dat-model)**2=3e-4, (dat-model)**2/noise**2=2,37e1, (dat-model)**2/noise**2=9.5e-2 and so on (regularizer part A(x-x0)**2=0.91). For instance.

But if it calculates in real and imaginary part of Fourier transform no meaning what space I use - and this function is used to find variance - then I'm not sure how to find error bars and variance matrix I need.

There are many other questions and limitations, I want to make this calculation approximately with what I can (constaint noise, may be +bkg part as Ifeffit gives, two or more spectra - and the other things later), but I hope  someone could help the beginner to solve this problem or find the simplest way in existing software... I need to know what is the stage of this topic and need I end my program for it or not. There in mind are such things as mu0 polynome fit, many-spectra fit with PDF and diffraction spectra for model and so on, but may be there is the best program in one step from completeness and I need not to do it.

Thanks sincerely,
Olga Kashurnikova (from MePHI XAFS group in Moscow)