-
Notifications
You must be signed in to change notification settings - Fork 30
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
Incorrect periodogram with multiple terms #28
Comments
Thanks - there have been other issues reporting similar problems. I suspect it's due to some sort of floating-point roundoff issue that pops up at the particular frequency. A 5-term periodogram involves the simultaneous solution of 11 linear equations, so it's not out-of-the-question that such an issue would arise. |
Looking at the data, I suspect it's because you have so many tightly-clustered observations separated by a relatively long time, but I'm not sure what you might do to fix this. |
As it happens it actually picks out the correct period as one of those found using |
Some extra intuition for why this is happening: the periodogram is P = 1 - χ² / χ²ref where χ² is the minimum chi-square about the best multiterm periodic model, and χ²ref is the minimum chi-square around the best constant model (i.e. the weighted mean). Theoretically, you should always have 0 ≤ χ² ≤ χ²ref, because the periodic model has more model complexity and thus should never do worse than a flat line. If numerical instabilities lead to a suboptimal fit, however, you may converge to a model that is worse than the weighted mean, which leads to the situation you're seeing. |
Thanks for the explanation! |
The code snippet below leads to a periodogram with incorrrect values (less than zero, greater than one). An image showing the periodogram is a little lower down and the data used in the example is here.
The text was updated successfully, but these errors were encountered: