Closed ghost closed 5 years ago
Dear Jo.
I guess, you talk about the following:
% see arCollectRes.m:
fiterrors = ( ar.config.fiterrors == 1 || (ar.config.fiterrors==0 && sum(ar.qFit(ar.qError==1)<2)>0 ) );
...
if fiterrors == 1
ar.chi2fit = ar.chi2 + ar.chi2err;
else
ar.chi2fit = ar.chi2;
end
Usually people don't fit experimental errors (sigma parameters) and they expect "chi-square", i.e. a positive number. However, 2log(sigma) can be negative which is confusing in this standard setting. I guess that this was the reason why this negative constant was excluded if there are no error parameters to be fitted.
The following function call provides all terms which play a role for calculating the objective function [m,m2]=arGetMerit
Hi!
I wondered why ar.chi2err is always zero when you do not estimate errors? I.e.: why is it [-2 log(L) = 2ar.ndatalog(sqrt(2pi)) + x^2/sigma^2] and not [-2 log(L) = 2ar.ndatalog(sqrt(2pi)) + 2log(sigma) +x^2/sigma^2]? Shouldn't [2log(sigma)] be included in the log-likelihood regardless of whether experimental errors are used?
Thanks in advance,
Best, Jo
Originally posted by @JoanneJansen in https://github.com/Data2Dynamics/d2d/issues/42#issuecomment-461152269