Docs / nablatensor-quant / com.nablatensor.quant
record
Seasonality
A deterministic annual seasonality function for a commodity log-forward curve: a sum of harmonics of the yearly cycle,
f(t) = sum_{k=1}^{K} ( aCos_k cos(2 pi k t) + aSin_k sin(2 pi k t) )
with t in years. Add f(t) to a model's log-forward; the coefficients are fitted once to the observed forward curve on the host and then held fixed (not differentiated).
Record components
Methods
int harmonics()
double value(double t)
static Seasonality fit(double[] times, double[] values, int harmonics)
Least-squares fit of harmonics harmonics to (times, values) by the normal equations. values are the seasonal residuals of the log-forward curve (curve minus its smooth trend).