Wrong weigths computation induces MathIllegalStateException when computing PredictedEOPHistory
Earth Orientation Parameters prediction is based on fitting past EOP history to build models that can be used in the near future after end of history.
The SingleParameterFitter
javadoc states that the weights of the EOP history entries is e^\frac{t-t_0}{\tau}
, and explains points far in the past before t_0
have small weights, hence implying t_0
is the fitting date and corresponds to the latest date in the history.
This is however not true, inside the code t_0
is the date of the first used entry, which is the fitting date minus the fitting duration. This implies that t-t_0>0
for all points and the points closest to the end of the sample have very large weights. In fact, rather than having weights close to 1.0 near fitting date and decreasing exponentially when we go far in the past, we have weights that are close to 1 at the beginning of the fitting interval and that grows up exponentially as we approach the fitting date.
As long as the fitting duration and \tau
have reasonable relative values, this is not really a problem as choosing t_0
either at start or end of the fitting interval just scales up all weights by some exponential constant. This however induces problems if fitting duration is very large with respect to \tau
as the weight will become infinite close to fitting date.
One example is to use a fitting duration of three years and a \tau
equal to one day. The infinite weights generate a MathIllegalStateException
in the curve fitting.
Fixing this just implies putting t_0
to the end of history, which is trivial. With this change, the fitting duration becomes essentially useless, we can just ignore it and rely on the exponential decay of the weight for points far in the past. So we could deprecate the constructor that uses a duration, have it ignore the duration and call a new constructor that does not have any fitting duration.