-
Notifications
You must be signed in to change notification settings - Fork 101
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
Fit white noise parameters #1639
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1639 +/- ##
==========================================
+ Coverage 68.40% 68.50% +0.10%
==========================================
Files 104 104
Lines 24151 24264 +113
Branches 4308 4329 +21
==========================================
+ Hits 16520 16622 +102
- Misses 6548 6555 +7
- Partials 1083 1087 +4
☔ View full report in Codecov by Sentry. |
Example:
Pre-fit par file:
Post-fit par file:
|
Prospects for Wideband data? |
and how does this work with correlated errors? |
Rather than defining yet another fitter type, can you make the |
This method should in principle work for wideband also. But I have not gotten that far yet. I think I'll do the wideband version as a separate PR. |
Should work. It should be a separate PR I think. |
I am testing things out at the moment, and don't want to mess with existing code. I'll move the functionality to DownhillWLSFitter once I am confident everything is in order. |
Looks good. There is a slight bias in MJD2_EFAC: is that just random or is it always like that? |
It's also worth discussing whether adding |
Has anybody given feedback on slack about the new requirement? If not, we can probably just include it and I can go ahead and merge this. |
No. |
Please merge this if you think this is OK. |
Is there a notebook or code snipped in the docstring describing how to use this? How to retrieve the full likelihood (not just chi^2) and compute AIC? |
The AIC function is simply used as Similarly, the likelihood function is |
But if somebody is coming into this and wants to understand the full cycle of fit/evaluate, having a short worked example helps. |
OK... I'll add an example. |
WLSNoiseFitter
can do maximum-likelihood estimates of white noise noise parameters (EFACs and EQUADs) along with their uncertainties.This is done by maximizing the normalized log-likelihood function over the timing noise parameters and the noise parameters alternately. The timing model maximization is done using
DownhillWLSFitter
. The noise model maximization is done using the Newton-CG algorithm available in scipy. This requires derivatives wrt noise parameters, which are also implemented here. The noise parameter uncertainties can be computed using the Hessian (obtained usingnumdifftools
).The drawback of this approach is that we can't estimate the covariances between timing model and noise parameters.
Edit: I am also including
Residuals.lnlikelihood()
andutils.akaike_information_criterion
in this PR since the underlying code for those functions are already present here.