Hi all,
I have a nonlinear function
function model(params, args)
# params define a matrix which is then diagonalized
# output are eigenvalues and some function of the eigenvectors
return out1, out2
# both outputs out1,out2 are arrays of size 14x1
# the size can be 14xn, depending on args
end
for which I would like to fit the values of params, such that a reduced chi2-square cost function
\chi^2 = \frac{1}{N_{\rm dof}}\sum \limits_{i=1}^{14} \sum \limits_{j=1}^{2} \frac{(out_{j,{\rm expt},i}-out_{j,{\rm calc},i})^2}{(\sigma_{j,{\rm expt},i}+\sigma_{j,\rm mod})^2}
is minimized. In other words, the model takes an array of parameters as input and calculates two observables out1, out2 (both are arrays of size 14), which are then compared to experimental values out1_expt, out2_expt. I consider uncertainties of the experimental values, \sigma_{\rm expt}, as well as of the model \sigma_{\rm mod}. In fact \sigma_{\rm mod} is adjusted manually to achieve roughly \chi^2\simeq 1. N_{\rm dof} is the number of calculated values (2x14=28 here) minus the number of parameters.
So far, I have written my own function to calculate the chi-squared as given by the formula above, and then minimized using the Optim.jl package. This works, however, I would also like to have error estimates for the optimal parameter values, as well as a correlation matrix.
In principle, the background is high-energy physics, and there exists already a program called “MINUIT” that would do the job (and much more…). There exists also a Julia wrapper for MINUIT, but in fact it is a Julia wrapper for a Python wrapper for a C++ pacakge, which unfortunately leads to some problems on the workstation which I am running on (I dont have admin rights, and the OS is outdated).
Is there any Julia-package that does the job out of the box? I checked out LsqFit.jl, which calculates all necessary outputs (error estimates,…) , but as far as I understand it is not capable of taking into account the \sigma_{{\rm expt}} and \sigma_{\rm mod} of my case.
One solution I see is to extract the code snippets for the error and covariance matrix from LsqFit.jl and adapt it to my code, but maybe there is already some statistics package that does all of it? Or maybe there is a way to tell LsqFit to consider the experimental and model uncertainties?
Best regards