-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unrealistically large systematic errors on the flux points are assumed to estimate the errors on the model parameters #3
Comments
Hi @cosimoNigro |
Hi |
Thanks @davidsanchez, it would be interesting to check the results also with MCMC fitting. We agreed with @jsitarek just to report the best-fit values of the parameters and to not report the errors on them, as we cannot properly assess the systematic uncertainties on the individual flux points, therefore probably underestimating or overestimating the final error on the parameters. |
Hi, For IACTs (>100 GeV) I think you can apply 30%, this value is used in many U.L. papers, and one can get it from the numbers in the MAGIC performance paper for a reasonable source spectrum. For Fermi however this should be smaller. The energy scale is quite precise for it (2%-5%), and they have a few systematic effect at a few % level, so I think if you use 10% it makes sense. concerning the low energies (optical, X-ray instruments), I have no feeling about systematics, so probably using this 5% from Vandad is the best. Unfortunately this is also the most important number, because those measurements have small statistical uncertainties, so probably the fit will be pulled towards this low state spectra. |
@cosimoNigro As a crosscheck yes. in any case having this in hands never hurt. |
Hi @davidsanchez, all the data are in the sed_path = pkg_resources.resource_filename("agnpy", "data/mwl_seds/Mrk421_2011.ecsv")
sed_table = Table.read(sed_path)
x = sed_table["nu"].to("eV", equivalencies=u.spectral())
y = sed_table["nuFnu"].to("erg cm-2 s-1")
y_err_stat = sed_table["nuFnu_err"].to("erg cm-2 s-1") watch out, some of them have energies and some frequencies in their respective tables. |
Thanks a lot |
Hi def func(data,model,staterror,syserror=None,weight=None):
staterror*=staterror
staterror += syserror**2
staterror = np.sqrt(staterror)
difference = (model.value) - (data)
logprob = difference ** 2 / (
2.0 * (staterror** 2))
return np.sum(logprob),logprob
import sherpa
from sherpa.stats import UserStat
mystat = UserStat(func)
fitter = Fit(sed, agnpy_ssc, stat=mystat, method=LevMar()) |
Hi @davidsanchez |
Hi @jsitarek |
Hello @davidsanchez, @jsitarek as far as I understand from David's snippet, he is minimising I have some questions:
The only trade-off I can think to is a weighted Let me know what you think... |
Hi @cosimoNigro @davidsanchez |
I'll try with chi^2/2 for the errors computation. |
but you should be certain that the code actually expects chi2/2 otherwise the uncertainties would not be computed properly. Either way, despite the comment of Matteo I think the idea was still not to include uncertainties. |
Sure. I agree to not include the uncertainties |
The reduced statistics (even removing a model parameter - I am now fixing the blob radius with the time variability), is high.
Sherpa actually prevents the computation of errors with the confidence method in case the final reduced statistics is larger than 3, see the discussion here.
The only thing I could do to make the reduced statistics smaller (beside freezing one of the model parameters, R_b) was to include systematic errors on the normalisation of flux points.
The ones that I have to include to get a decent fit statistics (<3) are largely overestimated: I am considering 15% for gamma-ray instruments and 10% at lower energies. I think a more correct figure should be 10% at gamma-ray energies and a few percent (1-3%) for lower-energy instruments (i.e. in the X-ray or UV band).
@jsitarek, @davidsanchez, please try the fitting scripts and let me know how we can improve this (freeze other parameters, correct the systematics, re-bin etc...).
gammapy
andsherpa
fits now produce diagnostic plots: stats profile forsherpa
and correlation matrix forgammapy
.I don't produce stats profile for gammapy because it's painfully slow.
The text was updated successfully, but these errors were encountered: