smooth v4.5.1 (Release date: 2026-08-12)
=======

Changes:
* `vignettes/sma.Rmd` builds its example series with `structure(..., tsp = ...)` instead of the deprecated `.Tsp`. The vignette is tangled into `inst/doc/sma.R` at build time, which is what CRAN's "Found calls to structure() using deprecated special names" NOTE was pointing at. The two spellings produce an `identical()` object, so nothing about the vignette's output changes. It was the only use of a deprecated special name (`.Tsp`, `.Names`, `.Dim`, `.Dimnames`, `.Label`) anywhere in the package.
* `simulate()` warns when a supplied `randomizer` returns error values a multiplicative model cannot admit. Its support is `1 + e > 0`, and none of the distributions ADAM samples from can produce `e <= -1`, so a fitted model never reaches it; only a user-supplied randomizer can, and the state recursion then takes a log of a negative number and returns `NaN` from that point on. The warning names how many values were out of support and what to do about it, rather than leaving a silent field of `NaN` that looks like a defect in the kernel. The `NaN` itself is left in place deliberately: it is the correct report that the simulator was asked for something outside the model, and hiding it behind a complex-arithmetic branch would cost the hot loop on every observation of every optimiser evaluation to protect a case that cannot arise from a fit. The check covers additive-error models on log-space distributions too, where the error is multiplicative in effect.
* `simulate()` on an `om` object started the state recursion from the wrong value. `simulateADAMCore()` seeds from `$profileInitial`, which for `adam` is the head the fitted recursion runs from; `om()` was storing the *pre-fit* seed there, still on the raw probability scale, because `om_initial_transform()` and the backcasting pass both run after it is captured. Every simulated latent value came out scaled by a constant -- on a 60-point `om(MNN, occurrence="odds-ratio")` the whole series was off by a factor of 4.16, the ratio between the transformed head (3.891389) and the raw seed (0.935484). `$profileInitial` now holds the fitted head, matching `adam`. `rmultistep()` and `multicov()` read the same slot and are unaffected in value.
* `om()` no longer truncates the persistence vector to the ETS components. `adam()` reports `alpha` together with the ARIMA `psi` and any xreg `delta`s; `om()` kept only the first `componentsNumberETS` entries, so an occurrence model with ARIMA carried a length-1 persistence against a 2-row state vector. `simulate()` sizes its `g` from that vector, so `simulate(om(y, orders=list(ar=1, i=0, ma=1)))` aborted inside the C++ kernel with `element-wise multiplication: incompatible matrix dimensions: 2x1 and 1x1`. It now returns a series. Note the ARIMA state of a multiplicative-error occurrence model still goes `NaN` on the first simulated step -- the ETS level updates correctly, the ARIMA state does not -- which is a separate defect in the simulator's multiplicative-error ARIMA update and reproduces identically in the Python port.
* `multicov(type="analytical")` on a multiplicative-error ETS with a log or positive distribution (`dgamma`, `dinvgauss`, `dlnorm`, ...) now returns the per-horizon variances on the diagonal, as `forecast()` already did for the same models, instead of the additive closed form from `covarAnal()`. Those models have no usable closed form for the off-diagonal, which is why the interval code takes `adamVarAnal()` there; `multicov()` was the one caller that did not, so the covariance it reported and the covariance the prediction intervals were built from disagreed about the same fit. On `adam(AirPassengers, "MNN", lags=c(1,12))` at `h=4` the diagonal changes from `0.011811, 0.023622, 0.035433, 0.047243` to `0.011811, 0.023761, 0.035853, 0.048087` and the off-diagonal becomes zero. Additive-error models are unchanged, as are `type="empirical"` and `type="simulated"`, and occurrence models keep the full matrix (their `plogis` link is not one of the log/positive distributions). This also matches the Python port, which already dispatched this way: `multicov()` is now bit-identical across the two languages for both analytical and empirical types and every error type.
* `confint()` on a model with multiplicative seasonality reported the wrong interval for every seasonal initial state. The positivity restriction on those initials was applied with `max()` where the values are vectors -- one element per seasonal initial -- so the whole vector of corrections collapsed to a single number that was then recycled across every seasonal row. Each seasonal state ended up with the same two offsets, `-t*min(S.E.)` below and `+t*max(S.E.)` above, instead of its own: on `adam(AirPassengers, "MAM", lags=c(1,12), initial="optimal")` all twelve seasonal intervals came out exactly 0.209049 wide although their standard errors range from 0.028 to 0.078, and none of them was centred on its own coefficient any more. Now `pmax()`, matching the `gammas` / `deltas` branches a few lines above, which always used the elementwise form. The block had been copied from the `trend` one, where the value is a single element and `max()` and `pmax()` coincide. The companion restriction on the *upper* bound is removed rather than fixed: the upper offset is always above the lower one, so it clears `-parameters` automatically once the lower does, in every case including a negative initial. The worst bound on that fit moves by 0.098 (11% relative); `coef()`, `vcov()` and the reported standard errors are untouched. This also closes the last known disagreement with the Python port on `confint()` -- the two now agree to 5e-10 relative across `MAM`, `MAdM`, `MMM` and `AAA`, the same finite-difference floor the standard errors sit at.
* `distribution="default"` now maps every absolute-error loss to the Laplace distribution and every half-moment loss to the S distribution, whatever the reduction over horizons. `MAE`, `MAEh` and `MACE` already resolved to `dlaplace` and `HAM`, `HAMh` and `CHAM` to `ds`, but the trace and geometric-trace variants -- `TMAE`, `GTMAE`, `THAM`, `GTHAM` -- fell through to the switch default and reported `dnorm`, even though they are sums of the same per-horizon reductions. Fixed in all four places the mapping is written (`estimator()`, `preparator()`, the selection branch of `adam()` and `adam-gradient.R`). The reported log-likelihood, loss value and coefficients are unchanged for every loss -- the concentrated likelihood for a multistep loss is keyed off the loss, not off this slot -- so only `object$distribution` and what depends on it (prediction intervals, `extractScale()`, printing) move for those four. This also closes the last disagreement with the Python port, which already grouped them this way: R and Python now report the same distribution for all nineteen losses.
* `plot(which=12)` no longer draws the initial-state rows. The states matrix carries `lagsModelMax` leading rows that hold the *initialiser's seed*, not anything the fitter used -- for a backcast `ETS(ANN)` the level row holds `mean(y)` -- and they have no matching observation, so `cbind()`ing them against the actuals put a spurious spike at the left edge of every states panel. On a 200-point series with level around 100 the level state was drawn starting at 129.99 before dropping to 99.76. Note the seed itself is unchanged and no fitted value or forecast is affected: the level the first fitted value actually came from is 98.9998, which is neither what the states head reports nor what was being drawn.
* `plot()` now routes the squared-residual ACF and PACF (`which=15`, `16`) through the scale model when one has been implanted, as it already did for `which=2:6`, `8`, `9`, `13` and `14`. Those two panels exist to detect heteroscedasticity that is still unexplained, which is precisely what a scale model is fitted to remove, so showing the raw residuals there made a working scale model look like a failed one: on a series whose variance follows a slow cycle, the ACF of the raw squared residuals is 0.36 at lag 1 while the ACF of the standardised squared residuals is 0.005. The plain ACF/PACF (`which=10`, `11`) are unchanged and stay with the location model -- rescaling barely moves autocorrelation -- and so do the structural panels (`1` actuals vs fitted, `7` the series over time, `12` the states), which describe the location model itself; plot the scale model directly for its own versions of those. The note printed at the start of the call now covers 15 and 16 as well.
* `extractScale()` on a model with a `dgnorm` scale model raised `non-numeric argument to binary operator`. `extractScale.smooth` indexed `object$scale$other` -- which is a list, `list(shape=...)` -- where it needs `object$scale$other$shape`. `extractSigma.smooth`, two functions below, already named the element correctly. Every other distribution was unaffected.
* `sm()` now works for occurrence (intermittent) models, which previously could not run at all. Two defects: the cost function referenced `obsZero`, which was never defined in `sm.R`, so every occurrence call died with `object 'obsZero' not found`; and the residual transform assigned over the whole vector (`et[] <- et[otLogical]^2`) when the right-hand side is only `sum(otLogical)` long, so the scale response was recycled across `obsInSample` slots and misaligned (with `number of items to replace is not a multiple of replacement length` whenever the two are not multiples -- e.g. 47 non-zeroes into 60 observations). The transform is now assigned into the non-zero positions, keeping the length and the alignment. The differential-entropy term also dropped its `obsZero` multiplier: unlike `adam()`, where the scale is a scalar and `obsZero*(...)` is the whole term, `sm()` sums a vector of length `obsZero`, so the multiplier counted every zero observation `obsZero` times.
* `adam()`, `es()`, `om()`, `omg()`, `oes()` and `oesg()` gain a documented `smoother` argument (previously an undocumented `...` option). It selects the `msdecompose()` smoother that produces the initial states — the level and trend, together with the initial seasonal indices (and the seasonal profiles for multiple-seasonal models). The **new default `smoother="default"`** resolves to `"ma"` (the centred moving average) when `initial="optimal"` and to `"global"` (a global model fitted to the data) for every other initialisation method; `"ma"`, `"lowess"`, `"supsmu"` and `"global"` force the respective smoother regardless of the initialisation. Resolution happens once in `adam_checkOptimizer()`, so `oes()`/`oesg()` inherit it via `om()`/`omg()`. The previous behaviour was a fixed `"global"` default, so optimal-initialisation fits now seed their seasonals from the classical moving-average decomposition by default.
* `initial="gradient"` for occurrence models `om()`/`omg()` with ARIMA or xreg is now much faster: the Gauss-Newton solve uses an exact analytic Jacobian instead of finite differences whenever the occurrence sub-model(s) are additive-error (`E="A"` — the odds-ratio / inverse-odds default), covering ARIMA, xreg and constant components (their state maps are linear, so one forward pass propagates the sensitivities instead of one pass per free initial). For the coupled `omg()` the two sides' sensitivities are propagated jointly through the shared probability. Measured 1.4–8.3× faster than the finite-difference path (e.g. an `omg()` ARIMA fit 5.0s → 2.8s, an `omg()` two-sided additive-ETS fit 1.1s → 0.13s), and the cleaner Jacobian reaches an **equal-or-slightly-better** optimum, so these fits' log-likelihoods change marginally (e.g. −44.48 → −43.93). Multiplicative-error occurrence with ARIMA/xreg keeps the finite-difference Jacobian; pure-ETS occurrence is unchanged (bit-identical).
* Degrees-of-freedom accounting is now structural and identical across initialisation methods. Backcasted, complete-backcast and gradient-solved initial states count towards the number of estimated parameters exactly as optimised ones do — the identifiable count of the initial-state design — so information criteria are comparable across `initial="optimal"/"backcasting"/"complete"/"gradient"`. Previously backcasting counted its initials as zero (and CES/GUM/SSARIMA used an experimental fractional heuristic behind `dfForBack`, now removed). This changes the ICs of `initial="backcasting"` (the default) and `"gradient"` models — they increase — but rankings within one method are typically unaffected. For ETS the seasonal initial df uses the exact identifiable count (`sum(m_i) − sum(gcd) + …`, inclusion–exclusion over the seasonal periods): for a single or coprime seasonality this is the usual `level + (m−1) per block`, but for **non-coprime multi-seasonal** models (e.g. lags 4 and 8) it is smaller, and this correction now applies to **all** initialisation methods **including `initial="optimal"`** — so those models' ICs change too. `sma()` now counts `order + 1` parameters (an AR with unit-root coefficients: all `order` initials are identifiable), instead of a constant 1, so its order selection now carries a proper complexity penalty. Occurrence models (`om`/`omg`) count their initials the same way.
* The distribution scale is now counted as an estimated parameter for every loss, not only `loss="likelihood"` — every reported log-likelihood is a concentrated likelihood, so a continuous-response model always estimates a scale. Non-likelihood-loss models' degrees of freedom therefore increase by 1 (AIC by 2). Occurrence models (Bernoulli) are unaffected: they have no scale.
* An explicitly-selected `distribution` is now honoured for the reported log-likelihood (and the information criteria) even when the fitting `loss` is a fit-only loss that implies a different distribution. Previously `adam(y, loss="MAE", distribution="dnorm")` reported the Laplace likelihood (the MAE-implied distribution), silently ignoring the requested Normal; it now reports the Normal likelihood, while still fitting by MAE. `distribution="default"` is unchanged — it still follows the loss (MSE↔dnorm, MAE↔dlaplace, HAM↔ds). The loss continues to drive estimation; only the reporting distribution changed. `logLikADAM()` no longer re-overrides the already-resolved distribution.
* New `initial="gradient"` option for `adam()` (and `es()`, which routes through it): a first-class initialisation type that solves for the initial state by least squares instead of the backcasting backward pass. Given the persistence, the in-sample residuals are an affine function of the initial state for additive ETS — the design matrix is propagated analytically alongside a single C++ forward pass and solved by one pivoted-QR least squares — and a smooth nonlinear function otherwise, solved by Gauss-Newton with an analytic Jacobian (initial-state sensitivities propagated by the chain rule through the measurement/transition/update maps in one forward pass, covering both `ets="conventional"` and `ets="adam"` maths) and a Levenberg-Marquardt fallback for ill-conditioned steps; finite differences remain available as an internal fallback and validation oracle. The whole solve is implemented in C++ (`adamCore::gradientSolve`, shared with the Python build) and is stateless, so the objective stays a deterministic function of the parameters. When persistence is provided it is a single solve; when persistence is estimated the optimiser estimates it while the initials are solved by gradient at each evaluation (nested — the backward pass is never run). It avoids a divergence that `initial="backcasting"` can exhibit for seasonal additive models with a trend and a large seasonal smoothing parameter (e.g. ETS(A,A,A) with `lags=12`), where backcasting could return wildly wrong initials and a large in-sample penalty. Supports every additive single-source-of-error model — ETS, additive ARIMA, and the standalone `ces()`/`gum()`/`ssarima()`/`sparma()` (see the dedicated entry below) — plus multiplicative/mixed ETS via Gauss-Newton; xreg and custom-loss specifications fall back to the backcasting fit. Because the initials are genuinely estimated (by least squares), `initial="gradient"` counts them as degrees of freedom, the same as `initial="optimal"`, so its information criteria are comparable; `initial="backcasting"` is unchanged.
* Removed the internal `refineHead` argument from the C++ fitter (`fit`), reapply (`reapply`) and general-occurrence fitter (`omfitGeneral`) methods, and from every R and Python caller. On those three paths the flag was always `TRUE` at every live call site (only speculative commented-out `FALSE` branches remained). Head refinement is now implicit and always applied when `lagsModelMax > 1`. The simulator (`simulate`) keeps a `refineHead` argument because it legitimately has two distinct modes — `TRUE` for `sim.es()` / `simulate.adam()` (raw initialiser + walk the head), `FALSE` for the forecast-interval simulator in `forecast.adam()` (already-fitted state tail, no walk needed). Not a user-visible API change.
* `om()`'s reported log-likelihood and loss value are now cleanly separated. `logLik` is always the Bernoulli likelihood of the fitted probabilities, for every loss — previously, for the fit-only losses (`MSE`/`MAE`/`HAM`) it was taken as `-lossValue` (minus the MSE/MAE itself), which is not a likelihood, so the information criteria for those fits were meaningless. It is now computed from the fitted probabilities in `omFinalFit()` regardless of the fitting loss, with the `pmax(., 1e-15)` floor removed (an infeasible fitted probability surfaces as `NaN`/`-Inf` rather than being clipped). And `lossValue` now always reports the fitting loss evaluated on the final fitted probabilities — e.g. `mean(abs(ot - p))` for `MAE` — computed *ungated*: the infeasibility guard inside the cost (which returns `1e300` when a probability leaves `[0, 1]`) exists only to steer the optimiser and no longer leaks into the reported loss when the loss optimum itself is infeasible. So `initial="gradient"` with a fit-only loss reports the loss it actually minimised, while `logLik` stays the (possibly `NaN`) Bernoulli — the two are allowed to be misaligned. `loss="likelihood"` fits are unchanged; `LASSO`/`RIDGE`/custom keep the optimiser's value.
* `initial="gradient"` now works for the single-model occurrence function `om()` (all occurrence types: `"direct"`, `"odds-ratio"`, `"inverse-odds-ratio"`). Previously it was a silent no-op — the cost function gated the backcast flag on `c("complete","backcasting")` only, so a gradient om fit neither backcast nor solved and left the initials at the creator seed (measurably worse than backcasting). Now the om cost profiles the occurrence loss over the initials via the shared C++ solve: the Bernoulli likelihood reduces to `-log(1-|r|)` in the probability residual `r = o - p` (a new separable rho), and MSE/MAE/HAM reuse the standard rho family on `r`. The solve runs the occurrence recursion (`occurrenceError`) forward while propagating the state sensitivities analytically through the link and error channels — a new occurrence Jacobian pass. Result: om gradient reaches optimal-quality likelihood at backcasting cost (e.g. MNN odds-ratio on a 120-obs series, logLik −75.00 gradient vs −75.00 optimal vs −80.26 backcasting). Occurrence `"fixed"` has no estimated initials and is unaffected; om with ARIMA/xreg or a custom loss falls back to backcasting. The two-model `omg()` is not yet covered (its coupled solve is separate).
* `initial="gradient"` now profiles the actual estimation loss over the initial states instead of the one-step SSE surrogate. At fixed persistence every supported loss reduces to a sum of per-observation rho functions of the residuals, mapped to the C++ solve: MAE / `dlaplace` (|e|), HAM / `ds` (sqrt|e|), `dgnorm` (|e|^beta), and — for multiplicative-error models — the exact `dlnorm`, `dgamma` and `dinvgauss` likelihood rho with the scale concentrated out. For additive ETS the robust losses are solved by IRLS sweeps on the affine surrogate (each sweep is one weighted QR, no extra model passes; exact-zero residuals are dropped from the sweep — no epsilon floors), and the multistep losses (`MSEh`, `TMSE`, `MSCE` one-shot; `GTMSE`, `GPL` by monotone majorise-minimise sweeps) are solved on the affine multistep design replicated from the same recursion the cost function evaluates. For multiplicative/mixed models the Gauss-Newton step becomes loss-aware (IRLS weights for the power losses, Newton weights for the likelihood ones), which fixes the remaining objective mismatch — e.g. ETS(M,A,M) with the default Gamma likelihood now beats backcasting on the likelihood itself. `loss="likelihood"` with `dnorm`, `MSE` and everything else without a matching rho keep the previous (exact for `dnorm`) SSE profile; custom loss functions cannot cross into C++, so `initial="gradient"` falls back to backcasting with a one-time message. Multiplicative multistep is out of scope and keeps the one-step profile.
* `omg()`'s reported `fitted`/`residuals` and `logLik` are now mutually consistent. The fitted probability is taken from the **coupled** recursion the optimiser minimised (re-running the joint cost at the final parameters) instead of re-combining the two standalone per-side refits, which only approximate it; and `logLik` is the Bernoulli of that same coupled probability, so `sum(o·log p + (1−o)·log(1−p))` now equals the reported `logLik` exactly. Previously the reported `fitted` (standalone-combined) and `logLik` (coupled cost) disagreed. This changes the numeric `fitted`/`residuals` of every `omg()` fit; for `loss="likelihood"` the `logLik`/IC are unchanged, and for the fit-only losses `logLik` is now a proper Bernoulli (as in `om()`). The sub-model objects `modelA`/`modelB` are unchanged (still standalone fits, for parameter diagnostics).
* `initial="gradient"` now works for the occurrence models `om()` and `omg()` with ARIMA and/or xreg components, not just pure ETS. The analytic Jacobian companions cover ETS only, so on the occurrence path the Gauss-Newton solve drops to its finite-difference Jacobian when ARIMA / xreg / a constant is present — the FD pass runs the fully general occurrence recursion, so the initials (including the regression coefficients) are still profiled by the occurrence loss. The two-model `omg()`, previously not covered at all, gains a coupled solve (`adamCore::gradientSolveGeneral`): its two sub-models share one fitted probability `p = aFit/(aFit+bFit)`, so their initial profiles are solved *jointly* over the shared probability residual by Gauss-Newton (finite-difference Jacobian, line search + Levenberg-Marquardt). At fixed dynamics the gradient fit reaches optimal-quality likelihood and beats backcasting (e.g. an `omg()` ARIMA fit on a 120-obs series, logLik −44.5 gradient vs −46.8 backcasting). The `"direct"` occurrence link can saturate the probability at the seed (`|r|=1`), in which case the solve correctly falls back to backcasting; custom losses fall back as before.
* `initial="gradient"` now extends beyond ETS to every additive single-source-of-error engine: additive ARIMA in `adam()` (`orders=...`), and the standalone `ces()`, `gum()`, `ssarima()` and `sparma()`. For these models the in-sample residuals are also affine in the initial state, so the same analytic-design pivoted-QR least-squares solve applies — one C++ forward pass, no backward pass — with each state's lag slots treated as free initial parameters (the rank-revealing solve drops redundant directions). At fixed dynamics the gradient fit matches the optimal-initials SSE and beats backcasting, and it is often more robust than optimising the initials directly (e.g. a `gum()` fit whose optimal-initials SSE diverged to ~9700 solves cleanly to ~370 by gradient). Multiplicative-error ARIMA still takes the ETS Gauss-Newton path and falls back to backcasting; xreg and custom-loss specifications fall back as before.
* `initial="gradient"` now solves the **xreg (regression) initial coefficients** for additive-error models, instead of falling back to backcasting. The coefficients are additional affine directions in the initial-state design (their measurement is linear, `ŷ += a·x`), so the same one-pass least-squares solve recovers them — jointly with the ETS/ARIMA initials — matching `initial="optimal"` to numerical precision and beating backcasting. Both static (`regressors="use"`) and adaptive (`regressors="adapt"`, where only the initial coefficient is solved and the adaptive persistence stays in the optimiser) are covered. Fixes a bug where the gradient dispatcher was never told the number of regressors, so the xreg cells were silently dropped from the solved design. Multiplicative-error xreg (which would need the finite-difference Gauss-Newton path, whose noise can converge poorly) still falls back to backcasting, as does multiplicative-error ARIMA. Degrees of freedom are unchanged (the xreg coefficients are counted once, as before).
* `vcov()`, `confint()`, `summary()`, `reapply()` and `reforecast()` gain a `type` argument — `"opg"` (**the new default**), `"hessian"` or `"bootstrap"` — selecting how the parameter covariance is computed. `type="opg"` computes the OPG/BHHH covariance `J = sum_t s_t s_t'` (the outer product of the per-observation scores) instead of inverting the observed Fisher Information (`type="hessian"`, the previous default). Because `J` is positive semi-definite by construction, it returns finite standard errors at boundary estimates — where a smoothing parameter is pinned at a bound and the numerical Hessian is indefinite (the usual cause of the "Observed Fisher Information is not positive semi-definite" warning). It covers every engine: `adam()` (ETS/ARIMA/xreg, with the initials scored only under `initial="optimal"` and re-derived otherwise), `ssarima()`, `ces()`, `gum()`, `sparma()`, and the occurrence models `om()` / `omg()` (Bernoulli / coupled-Bernoulli score). Each re-fit is checked to reproduce the fitted log-likelihood before its scores are used, falling back to the Hessian if it cannot. Central differences drop to a one-sided difference at a bound where the feasible region is left (a negative persistence gives `NaN` under the occurrence link); a parameter the data cannot identify (an initial that washes out at a boundary smoothing parameter) gets an infinite OPG variance, and `reapply()`/`reforecast()` hold such parameters at their estimate for the refit. The new `pointLik.om` per-observation likelihood underpins the occurrence path. **The `bootstrap=TRUE` switch is deprecated** in favour of `type="bootstrap"`; it still works but warns. (See Berndt, Hall, Hall & Hausman, 1974, for the OPG/BHHH estimator.)
* `sparma()` now honours a supplied `arma=` argument by **holding** those coefficients fixed (previously providing them silently re-estimated from a PACF/ACF start, ignoring the supplied values), and a numeric `initial=` now holds the provided ARIMA state initials (front-padded to the dense companion length), so a fitted `sparma` object's coefficients round-trip exactly when supplied back. This is what lets `vcov(..., opg=TRUE)` re-fit a `sparma` model.

Bugfixes:
* The ARIMA order selection tested IMA(d,d) candidates that exceeded the requested MA orders. These candidates set the MA order equal to the differencing one, so a combination is only usable when d fits under `maMax` at every lag, but the filter assigned each lag's verdict instead of accumulating it (`modelsLeft[] <- (...)` where it needed `modelsLeft & (...)`), so only the last lag's condition survived and every non-seasonal one was discarded. With `orders=list(ar=0, i=c(2,1), ma=c(1,1))` and `lags=c(1,4)` the search fitted IMA orders (2,0) and (2,1) -- MA order 2 at lag 1, twice what was asked for -- and (2,0) scored better than every legal candidate, so it would have been selected. Now only (1,0), (0,1) and (1,1) are tested. The defaults hide this (`ma=c(3,3)` is never below `i=c(2,1)`), so it needs an explicit `ma` lower than `i`, and at least two lags. Correcting the filter can leave a single row, so the loop over the candidates is guarded accordingly.
* The small-sample model pool could contain multiplicative-error models on data that does not admit them. When the sample is too short for the full pool, `parametersChecker()` builds an explicit pool; `MNN` was correctly added only when `allowMultiplicative`, but `MAN`, `MAdN` and `MNA` were added unconditionally alongside their additive counterparts. On a series containing a zero or a negative value those three were still offered to the selection. They are now gated on `allowMultiplicative` like the rest, so such a series gets a purely additive pool (`ANN, AAN, AAdN, ANA`).
* The optimised ARIMA initial state was silently discarded for a **pure MA** model — no AR terms and no differencing, e.g. `orders=list(ar=0,i=0,ma=1)` — under `initial="optimal"`/`"two-stage"`. `filler()` writes the initial states with `matVt[componentsNumberETS+nonZeroARI[,2], ...] <- ...`, and `nonZeroARI` is built from the ARI polynomial with its leading term dropped (`adamGeneral.R:421`); for a pure MA that polynomial is just `1`, so `nonZeroARI` has zero rows and the indexed assignment writes **nothing**. The counter `j` still advanced, so the initial state consumed a degree of freedom and was handed to the optimiser while having no effect on the likelihood at all — it drifted to arbitrary values (1364.36 from one starting point, 3639.02 from another, both reporting exactly the same log-likelihood) while the fit silently used the creator seed throughout. On M3 N250, `ARIMA(0,0,1)`: the reported `logLik` of -158.028341 is the likelihood at the *seed* 4317.0588, not at the reported `ARIMAState1` of 1364.36 (which is -156.566). With the polynomial equal to 1 the general expression degenerates to the parameter itself, which is now written into the state the initialiser read it from; the same series reaches -154.934813, matching Python exactly. Models with any AR order or any differencing were never affected, since their ARI polynomial has non-zero lagged terms.
* The same empty-`nonZeroARI` no-op appeared a second time, in `creator()`: the step that debiases the ARIMA initial states by the constant is indexed the same way, so for a pure MA it debiased nothing. The state was left seeded at `mean(y)` while the constant was *also* seeded at `mean(y)`, making the first fitted value double count the level (`yhat[1] = 2 * mean(y)`). It now falls back to every ARIMA row, which is what the ARI rows amount to whenever they exist. Together with the `filler()` fix above this closes the last R/Python gap on ARIMA: across 528 configurations (6 M3 series x 11 order sets x constant x ETS/no-ETS x `initial="optimal"`/`"backcasting"`) the two implementations now agree **bit-for-bit on 528 of 528**, up from 513. Note that the debiased seed is the principled one but is not always the luckier one: on M3 N250 `ARIMA(0,0,1)` with a constant the old seed happened to reach -118.664 within the default `length(B)*40` evaluations while the corrected seed reaches -124.121 there. Both converge to the same optimum (-118.6641) once the budget is raised, so this is a starting point, not an optimum, that changed.
* The ARIMA order selection used by `auto.adam()`, `auto.msarima()`, `auto.ssarima()` and `auto.om()` refitted the winning specification from a **warm start**, carrying the parameter vector of the search's best trial into the final fit. The selected model therefore did not reproduce: `auto.msarima(M3[[220]]$x, initial="optimal")` returned `ARIMA(0,2,2)` with a log-likelihood of -137.828, while asking for that very model directly — `msarima(x, orders=list(ar=0,i=2,ma=2), lags=1, initial="optimal")` — gave -138.366. Both fits stop on `NLOPT_MAXEVAL_REACHED` at the same budget, so the warm start was not finding a better optimum, only moving where the optimisation was truncated. It also left `bestIC` — taken from the cold trial fit — describing a different fit than the `bestModel` returned beside it. The winner is now refitted cold, exactly as a direct call with those orders would be, so a selected ARIMA(p,d,q) and an explicitly requested one agree. Across 43 yearly M-competition series the two now match on 43/43 (8 differed before, by up to 1.63 log-likelihood units). Selection itself is unchanged: the trial fits inside the search were always cold, so the information criteria driving the choice are the same. The optimiser budget is untouched.
* `vcov(ces(...), type="opg")` silently fell back to the Hessian-based covariance for every **seasonal** CES with backcast or complete initials — 6 of the 16 seasonality x initialisation combinations — warning "The OPG covariance could not be computed for this model" and returning a matrix of the right shape, so the fallback was easy to miss. The OPG path re-fits the model through `ces(model=object)` and checks that the re-fit reproduces the fitted log-likelihood before it trusts the scores; that re-fit could not. It hands the backward pass `t(object$states)`, whose head is the *refined* head for `lagsModelMax > 1`, not the creator seed the original fit backcast from, so it landed on different initials (e.g. `seasonality="partial"` on M3 N2217: -470.0079 reproduced against the fit's -470.0920). The re-derived-initials branch now reseeds the state head from `creator()`. All 16 combinations return a genuine OPG covariance with no warning. `seasonality="none"` was never affected — with `lagsModelMax == 1` there is no head to refine — and `initial="optimal"`/`"two-stage"` were immune because their initials travel in `B` and overwrite the head at every evaluation.
* `ces()`'s reported log-likelihood was `-lossValue` for every non-likelihood loss — `loss="MAE"` on M3 N2217 reported `logLik = -63.90` (minus the MAE itself) against the likelihood fit's `-468.79`, so the AIC/AICc/BIC/BICc of any fit-only-loss CES were meaningless and could not be compared with anything. This is the same defect already fixed for `om()` and `adam()`. It is now a concentrated likelihood in every case. For the single-step losses that is the **Normal** likelihood re-evaluated at the fitted parameters: CES is a Normal-error model throughout — its scale, its density and its prediction intervals are all Normal — so there is no loss-implied distribution to switch to, exactly as in `es()`, which pins `distribution="dnorm"` for the same reason (`adam()` follows the loss only because it has a `distribution` argument to follow). For the multistep losses (`MSEh`, `TMSE`, `GTMSE`, `MSCE`, `GPL`) it is the predictive likelihood of the GPL paper, rescaled from `T-h` to `T`, matching `adam()`. `loss="likelihood"` is unchanged. `CF()` gains a `CFgeneric()` inner form taking `loss`/`bounds` as arguments so the likelihood can be re-evaluated on the very same fit — `nloptr` validates its objective's formals, so the optimiser keeps the fixed-arity wrapper. `vcov()`/`summary()` benefit too, since the observed information is now taken on the likelihood surface rather than on an arbitrarily scaled loss.
* `ces()` accepted a `b` of the wrong shape for the seasonality. `seasonality="full"` needs a complex second smoothing parameter, but a real one was passed straight through and surfaced only as a `1e+300` penalty masquerading as a fit (`logLik` of `-1.1e+100` and a meaningless `a`); `seasonality="partial"` needs a real one, and a complex value had its imaginary part silently discarded while `$parameters$b` echoed the full complex number back. Both are now errors naming the expected shape. `"none"` and `"simple"` have no second smoothing parameter, so a `b` supplied there is dropped with a warning instead of being stored on the fitted model.
* `ces()` errored with "non-numeric matrix extent" whenever the smoothing parameters were supplied (`a=`, and `b=` for seasonal models) together with backcast or complete initials — the branch that skips estimation called the internal `creator()` with two positional arguments missing (`lagsModelSeasonal`, `nSeasonal`), so every later argument bound one slot early and `xregNames` ended up as a matrix dimension. The documented `a=` / `b=` arguments were therefore unusable on that path. Handing a model back its own fitted `a` now reproduces its log-likelihood exactly, and provided parameters correctly drop out of `nparam()`.
* `ces(seasonality="simple")` did not count its complex smoothing coefficients. The "simple" branch assigns `a0+ia1` per seasonal frequency but never added them to the parameters table, so `nparam()` was two short of the value `logLik()` carries as its degrees of freedom (25 vs 27 for a monthly series) — and under `initial="optimal"` `nparam()` came out *below* `length(coef())`, which cannot be right. `AIC(model)` (which goes through `nparam()`) therefore disagreed with `AIC(model$logLik)` by 4. Because `auto.ces()` selects with `sapply(CESModel, IC)`, CES(simple) was given a free two-parameter head start: on 94 M3 quarterly series the selection changed on two of them (N0865 now picks `partial` over `simple`, N1177 `none` over `simple`). Only `seasonality="simple"` was affected; `none`/`partial`/`full` already counted correctly.
* `vcov(ces(..., seasonality="partial"), type="opg")` errored with "subscript out of bounds". `covarOPGces()` counted the smoothing coefficients with a `^(alpha|beta)_[01]$` pattern, but the partial-seasonality `b` is real and named plainly `beta`, so it was not counted and the initial-state coefficients were indexed from an offset one too low. The count now matches on the prefix, and the real `b` is perturbed like the complex one. `none`/`simple`/`full` were unaffected.
* `vcov(model, type="opg")` scored the ETS seasonal initial states along an unconstrained direction. Only the first `m-1` seasonal initials are free — the last is fixed by the normalisation (sum = 0 additive, product = 1 multiplicative), which is exactly how the estimator parameterises them — but `covarOPG()` perturbed one seasonal initial and left the last untouched, stepping off the constraint surface. The observed-Fisher path (`type="hessian"`) always differentiated in the constrained B space, so the two covariances disagreed for every seasonal model with `initial="optimal"`. The perturbation now lets the last slot absorb the change. Non-seasonal models, and any model whose initials are not estimated, are unaffected.
* `vcov()` on an `adam` model where nothing is estimated directly — e.g. `adam(y, "AAA", initial="backcasting", persistence=p)`, where the persistence is provided and the initials are backcast — now returns an empty (0x0) matrix instead of a full matrix of `Inf` over the provided persistence and the backcast initial seeds. `vcov()` spans exactly `coef()`, so the initial-state columns appear only when the initials are genuinely estimated (`initial="optimal"`, and `"two-stage"` which optimises them); they are never present for backcasting / complete / gradient / provided initials. `summary()` and `confint()` on such a model no longer error. (`om()`/`omg()` and the Python side already behaved this way.)
* Degrees of freedom are now counted correctly when nothing is optimised — the "use" path taken when the persistence (and/or the ARMA / smoothing parameters) are supplied together with a non-optimal initialisation. `adam(y, "AAA", initial="backcasting", persistence=p)` reported `logLik(df=1)`; it now reports the identifiable count of the backcast/complete/gradient initial states (13 for a monthly AAA) plus the distribution scale, matching the estimated-persistence fit minus the provided smoothing parameters. The same class of bug is fixed on every estimator-free path: `om()` (Bernoulli, no scale), the standalone `ces()`, `gum()` and `ssarima()` (their "use provided values" branches hardcoded `df=1`), and `omg()`, whose joint df additionally never counted the two sides' backcast initials at all — even with estimated persistence — so an `omg("AAA","AAA")` backcasting fit went from `df=6` (persistence only) to `df=32` (persistence + both sides' initials). The ETS/ARIMA/xreg counting is now centralised in a shared `dfInitialsBackcast()` helper, and the `omg()` sub-model objects report the same per-side df a standalone `om()` would. A reused fitted model (`adam(data, model)`) is excluded from this count: its initials come straight from the provided model (`profilesRecentProvided`) rather than being backcast, so `nparam()` of a reused model stays at 1 (the scale) as before.
* `vcov(model, type="hessian")` (and `summary()`/`confint()`) on a **sparse-order** `sparma()` fit — e.g. `orders=list(ar=2, ma=1)`, where a lower-order AR/MA coefficient is absent — no longer errors. The observed-Fisher path re-fitted the model through `adam(model=object)`, whose dense ARIMA-polynomial reconstruction produced an `NA` for the sparse structure (`"missing value where TRUE/FALSE needed"`). `sparma` now computes its observed Fisher Information natively, by a numerical Hessian of its own log-likelihood at the estimate, so `type="hessian"` returns a finite covariance for every order combination. `type="opg"` (the default) was already unaffected.
* `vcov()` on an `omg()` object (and therefore `confint()`/`summary()`) was computed at a mis-reconstructed re-fit: the covariance path re-supplied each sub-model's persistence/phi/arma as fixed values, which flips their estimate flags off so the filler stops consuming those slots from the joint parameter vector and shifts it — a boundary `alpha=0` pushed a level initial to 0 and the re-fit log-likelihood drifted from the original (e.g. −83.91 vs −83.03). The A/B split of the joint vector also used the initialiser's reduced parameter count instead of the fitted-object count, leaking one side's parameters into the other. The re-entry now keeps every coefficient estimated and fed back from the joint vector, so `omg(model=object)` reproduces the original fit exactly, correcting the reported standard errors.

smooth v4.5.0 (Release date: 2026-06-19)
=======

Changes:
* Retired the legacy occurrence ETS implementation: `oes_old()`, `oesg_old()`, `is.oes()` and `is.oesg()` are no longer exported. Use the `oes()` / `oesg()` wrappers (backed by `om()` / `omg()`) for any new code — they cover every occurrence type (`"fixed"`, `"odds-ratio"`, `"inverse-odds-ratio"`, `"direct"`, `"general"`, `"auto"`) the legacy path supported. The `ets=` argument on the new wrappers selects the ETS update mechanism (`"conventional"` vs `"adam"`) and is unrelated to the legacy code path.
* Removed the four legacy C++ entry points (`occurenceFitterWrap`, `occurrenceOptimizerWrap`, `occurenceGeneralFitterWrap`, `occurrenceGeneralOptimizerWrap`) in `src/ssOccurrence.cpp`; the inline header helper `occurrenceError()` in `src/headers/ssOccurrence.h` is preserved (still used by the `om()` / `adam()` paths).
* Dropped the unreachable S3 methods `forecast.oes`, `plot.oes`, `print.oes`, `pointLik.oes`, `modelType.oesg` since no live producer of class `"oes"` / `"oesg"` remains. `sim.oes()` and the `"oes.sim"` class (used by `om()` / `omg()` simulator output) are unchanged.

NOTE: any user code calling `oes_old()` / `oesg_old()` / `is.oes()` / `is.oesg()` directly, or relying on deserialising stored `"oes"`-classed objects, will need updating. The recommended replacement is `oes()` / `oesg()` for fresh fits.

Bugfixes:
* Backcasting with ARIMA models that include a constant now flips the sign of the drift during the backward pass whenever the total order of differencing (`d + D` across all lags) is odd — the direct ARIMA analog of the ETS trend reversal (`b -> -b`), since time reversal changes the drift of an integrated series by `(-1)^(d+D)`. Previously the drift pushed the backward pass in the wrong direction, biasing the backcast initial states of drifted I(1)-type models; e.g. `adam(BJsales, "NNN", orders=c(0,1,1), constant=TRUE, initial="backcasting")` now estimates the constant at ~0.419 (sample mean of differences: 0.420) with an improved likelihood. Models with even `d + D` (e.g. SARIMA(0,1,1)(0,1,1)[12] with constant) are unaffected by construction.
* `sim.es()`, `simulate.adam()`, `simulate.om()` and `simulate.omg()` now apply the same seasonal-head trend refinement that `adam()` / `es()` do at fit time. Previously, simulations from trended-seasonal models (e.g. ETS(A,A,A) with `lags = 12`) started from an un-walked initial level, so the first `lagsModelMax` simulated observations were offset by roughly `(lagsModelMax - 1) * trend` relative to the fitter's fitted values. Simulated series drawn from a *fitted* trended-seasonal model will now be numerically different from those drawn on prior versions — this is a correctness fix, not a behaviour break.
* `om(y, occurrence="general", silent=FALSE)` (and `omg(y, silent=FALSE)`) with the default `h=0` no longer error out in the diagnostic plot. Previously `omg()` left `$forecast=NULL` on the result, and `plot.smooth` would then strip the slot from its `do.call(graphmaker, ...)` call, causing `argument "forecast" is missing, with no default`. Now mirrors `om()`'s convention: when `h=0`, `$forecast` is a one-element `ts(NA)` / `zoo(NA)` placeholder.


smooth v4.4.5 (Release date: 2026-05-27)
=======

Change:
* msdecompose() now routes its two OLS calls (global smoother and missing-value imputation) through a shared C++ helper (olsCpp), implemented via pivoted QR with a scale-invariant rank cutoff in src/headers/olsCore.h. The same header is now used by the Python build, so the OLS step gives the same result on both sides. The QR backend changes from LINPACK (.lm.fit / dqrls.f) to LAPACK (Armadillo / geqp3), which can shift the seeded initial level / trend by a few ULPs versus prior versions on multi-parameter ETS models fitted with initial="optimal" / "two-stage".
* om() function that implements the occurrence model. This substitutes oes() completely, having as much functionality as the adam() function does in comparison with es().
* adam() now calls for om() by default, not oes().
* auto.om() function to select occurrence and/or ARIMA orders.
* om() supports all types of occurrence and does automatic selection via auto.om().
* vcov, confint and summary methods for the om class.
* coefbootstrap for the om class.
* We now use our own hessian function and no longer rely on pracma.
* Changed how scale is calculated for the Log Normal distribution in case of the exotic additive error - we use complex numbers :D.
* MSE/MAE/HAM/RIDGE/LASSO and custom losses in om() and omg().
* Hessian calculation is now done internally using a C++ function with relative steps (not absolute as in pracma). This should get slightly better estimates of covariance matrix.

Bugfixes:
* forecast.adam() would not do the correct row repetition for explanatory variables when the new values are not provided.


smooth v4.4.1 (Release date: 2026-02-26)
=======

Changes:
* ETS now produces point forecasts with forecast() method. Previously it would produce conditional means, which would explode in case of models with multiplicative components. But why bother honestly, when point forecasts are more stable?!

Bugfixes:
* Fixed the calculation of the number of estimated parameters in case of combined ETS.
* A failsafe for models with lb>B or ub<B.


smooth v4.4.0 (Release date: 2026-02-05)
=======

Changes:
* Removed the old es(), ssarima(), msarima(), ces() and gum(). We now use the ones that use ADAM core.
* sim.es(), sim.ces(), sim.ssarima(), sim.gum() now use the adamCore.
* Removed the redundant old C++ code.
* testthat for sparma().
* Modified the adamCore class to include the number of components as one of the external parameters. This is to avoid duplications.
* msdecompose() now has smoother="global" which fits the global trend to the data.
* msdecompose() now returns initial similar to how it's done by adam(). It also amends the level component to help ADAM.
* adam() now uses initial list from msdecompose instead of separate variables.
* adamCpp is now returned by adam() and other functions.
* Documented loss="GPL" correctly.
* Use bounds="usual" in gum() by default.

Bugfixes:
* A fix in sparma to allow high orders.
* ces() had wrong matrices in case of seasonality="simple".
* reapply() now works with CES. reforecast() does as well in general.
* Bugfixes in sparma() with zero orders etc.
* RIDGE/LASSO would not work with X because of the wrong calculation of the denominator.


smooth v4.3.2 (Release date: 2025-12-23)
=======

Changes:
* smooth functions now use a new C++ class called "adamCore", which implements all the necessary methods for fit, forecast etc. This change does not affect the functions' performance but allows the core to be used in both R and Python.
* msdecompose() now also returns gta and gtm, which correspond to the parameters for the Global Trend, Additive and the Global Trend Multiplicative models. This is needed for adam().
* New ETS initial values to make sure that the backcasting produces sensible values for the global level models.
* Removed some heuristics in adam() for the initialisation on small samples - this is now handled by the msdecompose.
* lowess is now the default smoother in adam(), when calling for the msdecompose. This is better than "ma" because it saves the sample and is more robust.
* Tuning of the backcasting initialisation of ADAM. This should fix the problems for ADAM ARIMA and some ETS models.
* New calculation for the number of estimated states in case of backcasting. They now can be fractional. This is based on the discount matrix. This should fix the small sample bias.
* New function, sparma(), implementing the sparse ARMA, i.e. the one that has only specific p and q, and nothing below them. e.g., SpARMA(2,3) is: y_t = phi y_{t-2} + theta e_{t-3} + e_t.
* adam() et al. now use smoothEigens() function to check admissible bounds.

Bugfixes:
* Fixed the issue with reusing the initials in gum, ces, msarima and ssarima.


smooth v4.3.1 (Release date: 2025-10-05)
=======

Changes:
* es() now has model="ZXZ" by default.
* adam() now has the parameter "ets"", allowing to select between two formulations: conventional and adam. We will switch adam() to the "adam" one starting from 4.5.0. es() will always use the "conventional". For now, we are testing the new one to see how it performs.
* rmultistep() can now return additive or multiplicative forecast errors depending on what user asks.
* ces() works with provided parameters again.
* Tuning of Hessian calculation for CES.
* ces() now supports multiple seasonalities.
* New initialisation of smoothing parameters in adam(). This guarantees that models do not break with backcasting, but leads to slight deterioration in accuracy due to selection of different models.
* Allow seasonal ETS on very small sample (e.g. with lags=12 on 12 observations in case of backcasting).

Bugfixes:
* A fix for adamX with a special case, when formula is provided, the data is a matrix and there are partial matches in names of variables.
* rmultistep() and multicov() now work with CES and GUM.
* Fixed a bug in the logic of the C++ function Errorer which would lead to the wrong forecast error matrix. This impacted rmultistep() and multicov() functions.
* Fixed a bug in msdecompose where the seasonal profile would not be recorded correctly for the multiple seasonal cases.
* SARIMA(0,1,0) now works on small data, producing Seasonal Naive in adam().


smooth v4.3.0 (Release date: 2025-06-30)
=======

Changes:
* ATTENTION! initial="backcasting" is now the default method in all smooth functions.
* All smooth functions now have the same initialisation mechanism.
* New initialisation mechanism called "two-stage" in adam(), where "backcasting" is used to get initial values before the optimisation is done. Slower but leads to better calibrated predictive distributions in ADAM.
* New ADAM ETS with different maths behind it. This should make the model more robust, especially in case of multiplicative trend. es() uses the conventional models, adam() uses the new ones.
* ssarima() now uses adam engine.
* All older functions now use adam engine.
* We no longer renormalise the initial parameters of xreg in case of models with factors. This is to avoid weird disalignment between the estimated parameters and states.
* The colours for plots are now selected from the used palette instead of being hard coded. This is to make things consistent with greybox.

Bugfixes:
* auto.adam() now allows selecting the best distribution for a user-specified ARIMA.
* Fixed vcov() calculation for adam with initial="backcasting".
* Further fixes in vcov() for adam with initial="backcasting".
* A fix for auto.ces() not working properly, when called without loading the full package.
* Some bugfixes for SSARIMA + more consistency in "refine head".
* A bugfix in reapply() for the initial!="backcasting".
* Fixes of bugs in adam() with explanatory variables, which are dropped by alm().


smooth v4.2.0 (Release date: 2025-04-02)
=======

Changes:
* A better visualisation of forecasts in case of cumulative ones.
* model="SSS" in adam() and es(), which restricts the pool to the standard models. model="SXS" corresponds to the pool from the ets() function in the forecast package.
* ces() now uses adam() engine instead of the old one. It lacks some functionality (e.g. variable selection, provided initials, occurrence model), but works in general quite well. If you want more features, please file an issue on Github.
* gum() now also uses adam() engine, has more flexibility, but also lacks some functionality (variable selection, occurrence model). Let me know if anyone needs that.
* adamFitter() now has a refineHead parameter, which explicitly says whether the head of the state vector should be refined or not. This is an internal thing, but it is needed by several functions (adam(), ces(), gum()).


smooth v4.1.1 (Release date: 2025-02-03)
=======

Changes:
* We now initialise seasonal ETS with a higher smoothing parameter (0.3).
* msdecompose() now does decomposition using ma/lowess/supsmu - regulated with the smoother parameter. This still requires tuning.
* adam() now uses msdecompose with lowess to extract initial seasonal indices.

Bugfixes:
* Corrected the author details in the documentation.
* reapply() would not work with bootstrap in case of negative data. Now it does.
* Added a check in adam() to make sure that model is not estimated when all parameters are provided in case of ARIMA.
* Tried to fix the issue with UBSAN, but not sure whether it worked, because it is not possible to reproduce it on my PC or github Actions... Just praying that it works.


smooth v4.1.0 (Release date: 2024-10-01)
=======

Changes:
* New initialisation mechanism for ARIMA in case of initial="optimal". Now we do backcasting in the first step and then grab what we got and optimise.
* nIterations for the backcasting is now set outside the C++ code, can be provided as a parameter in the ellipsis of adam().
* coefbootstrap() now relies on the dsrboot() function from the greybox, implementing the "Data Shape Replication" bootstrap algorithm.
* adam() with occurrence now calculates the likelihood differently in cases when entropy is negative. This is needed for the model to be estimable. Otherwise it just produces a straight line around zero and returns likelihood of Infinity.

Bugfixes:
* Fix in reapply() for ARIMA.


smooth v4.0.2 (Release date: 2024-06-18)
=======

Changes:
* occurrence in adam() now accepts proportions. This might be useful if you know that you only have a share of demand that you usually get.
* adam() now allows pure models with some specific components. e.g. model="PNP" will check pure additive and pure multiplicative models without trend. Similarly, model="FNF" will now remove the unneeded trends and skip the branch-and-bound algorithm.
* We now use algorithm="NLOPT_LN_NELDERMEAD" in adam() - it produces more consistent and unbiased results than the "NLOPT_LN_SBPLX".
* New output for ARIMA models to list all parameters in a form of a table.

Bugfixes:
* Transition matrix was not correctly set for ARIMA with drift. It is now.


smooth v4.0.1 (Release date: 2024-04-01)
=======

Changes:
* Initialisation of ARIMA is now more precise, both for "optimal" and "backcasting", leading to a better fit of the model to the data. This was done using more meaningful initial values of states and by cutting the small step of refitting the head states in ARIMA with backcasting.
* Further tuning of the initialisation via backcasting. This time in C++ code for the preheating period.
* Rewrote the polynomialiser() function in C++. This should speed up ADAM ARIMA and msarima().
* Renamed the internal variable "profileObseredTable" into a more meaningful "indexLookupTable".

Bugfixes:
* Fixed a bug with multicov.adam() and simulated covariance matrix.
* adam() ARIMA and msarima() with backcasting would count number of components towards the number of estimated parameters.
* adam() would not remove components of ETS correctly in cases of small samples (e.g. obs == 2*frequency).
* Fixed the code of sma() - there was a bug in the architecture resulting in wrong fitting.
* ARIMA parameters are now initialised even when ACF/PACF returns NaNs (exotic case).
* Fixed bugs in es() not accepting xreg of a different length than y and not using the existing data in pre-estimated model via model=ourModel. Thanks to Nikos Kourentzes for spotting these!
* Another bugfix in es() and xreg: resolved the issue with the simulated data.


smooth v4.0.0 (Release date: 2023-09-15)
=======

Changes:
* Starting from v4.0.0, the smooth package for R will be released under the LGPLv2.1 license. The source of the older version of the software under the GPL(>=2) is available here: https://github.com/openforecast-org/smooth/releases/tag/v3.2.2


smooth v3.2.2 (Release date: 2023-09-15)
=======

Changes:
* Expanded info on simulate functions in the package description.
* vcov() now can also return heuristic covariance matrix for adam via the heuristics=0.0025 or something like that. This is an experimental feature, which is why it is not explained in the documentation.
* auto.msarima() is now a wrapper of adam() with orders=list(..., select=TRUE).
* accuracy() is now implemented for smooth classes.

Bugfixes:
* forecast.adam() would not work correctly if the newdata had missing values.
* Finally found and fixed an annoying bug that caused ARIMA to fail in some cases.
* Fix in forecast.adam() for cases of h=1 and analytical variance.
* A fix for adam() with LASSO/RIDGE, where "lambdaOriginal was not found".


smooth v3.2.1 (Release date: 2023-06-01)
=======

Changes:
* Combined ADAM now skips the models with weights less than 0.001, when producing forecasts.
* forecast() for combined ADAM now also supports interval="complete".
* reapply() method for combined ADAM.

Bugfixes:
* Correct default for initial in auto.adam().
* PACF in plot.smooth() dropped the first lag because of a typo.
* adam() would not calculate logLik() correctly for Generalised Normal distribution in case of Multiplicative error models.
* sma() with order selection would not work on data with number of observations lower than the frequency.
* Fix in simulate.adam(), which would ignore the states of the model.
* sm() now works with pure regression and regressors="select". But we now rely on greybox 1.0.8.
* formula is now properly used in adam() in regressors="select".
* smoothCombine() wouldn't work because of the wrong interval type.
* coefbootstrap() now has a slightly larger smallest sample to consider (1 more observation). This should make it more robust.
* Fix in adam() with Gamma distribution and mixed models.
* Fixed a bug with ARIMA(0,d,0) with drift and an initial B becoming outside of bounds.


smooth v3.2.0 (Release date: 2023-01-18)
=======

Changes:
* es() is now a wrapper of adam(). The old es() function will be available until v4.0.0 as es_old().
* msarima() is now a wrapper of adam() as well. The old version is msarima_old(). auto.msarima() relies on the old algorithm and will provide a solution different to the one from auto.adam().
* sma() now uses the adam() C++ code instead of the old one.
* New initialisation approach in adam(), es() and msarima() in place of initial="backcasting". This does backcasting for dynamic part of the model and optimisation for the parameters of the explanatory variables. Useful for ETSX and ARIMAX. The old one is now called "complete".
* simulate() method for ADAM class.
* msarima() now has a document "model" parameter. Previously, it was hidden in ellipses.
* type="simulated" in multicov.adam().
* Switched off interval and level parameters in oes() and oesg().
* forecast.adam() now has a parameter "scenarios", defining whether to return the simulated paths or not. Works only in case of interval="simulated".
* ACF/PACF of squared residuals in plot.adam() and plot.smooth().
* Removed depricated parameters (updateX, transitionX and persistenceX) from oes() and oesg().
* xtable method for adam class to produce tables from outputs for LaTeX.
* sma() now has a fast search of order.

Bugfixes:
* adam() calculated the number of estimated parameters incorrectly in case of regressors="select".
* Another fix of the number of estimated parameters in adam() - the internal method would differ from the external one.
* Fix in C++ code for the matrix of states, which gets contaminated with interim values.
* Failsafe mechanism in adam() for initial level, trend, seasonal in mixed models, so that they do not become negative, when they should not.
* A fix for another ETS+ARIMA combination in adam() which resulted in NaNs.
* A fix for simulated data from mixed ETS models in adam(). These should not produce NaNs anymore.
* A fix in forecast.adam() for cases of occurrence model and cumulative forecasts.
* A fix for tibble and tsibble objects in adam().
* es_old() and other old functions would break if after some checks all the explanatory variables would be dropped (thanks to Ritika Arora for spotting this). This is now fixed.
* Fix in adam() in case of loss=c("LASSO","RIDGE") and lambda=1. This now corresponds to the deterministic ETS(X) model. ARIMA is still a mistery here.
* adam() would not work if names of explanatory variables would consist of numbers only.
* adam() would fail if lags=24 and zoo object with no timestamps was used.
* A fix in adam() for provided occurrence and multiplicative models with positive distributions.


smooth v3.1.7 (Release date: 2022-05-20)
=======

Changes:
* Updated LASSO and RIDGE in adam(). We now don't shrink initial states, following Pritularga et al. (2022) paper. Furthermore, in the spirit of the paper, we now shrink AR elements to 1 and MA elements to -1.
* rmultistep method for es(), ssarima(), msarima(), ces() and sma().
* Renamed "xregDo" into "regressors" for consistency with ADAM.
* multicov now accepts parameter h, defining the horizon for multisteps covariance matrix.
* Fixes in adam() for cases, when eigen() did not use symmetric=FALSE, where this was appropriate. This should speed up the code a bit.
* Tuning of C++ code for ADAM. This leads to the decrease in computational time and used memory. However, the performance of models needs testing to make sure that they are still robust.

Bugfixes:
* adam() ETS+ARIMA would check ARIMA parameters, assuming that polynomial matrix is symmetric. This is now fixed.
* Fixed a bug in adam(), when the function would use erroneously NULL as a name of a variable.
* interval="prediction" would not produce analytical intervals in case of pure additive models. This is now fixed.


smooth v3.1.6 (Release date: 2022-03-30)
=======

Changes:
* Renamed nu into df in distribution="dt" of adam() for consistency with alm().
* We now import forecast from generics package, not from greybox.
* sm() method for adam. This supports scale model via ETS / ARIMA / Regression.
* forecast.adam() is now tuned to work with sm.adam() output.
* forecast.adam() now works properly with object$scale if it is estimated via sm.adam() (i.e. taking the multistep scale into account).
* implant() method (imported from greybox) to merge adam and the scale model.
* The default measurement vector in gum() is now unity. This makes model identifiable.
* Correct number of degrees of freedom in adam-sm model.
* Fixes for sm() in case of model="NNN".
* Always record number of estimated parameters for scale in a separate column in adam().
* plot.adam() now produces diagnostics plots for scale model if it is implanted for which=c(2:6,8,9,13,14).
* The order in which in plot.smooth() and plot.adam() now matters.

Bugfixes:
* Fixed a bug in ssGeneral.cpp, which caused ces() to break in the cases of extreme values of smoothing parameters.
* A fix in forecast.adam(), which would not rbind the rows correctly in cases of nrow(newdata) < h.
* A fix in ADAMX for exotic cases, where log(y) was used in alm() (for parameters initialisation), when it shouldn't have.
* A fix in case of rbind() of data.frame, when one of variables is ts.


smooth v3.1.5 (Release date: 2022-01-26)
=======

Changes:
* summary.adam now prints the standard deviation of the error term (sigma(ourModel)).
* An explanation of the default nsim value in forecast.adam.
* Removed Mcomp from suggests.


smooth v3.1.4 (Release date: 2021-12-01)
=======

Changes:
* Fixed the description of interval option in adam().
* Renamed refit() into reapply() to avoid conflicts with the generic of the same name from generics package.

Bugfixes:
* Fixed a bug in the pre-initialisation of parameters of a model with constant.


smooth v3.1.3 (Release date: 2021-09-22)
=======

Changes:
* adam() now gives names to the models in combinations for a simple access to them.
* adam() now complains if the data is negative and a non-additive model is applied.
* forecast.adam() now supports "empirical" and "complete" prediction intervals. The former rely on multistep forecast errors and uses their empirical quantiles. The latter is a shortcut for the prediction interval in the reforecast() function.
* Allow seasonal model in es() for the 2 full cycles of data.

Bugfixes:
* adam with pure regression would not do outliers selection.
* Fix in adam() with half-hourly data.
* empirical interval in forecast for adam(), which relies on quantiles of multistep forecast errors.
* Fix in auto.adam() for ETS+ARIMA: the function would enforce drift, when it would not be needed.
* Fix in rmultistep - it would not use the original profile and would result in ridiculous forecasts.
* Fix in adamErrorer. It now has a correct alignment of profiles. This will impact the rmultistep() and multistep losses.
* Fix for GPL and other multistep losses in case of multiplicative models and default distributions.
* An issue with forecast.adam() with combination, which would not have correct number of elements.
* adam() now prints the correct name of response variable in auto.adam() ARIMA selection.
* Fixed issues with initials and with initial profile in adam(), so that any model can now be properly reapplied, no matter what and would result in exactly the same fit. Previously, this would break for some types of ARIMA.
* Fixed ETS(M,*,*) with drift models. They now produce a proper trend.
* A fix in the bounds for the optimiser in case of bounds="usual" - should converge to optimal values faster.
* A fix for the logLik calculation of occurrence model - accept only positive entropy. This needs further investigation, but for some reason makes sense.
* Make sure that the conventional functions (es, ssarima, sma etc) return y as ts.


smooth v3.1.2 (Release date: 2021-06-14)
=======

Changes:
* Make forecast.oes() shut up in adam().
* Print names of oETS models in the adam() model (e.g. [G], [F], etc.).
* Updated methods description in the vignette of smooth.
* plot.adam(..., which=c(8,9)) now drops residuals for zero actuals if occurrence model is present. Should look better and provide a proper message.
* Update in C++ code, substituting SEXP by the expected objects (matrices and vectors) in adam(). This should result in a slight speed up and memory consumption reduction.
* adam() now has a trick in case of initial="backcasting", changing the value of state obtained in the tail of series. This helps the function to come back to the start of the series with a more meaningful initial.
* New initialisation for phi and theta of ADAM ARIMA.
* /donttest{} instead of /dontrun{} in examples in the documentation.
* on.exit() restore par for plot functions.
* Use "approximate" intervals for !etsModel in adam().
* Multistep losses in adam() now do not do log(1+et) and minimise et directly.
* adam() now does regressors selection between those that are specified in formula if formula is provided.
* More iterations for xreg models in adam().
* Refine head of time series in adam() for backcasting (previously was only done for optimal).
* Gamma is now the default distribution for Etype="M" in ETS.
* (standardised residuals)^2 vs fitted and abs(standardised residuals) in plot.smooth() and plot.adam() (which=c(13,14)). This should allow doing diagnostics in case of scale model (TBA).
* occurrence parameter in adam() now also accepts logical vector.

Bugfixes:
* Fixed a bug in adam() with regressors="select" and errorType=="M".
* auto.adam() would not check positivity of data for dgamma.
* A bugfix in auto.adam for additional checks in ARIMA in case of d=0.
* A bugfix in oesg() and damped trend model with estimated phi.
* Fixes in ts() for pure regression in adam().
* A fix for outliers selection in ADAMX andprovided formula.
* A fix in ADAMX and forecast().
* A fix for weird cases of ETS(M,N,N) with constant on some time series with very low values.
* A fix in auto.adam() for ARIMA orders selection in case of the provided formula.
* A fix in forecast.adam() for interval="approximate" and distribution="dlnorm".
* Weird bug in es(), where loss="likelihood" was considered as a multistep.
* Fix in auto.adam() and ARIMA selection with non-default distributions.


smooth v3.1.1 (Release date: 2021-04-16)
=======

Changes:
* Kick off redundant d and q in ETS+ARIMA, when ARIMA is selected automatically.
* A fix in auto.adam() in case of ETS + ARIMA + Regression and automatic selection. The code is slower but more accurate now.
* Speed up regression estimation in case of is.matrix(data) and no formula.
* I minor improvement, when calling forecast() from adam() - don't ask for interval to speed things up.
* Further optimised adam() code with regressors, in case of regressors="select", removing unnecessary steps.
* Return distribution="plogis" in oes() and oesg().
* Select regressors on the model with alpha=0.01, so that it does not overfit the data.
* Minor optimisations in adam() for RAM consumption in case of explanatory variables and / or backcasting.
* forecast.adam() now produces point forecasts (not conditional means) if interval=c("nonparametric","semiparametric","approximate").
* Do Garbage Collection for ADAMX if the sample is bigger than 10k observations. We need to preserve memory in this case.

Bugfixes:
* Fix for forecast.adam() and factor variables in newdata.
* Fix for Mcomp data and outliers detection mechanism loosing lags.
* A fix for ADAM ETSX / ARIMAX in cases of no variability in explanatory variables.
* And another one for coefbootstrap() in case of regressors="select".
* A fix for likelihood calculation for occurrence model and distribution="dgamma".
* confint() now returns proper intervals for parameters of adam(), not intervals around zero.
* Fix in forecast.adam() for iETS models and different objects used in oes() and adam().
* A fix for provided smoothing parameters in case of estimated deltas in adam().
* Fix for factors in adam().
* A fix for the previous fix of factors.
* A fix for iETS in forecast.adam() for cases of zero mean and zeroes in quantiles.
* Fixed a funny bug in adam() with data.table and cbind.
* A fix for the case of data.frame() and is.zoo(y).
* A fix for vcov.adam() in case, when Fisher Information contains NaNs.


smooth v3.1.0 (Release date: 2021-02-19)
=======

Changes:
* We now use filter() function from stats instaed of ma() from forecast package in msdecompose().
* We don't use is.ets from forecast package anymore.
* msdecompose() now treats NAs automatically, interpolating them with a combination of fourier and polynomial.
* adam() now relies on the same interpolation mechanism as msdecompose() in case of NAs.
* Implemented a new auto.adam() ARIMA selection mechanism. It is faster and produces more accurate ARIMA models (e.g. more accurate than auto.ssarima()). Removed the redundant fast parameter from auto.adam().
* Tell if bootstrap was used in summary.adam().
* Add stars for the coefficients that are significant on the selected level.
* Gamma distribution in adam().
* Removed ves(), vets() and viss() from the package. They are now available in legion package.

Bugfixes:
* Bugfix in the initialisation of ARIMA on small samples.
* Bugfix in ETSX(A,*,*){D}, which previously had the wrong persistence element.
* A fix in coefbootstrap and lags variable, when M3 data is used.


smooth v3.0.2 (Release date: 2021-01-27)
=======

Changes:
* plot.smooth, 7 now will include the holdout.
* plot.adam.forecast now produces mean forecast in case of cumulative.
* Let ADAM speak for himself - all warnings are now "I cannot do this and that".
* warning in case of bounds="none".
* outliers and level are now also available in adam() - no need to use auto.adam() for that.
* coefbootstrap() for adam. And support for bootstrap in vcov, confint and summary. This now works with auto.adam() as well.
* Change origin in coefbootstrap() if initial="backcasting".
* We now only take the needed values of B if a longer vector is provided.
* Removed checks of obsolete parameters in ves().
* Scale the MSE part of LASSO and RIDGE in adam() by the sd(diff(y)).

Bugfixes:
* A fix for "YYY" and non-positive data in adam().
* A fix for the selection between "ANN" and "ANA" on some data in adam().
* adam() would not work with provided occurrence.
* A fix for sigma.adam() from the model with NAs (returned NA instead of the number).
* A fix in vcov.adam() for the data with NAs.
* outliers="select" would not work with zoo objects.
* A bugfix for orders=list(select=TRUE) without providing ar i ma orders.
* A bugfix for outlier!="ignore" and data.frame as a data.
* A bugfix in auto.adam() with outliers. We use call now.
* A bugfix for vcov.adam() in case of regression and is.matrix(data).


smooth v3.0.1 (Release date: 2021-01-12)
=======

Changes:
* The vector of parameters B now also has proper names in adam().
* Reduced the default number of iterations for ARIMA to the same as for ETS.
* The default loss for es(), ces(), ssarima(), msarima() is now "likelihood", assuming normality of the response variable.
* adam() now contains the parameter constant, which adds constant (mean) in the model. This is needed for ARIMA part of the model. It acts as a mean / drift, depending on the differences.
* New initials for the explanatory variables (factors). Should converge faster to the optimum.
* We now use mean with 1% trimming in forecast.adam() for models with T="M". This should help in some cases with outliers.
* Reintroduced the bounds for the parameters of adam().
* maxeval in ves() now depends on the number of parameters to estimate.
* adam() now accepts orders=list(...,select=TRUE), calling for auto.adam() in this case.
* Tuning of initials for ADAM ARIMA and increased maxeval for ARIMA.
* We now import gnorm functions from greybox.
* trend in formula of adam().

Bugfixes:
* Fixed an issue with ARIMA, which calculated the polynomials incorrectly.
* auto.adam() would not select optimal ARIMA because of an issue with actuals.adam() method.
* A failsafe in adam() for cases, with IG and negative values.
* outlier="select" would not work for ts() objects in auto.adam().
* Bugfix in ADAM ARIMA for the profilesObserved and constant. The model should be initialised correctly now.
* Fixing auto.adam ARIMA selection and non standard distributions.
* A bugfix in ADAM regression and vcov(). We now use alm() directly.
* A fix for cases, when explanatory variables contain NAs.
* A fix in fitted for mixture models in adam().
* A fix for the plot of objects in case of holdout.
* Do simulations for forecast with prediction interval if regression model was constructed.
* plot.refit would not work with zoo objects.
* A bugfix in adam() in cases, when alm() drops some variables.
* A bugfix for xreg, Etype="M" and distribution="dnorm".


smooth v3.0.0 (Release date: 2020-12-07)
=======

Changes:
* ADAM function moved to smooth from a separate package.
* Changed the default maxeval in ADAM for xregModel to at least 500.
* Tuned the starting parameters for xregModel and xregDo="adapt", so that the thing does not explode on large samples.
* Use make.names() function to fix the names of explanatory variables and the name of response. We now depend on greybox v0.6.2.
* sim.es() now also accepts one value in persistence - it will duplicate it for all components.
* Renamed parameters for distributions in adam(). dalaplace now accepts alpha, dgnorm - beta and dt - nu. This resolves the conflict with LASSO and lambda.
* Use internal gnorm() functions.
* Return call and bounds in adam().
* Use rectified normal distribution for the confidence intervals for smoothing parameters and ARIMA.
* The as.data.frame.summary.adam() method, which produces the matrix of coefficients.
* adam() now uses profiles instead of lags for seasonal models. These are updated on every observation via ETS approach.
* msdecompose() now produces initials suitable for the first observation of the data via a simple extrapolation.
* Switched off dllaplace, dls and dlgnorm in adam(), because their mean values are not easy to calculate.
* Log Normal distribution in adam() now assumes that the mean=-scale^2/2. This is needed in order to maintain the property of mean of error being equal to zero.
* New method: refit(), which reapplies the model (currently ADAM only) to the data with randomly generated initials and smoothing parmaters, based on the estimated values and the covariance matrix of parameters. Useful for confidence intervals for states and correct prediction intervals from the dynamic models.
* A follow-up method from that - reforecast(), which uses states produced by refit() method to produce possible paths from each generated combination of parameters in order to obtain conditional expectation and prediction interval.
* adam() now works in cases of leap years and DST. In order to switch this functionality on, y needs to be a zoo object or any other object, containing dates and the lags parameter needs to be set to either 24, 48 or 365 - depending on the frequency of data.
* ves() now uses the R code for the loss calculation - the C++ routine was not leading to huge performance gains, but was not as flexible.
* Removed occurrence, updateX, transitionX and persistenceX from the es(), ces(), gum() ssarima(), msarima() and respective auto functions. Use adam() if you want that functionality (probably, nobody cares anyway... let me know if that's not true).
* LASSO and RIDGE do normalisation using sd instead of mean now. Also, removed the warning message.
* Renamed y into data;
* adam() now works only with data, xreg is removed. And xregDo is now renamed into "regressors".
* adam() now treats categorical variables (factors) differently than the other variables. This becomes especially useful in case of regressors="adapt".

Bugfixes:
* Fixed dates for the holdout sample in case, when holdout=FALSE for zoo objects.
* Fixed the check for admissible bounds in case of xregDo="adapt".
* A fix in adam, when xreg parameters are provided and the xreg matrix does not need to be expanded.
* Fixed a bug in ETS(M,M,A) models in adam.
* Fixes for ETS(A,M,A) initialisation in adam.
* A failsafe mechanism for ETS(M,A,M) for cases, when the initial trend becomes negative and larger than the lowest actual value.
* es() would not work well for some mixed models and data close to zero due to the initialisation. This should be fixed now.
* The models checked in branch-and-bound for es() now have aligned types of errors and seasonal components.


smooth v2.6.1 (Release date: 2020-07-17)
=======

Changes:
* Further tuning of the initial smoothing parameters in oes() and oesg().
* Removed iss() function and redundant parameters (no more checks with depreciator). Also removed the respective redundant parts of C++ code.
* outlierdummy() method for smooth class, based on the same stuff from greybox v0.6.1.

Bugfix:
* window() function would not work in case of non-ts objects.
* A bugfix in forecast() for oes(), where B would not be found.


smooth v2.6.0 (Release date: 2020-06-16)
=======

Changes:
* sim.oes() function, generating probability of occurrence and respective binary variable ot.
* Tuning of ves() function and a couple of new parameters in ellipsis, that allow regulating the optimiser.
* forecast.smooth() now allows specifying side of prediction interval. Note that this might not work well in cases of occurrence model.
* Make ACF / PACF in plot.smooth() easier to read + tuning in case of non-ts objects.
* sim.* functions now use proper do.call() instead of weird parse(...).
* Initial smoothing parameters in oes() and oesg() are now set to 0.01 instead of 0.05. This should allow avoiding several cases of wrong optimisation.

Bugfixes:
* A weird glitch for occurrence model, when h=1: multiplication of yForecast by pForecast could not be done.
* es() would not work in case of predefined persistence and initial, but not inisialSeason.
* Model selection would not work in oes() for some types of models.
* oesg() did not return class "occurrence".
* A fix in sim.oes() for the ts() class in occurrence="inverse-odds-ratio".
* oesg() now reports the correct type of model, not the abbreviation.
* A fix for auto.ces(), which did not work on zeroes data.


smooth v2.5.7 (Release date: 2020-04-06)
==============

Changes:
* plot.smooth() now also produces standardised and studentised residuals over time.


smooth v2.5.6 (Release date: 2020-03-31)
==============

Changes:
* oes() now returns full names of occurrence.
* Renamed covar() method into multicov().
* oes() with occurrence="none" now returns values based on p=1 (likelihood is based on p=1-1e-100).
* pointLik() method for oes class.
* A separate plot method for oes, because the general diagnostics is not useful.
* Added the plot of residuals over time in plot.smooth(), which=9.
* oes() now produces "occurrence" class, which is exported from greybox v0.5.9. This is needed for proper integration between greybox and smooth functions.
* ves() now accepts B, ub and lb for the optimiser.
* ves() is now optimised using Nelder-Mead only.
* msarima() now has an option of producing initials using optimisation.
* Renamed parameter for the initials of optimiser from "C" or "A" to "B" and upper and lower bounds respectively to "ub" and "lb". This is done for consistency purposes. Functions now also return this in $B and almos all of them accept B=B as a parameter for the initialisation of optimiser.
* plot.smooth() now produces "Actuals vs Fitted" plot in case of which=1. The default time series plot is moved to which=7.

Bugfix:
* print.smooth.forecast() would print prediction intervals even if it wasn't asked to do so.
* plot.smooth.forecast() would plot prediction intervals even if it wasn't asked to do so.
* A bugfix for oes() and model selection, removing the occurrence type.
* A crude fix for the msdecompose(), when type="multiplicative" and there are zeroes in the data.


smooth v2.5.5 (Release date: 2020-01-25)
==============

Changes:
* sim.es() now will give warnings, when NaNs are produced in the actual values.
* Fucntions with loss="GTMSE" sometimes could not be estimated because of the exponent in the optimiser. Now it is in logs and at least doable.
* New function - msdecompose() - which is needed for more advanced ETS. This does multiple seasonal decomposition based on centred moving averages.
* More advanced plot.smooth(), which now acts similar to plot.greybox(), with similar options of what to plot. The documentation is now available for plot.smooth().
* Tuning of some methods for the class smooth.
* forecast with prediction intervals for msdecompose().
* residuals.smooth() now returns either et or log(1+et) - depending on the type of model (additive / multiplicative).
* New methods: rstandard() and rstudent() for the smooth class.
* Updated vignette for oes(), taking the last version of our paper with John E. Boylan.

Bugfix:
* es() with multiplicative models would fail sometimes in case of bounds="a" because of the negative values. We now restrict the bounds with positive values only.


smooth v2.5.4 (Release date: 2019-10-22)
==============

Changes:
* loss="TFL" is now called loss="GPL" - General Predictive Likelihood.
* The return of unbiased estimate of variance (division by T-k)... We now use it for the calculation of the all the prediction interval types, but there is also an option of using the biased (division by T) parametric prediction interval with interval="likelihood".
* Fix for the initials in the optimiser in case of difficult mixed mdels.
* Updated the description of the bounds parameter in ves().


smooth v2.5.3 (Release date: 2019-08-19)
==============

Changes:
* es() now treats the parameters that reach the boundary values (within the 1e-3 distance) as provided and substitutes them by the bounds (i.e. 0 or 1). This should influence the model selection procedure.
* Also if phi==1, we switch to the non-damped version of the model.
* Warn users if the response variables in ves are perfectly correlated.
* Minor changes in the formulae in oes() vignette.
* Allow ves() to work on very small samples, if the model is restrictive. This is based on the number of parameters to estimate per series now.
* sigma() method for the data simulated by smooth functions.
* Don't check the provided occurrence if it contains 1 only.
* RelMAE is now called rMAE and RelRMSE is now rRMSE in the greybox package v0.5.3.

Bugdixes:
* sim.es() would complain in some cases of nsim>1 and the default values of parameters.
* es() did not work appropriately with the provided persistence parameter in the non-default bounds.
* A bugfix for cma(), which did not have silentText parameter.
* A bugfix in the calculation of the likelihoods based on GTMSE and aGTMSE losses.


smooth v2.5.2 (Release date: 2019-07-24)
==============

Changes:
* The GSI is now merged with VES with several advanced parameters. The seasonal models now have the subnames, according to the taxonomy of Chen et al. (TBA). gsi() function is no longer available.
* seasonal and weights parameters in sim.ves() - they allow generating the data from VES[CCC] model.
* Corrected the dependence on forecast package.
* summary of smooth functions is a bit closer to the one from greybox now.
* Renamed the external parameter "modelLags" into "lagsModel" for consistency purposes.
* Parametric prediction intevals in oes(). The oesg() is more complicated and would need more work.
* Implemented forecast() method for the oes and oesg classes.
* Tuned the outputs of the smooth functions (so that they look closer to the greybox ones).
* Return of initial="backcasting" as the default option for ces() and auto.ces().

Bugfixes:
* Bugfix in the combination of models in es(), when the data was non-seasonal.
* Also, the duplicates in the modelsPool are now removed.
* Bugfix on oes() and oesg() in case of explanatory variables (parameters stability was checked incorrectly).
* Bugfix in oes() in case of model selection and holdout=TRUE.
* The number of parameters of ETS was wrong, when backcasting was used.
* Corrected the names of the columns for errors and fitted values of ves().


smooth v2.5.1 (Release date: 2019-06-13)
==============

Changes:
* New initials for the smoothing parameters in oes(): 0.05 instead of 0.01. This should help in the optimisation.
* oesmodel can now be set to NA / NULL, the es(), ssarima() etc will work, resetting this to the default "MNN".
* Corrections in the vignette for oes, according to the most recent version of our paper.
* A little bit more explanation for the es() function and references to the website.
* Model selection is now available in the oes() function. I'd recommend sticking with pure models.
* Renamed the fitted values for the underlying models in the oes() and oesg() into "fittedModel" (former "fittedBeta").
* Rolling back "quiet" into "silent". The former is more difficult than the latter.
* "data" parameter is now renamed into "y" for consistency purposes (so that the input is more similar to the functions of the forecast package).
* "cfType" is now renamed into "loss".
* "workFast" in auto.ssarima() and auto.msarima() is now "fast" instead.
* "intervals" (plural) is now "interval" (singular) instead. This is needed, so that the input is consistent with predict() function.
* "actuals" are now renamed into "y" in the output of the functions.
* A failsafe mechanism for SSARIMA and MSARIMA for the cases, when there is no models and no constant.

Bugfixes:
* A bugfix in occurrence="d" - an error was not calculated correctly.
* A bugfix in the model selection mechanism for oes() (the forecast was set to 10 instead of h).


smooth v2.5.0 (Release date: 2019-04-25)
==============

Changes:
* New function - oes(). This will eventually substitute iss(). This aligns with the IJF paper by Svetunkov & Boylan (TBA). Only "fixed", "odds-ratio", "inverse-odds-ratio" and "probability" models are available at the moment. "general" is expected to arrive in several days...
* es(), ces(), ssarima(), msarima() and gum() now use "occurrence" parameter instead of "interemittent" and respectively oes() function instead of iss().
* New error measures: MIS, sMIS and RelMIS - based on the Interval Score of Gneiting and Raftery, 2017. This will be moved to greybox in the next version of smooth.
* New function - oesg(), implementing the General Beta-Bernoulli exponential smoothing model for the occurrence part of the data. This makes occurrence="g" available for the oes(), es() and all the other functions.
* The fitted values are now multiplied by the probability of occurrence in the case of intermittent model.
* The new likelihood for iETS models, which takes the missing values into account via EM-algorithm.
* The new estimate of the variance of the error for the iETS, based on the likelihood. It is obviously biased, but consistent and more efficient.
* Corrected optimisation of the iETS with rounded values, maximising SD directly in the function.
* The intermittent models are now returned in the "occurrence" rather than "imodel" parameter and should be provided in the functions via "occurrence".
* imodel is renamed into oesmodel for the univariate models. This is done for the consistency purposes.
* A vignette for oes() and the new intermittent model + references to the iETS and SSARIMA papers.
* Use actuals() method from greybox instead of getResponse() from forecast.
* cma() now relies on msarima() rather than on ssarima().

Bugfixes:
* Bugfix in oes with occurrence="d" and model="AZZ".
* Semiparametric intervals were broken.
* Wrong model name was produced on the graph of es().
* Fixed a bug in backcasting fitter with "Mat::col(): index out of bounds".


smooth v2.4.8 (Release date: 2019-03-10)
==============

Changes:
* ves() now has an option of producing persistence="seasonal". Seasonal smoothing parameter will be common across the series in this case.
* New function - pinball(), which returns the value of the loss (either quantile, or expectile, or any other one).
* IMPORTANT!!! The variance of errors in the smooth functions is now calculated without the bias correction. This is because we claim that we use likelihood in the estimation. Expect the increase in prediction intervals!
* The number of parameters is now correctly taken into account in the calculation of AIC, AICc, BIC and BICc of ves().
* RelMSE is now substituted by RelRMSE in the accuracy calculation.

Bugfixes:
* sma and cma did not check the existance of model correctly. Now it is restricted with their environment only.
* Check if the data is positive for the multiplicative types of auto.gum() and gum() functions.
* auto.gum() sometimes failed, when IC values were the same.
* Accuracy has been calculated incorrectly for ves() models.
* gsi() now checks the provided weights for NAs.
* gum() would not work correctly, when length(lags)>length(orders).
* es() would kill R in cases of "MAN" model and small samples. Now it does not do that.


smooth v2.4.7 (Release date: 2018-11-30)
==============

Changes:
* graphmaker() is now moved to greybox package.
* Moved sigma.ets() to greybox package.
* pls.smooth() returns more or less reasonable values, when the model overfits the data.
* A set of is-functions, checking whether the object is produced by smooth functions.
* New function - gsi() - ETS with Group Seasonal Indices. This is based on VES with some restrictions. The work in progress...
* The number of degrees of freedom in vector models (ves and gsi) is now calculated per series, not overall. This corresponds to Lutkepohl (2005), p.75.
* Minor updates in the vignettes for ves with references to Lutkepohl and a couple of papers.
* ETS(M,Z,Z) now returns correct semi and non parametric intervals in case of intermittent data.
* Given the recent update in greybox, changed the "b" to "scale" in distribution functions.

Bugfixes
* ETS(M,X,X) sometimes could not be optimised because of the too high smoothing parameters values and negative initials. This should be fixed now.
* sim.ves() wasn't working correctly in case of AAA models and provided initials.
* The error generated in sim.ves() was always multiplied by the initial state, so if it was zero, then nothing would happen.
* Found bug due to which the exogenous variables wer ignored for the forecasts from ETS(M,Z,Z) models.


smooth v2.4.6 (Release date: 2018-08-25)
==============

Changes:
* All the multisteps estimators now have what they were supposed to originally have: smaller sample of T-h.
* graphmaker() function is now more flexible, allowing to tune parameters of plot.
* Centered Moving Average function is now available. This is not a model, but just a transfer function of SMA.
* New function - msarima() - Multiple Seasonal ARIMA. This is a reimplementation of ssarima() function, that relies on a different state-space model and works substantially faster.
* New function - auto.msarima() - for the order selection of msarima.
* Tuning of msarima() optimisation.
* New method - modelName - that returns the name of the model. e.g. "ETS(M,A,N)". Can be useful for summarising results. Also applicable to non-smooth classes (e.g. Arima, ar etc).
* A new internal function for determining the type of model used (smoothType).
* Moved pointLik, pAIC and errorType methods to greybox package.
* Added MAE, MSE and MRE in the Accuracy function.
* auto functions now switch to intermittent="n", when there's not enough non-zero observations.
* ges() is now renamed to gum() - Generalised Univariate Model.
* The code for prediction intervals in case of intermittent model is now simplified.
* Renamed several internal variables (y.for -> yForecast, y.fit -> yFitted, datafreq -> dataFreq etc) for the consitency purpose and convenience.
* The code of intervals="np" is optimised a little bit and should take less memory for the calculations.

Bugfixes
* Fixed a bug for logistic intermittent model, when the probability of occurrence was becoming 0 or 1.
* es() would not count damping parameter as parameter in the initialisation if model selection is chosen.
* Bugfix for pls(), when the multiple steps ahead covariance matrix is becoming too large to calculate its determinant.
* RelMAE, RelMSE and RelAME were calculated incorrectly in smoothCombine.
* No more warnings from iss(x, intermittent="p") when the data is only slightly intermittent.
* Fixed cases, when level of an intermittent model was becoming too large or too small.
* Fixed a bug, when auto-functions constructed only parametric prediction intervals.
* Functions failed with xregDo="s" when xreg was data.frame.
* nParam sometimes contained negative values for the "Provided" row.


smooth v2.4.5 (Release date: 2018-07-03)
==============

Changes:
* The covariance matrix of VES now also contains named columns and rows.
* And so do residuals, fitted values and forecasts.
* errorType, pointLik and sigma now return something useful for ets class.
* Changed the set of default values for randomizer for simulate functions to "rnorm","rt","rlaplace" and "rs". sim.es() also works with "rlnorm".
* Started the work on sim.ves function.
* Added separate ham() function for HAM calculation.
* ssarima() now also accepts orders=c(p,d,q). lags are assumed to be equal to 1 in this case, so that a non-seasonal model is constructed.
* RelMSE and RelAME error measures are introduced. These should be useful for intermittent demand.
* sim.ves() now seems to work.
* sim.ves() is tested and now should work fine in the majority of cases.
* simulate() method for ves is now available.
* Code of simulate.smooth() is optimised and shortened.
* Small addition in vignette for sim.ves().
* New method for smooth functions - pAIC.
* Simplifications in the number of parameters calculation.

Bugfixes:
* ves() now produces the correct number of plots if silent=FALSE.
* iss() returned the wrong likelihood because of a typo in the formula.
* Fix for the internal likelihood calculation for intermittent logistic models.
* Corrections in pointLik() function. This should now be closer to the original likelihood if summed up. This is still an ongoing research, this thing will change in future.
* Bugfixes in sim.es and sim.ssarima, so that rlaplace and rs can be easily used.
* es(), ssarim(), ces() and ges() didn't work correctly when the already estimated model was reused with new xreg of a different size. The new fix partially solves the problem. Make sure that you provide the table with the correct exogenous variables!
* When a model is reused the nuber of parameters in AIC should be equal to 1 (because only variance is estimated, the rest is provided).


smooth v2.4.4 (Release date: 2018-05-31)
==============

Changes:
* New methods for smooth and vsmooth classes: BICc and AICc.
* New restrictions on the seasonal multiplicative models, so that the indecies don't become rediculous.
* New function - smoothCombine - that combines forecasts from es(), ssarima(), ces(), ges() and sma().
* A reference to a paper about the combination of intervals.
* ves() now returns FI if the user asked for it.
* ves() now also returns error measures in cases of holdout=TRUE.
* Finally, we use the colnames of the provided data in the produced variables.
* modelType() and errorType() methods are now available for iss class.
* ves() now also has usual bounds (smoothing parameters between 0 and 1).
* Updated the description of the package and corrected several typos.

Bugfixes:
* MSCE, MSEh, MACE, MAEh, CHAM and HAMh returned the wrong values in the optimiser for multiplicative models. Now they are correct and the respective likelihoods are correct as well.
* es() in some cases could not find optimal solution because the returned 1e+100 was lower than the estimated value (especially in case of GTMSE and multiplicative models).
* ves() did not work, when the original data was less than 1 and the multiplicative model was needed.
* es() now returns forecast as a vector, not a matrix.
* ves() would not work correctly for provided persistence.
* ves() calculated number of parameters incorrectly in some cases.


smooth v2.4.3 (Release date: 2018-05-03)
==============

Changes:
* Two new methods for the models: covar() returns covariance matrix of 1 to h steps ahead forecast errors; pls() returns Prediction Likelihood Score for the model.
* We now return measurent and persistence vectors and transition matrix from every smooth model. This is needed for the analytical covar().
* covar() now also produces analytical covariance matrix for all the additive models. The same code is used for multiplicative models and should work as an okay approximation.
* The code of prediction intervals has been updated. They should be more precise now.
* The prediction intervals for cfType=c("MAE","HAM") are now produced using Laplace and S distributions.
* After several rounds of derivations, it seems that the forecasts for multiplicative models still correspond to the median, so there is no need for bias correction.
* GES now has a restriction on transition matrix and measurement vector - (0, 1). The idea is that they represent Markov Chain elements.
* Model selection is now supported for MSEh and MSCE as well - we rely on quasi-likelihood of normal distribution.

Bugfixes:
* iss() produced wrong warnings, when wrong value of intermittent was specified.
* ges() and ssarima() used old versions of intermittent in the selection loop.
* ges(), ces(), ssarima() had problems with model selection for intermittent because of the ic parameter.


smooth v2.4.2 (Release date: 2018-04-03)
==============

Changes:
* Moved AICc(), xregExpander(), stepwise() and nParam() to greybox package. We now depend on greybox (>=0.1.1).
* es(), ces(), ges(), ssarima() and all the automatic univariate functions now have model selection mechanism in case of cfType="MAE". This is based on Laplace distribution.
* The same thing is now available for cfType="HAM". This is based on a distribution that I have not yet met in the literature and had to derive myself.
* Corrections in AICc.smooth for intermittent models.
* Due to log-normality assumption in multiplicative models, the forecasts should have a bias correction. This means that ETS(M,N,N) does not produce straight line anymore, but a slowly increasig one. This has been corrected in this version of smooth.
* We now warn, when the number of degrees of freedom is too low for the reasonable estimation of variance (comparing with 5, because a median human being has 5 fingers per hand).

Bugfixes:
* Combinations in es() did not work in case of something like "CYY" because of the wrong pool of models.
* Found a bug in forecast production in cases, when prediction intervals were simulated.
* SBA was not written down, when used in iss. This did not allow to reuse the model properly.
* In some weird cases Croston would produce forecats of intervals < 1. Fixed that.
* Fix in iss() for the cases when intermittent model is applied to non-intermittent data.


smooth v2.4.1 (Release date: 2018-03-04)
==============

Bugfixes:
* Fixed minor typos in the description of the package.
* Fix in iss() for Interval-based model, when for some reason the probability becomes greater than one.
* When the incorrect error/trend/season were specified in es() it would fail to work.
* Fix for the cases, when the names of several xreg variables are the same.
* When xreg is invalid and set to NULL, change xregDo to "use".


smooth v2.4.0 (Release date: 2018-02-10)
==============

Changes:
* ves() model now accepts intermittent parameter. So we can construct multivariate intermittent models.
* ves() now prints information about the underlying intermittent model.
* New estimator - MSCE (Mean Squared Cumulative Error). Needed in cases of cumulative demand.

Bugfixes:
* ves(): Initial values for seasonal components in case of multiplicative models were incorrectly estimated.
* iETS could not be used in some cases of highly intermittent data and intermittent!="n".
* logLik was incorrectly calculated in iss() for cases of intermittent="p".
* The selection of intermittent model was done incorrectly due to the new return of ICs.
* Return NULL in logLik() function, when logLik is unavailable for the model (e.g. combination of models). Similar thing with nParam().
* Check if the data.frame is provided to ves.
* stepwise() now ignores NAs in the provided data.


smooth v2.3.2 (Release date: 2018-01-18)
==============

Changes:
* The providedC is now used in case of xregDo="select". This should increase the speed of convergence and fix several bugs related to optimisation problems.
* The correct initialX are now used in cases of es("ZZZ") and es("CCC").
* We now return the matrix of ICs and ICweights in cases of model selection and combinations of es().
* maxeval in the optimiser now depends on the number of parameters. If we have more than 10, then maxeval=1000. Otherwise maxeval=500.
* Removed a silly SMAPE from the output of accuracies and substituted by a more useful sCE. Both are still available via ourModel$accuracy.

Bugfixes:
* ges() added an array to a vector, which caused dozens of warnings. Fixed.


smooth v2.3.1 (Release date: 2018-01-13)
==============

Changes:
* es() now uses branch and bound mechanism for XXX and YYY models.
* intermittent="l" now allows dealing with seasonal models in imodel.
* make Accuracy() function available for users.
* ces(), ges() and ssarima() now produce some forecasts on small samples (e.g. less than 6 observations). This mechanism is not yet smart enough, and will be improved upon.

Bugfixes:
* es() now also checks if data is multiplicative in case of YYY and acts accordingly.
* dataStart and yForecastStart variables in the code.
* stepwise() now has a more userfriendly Call in the output.


smooth v2.3.0 (Release date: 2017-12-23)
==============

Changes:
* New function, viss() - vector intermittent state space model. Allows modelling occurrence probability of several variables simultaneously.
* New initialisation for es(), ges() and ces(). This should help getting more accurate initial states in cases of high frequency data.
* The user can now control the optimiser via maxeval and xtol_rel provided in ellipsis of es() and ges() functions.

Bugfixes:
* smooth functions would return errors in case when some xreg variables were dropped and only one would be left.
* ETSX(Z,Z,Z) did not work when xreg contained negative data. Now it should.
* Number of parameters in case of xregDo="select" was incorrect.


smooth v2.2.2 (Release date: 2017-12-15)
==============

Changes:
* Updated vignettes.
* New probability type for intermittent models - "logistic".
* In the case when we don't have binary xreg for the holdout, we now consider it as random and forecast it using iss().
* graphmaker() now only resets par() when legend=TRUE. This allows using layout and producing several plots with the function on one canvas.
* xregExpander() now uses iss() function in case of binary data.
* Updated an example in stepwise() function.
* ves() function now uses warning() instead of message() everywhere.
* iss() now also accepts and returns initialSeason (works with intermittent="l" only).

Bugfixes:
* Fixed Likelihood calculation for TSB probability model.


smooth v2.2.1 (Release date: 2017-11-15)
==============

Changes:
* GES now has a multiplicative form. And auto.ges() allows selecting between additive and multiplicative models.
* intermittent now has "i" and "p" values instead of "c" and "t" respectively. This aligns with the recently published working paper on the subject.
* cfType now has a different set of values. RTFM.

Bugfixes:
* Corrected a bug in auto functions with intermittent data.


smooth v2.2.0 (Release date: 2017-10-26)
==============

Changes:
* New function - auto.ges(). It's not fast, but it's pretty efficient.

Bugfixes:
* Number of parameters in ges() was not calculated correctly.
* ges() could not be initialised in cases of small samples and models with large orders.
* Fixed a bug in SSARIMA with multiple steps ahead cost functions.
* es() sometimes returned smoothing parameters values that did not satisfy the usual constrains.
* New initialisation of smoothing parameters in es() in case of cfType="HAM".

smooth v2.1.2 (Release date: 2017-09-21)
==============

Changes:
* Changed the order of parameters in the sim-functions, so that the number of observations and number of simulations follow the very first parameter. This should simplify things.
* Removed some of the redundant alliases in documentation and model.type() function. Use modelType() instead.
* Variance in cases of seasonal models and cumulative=TRUE, are now produced using simulations.
* New function - sim.sma() - generate data from SMA model.

Bugfixes:
* Check of initials when model is not selected in es().
* sim.ssarima() did not take correctly into account the provided initials.

smooth v2.1.1 (Release date: 2017-09-04)
==============

Changes:
* initials for parameters of AR now take into account the number of parameters. Should simplify optimisation of AR.
* Number of parameters in univariate models now consists of the part "estimated" and "provided". Each model now returns a table as nParam with a detailed info about what was estimated/provided. If something was provided, then it is no longer taken into account in calculation of statistics (i.e. AIC, sigma etc).
* Similar thing is now implemented for ves().
* ves() now can produce "independent" prediction intervals (when covariances for time series are ignored).
* Yet another change in the number of parameters to estimate in es(), ges() and ces(), taking that some values could be provided, while the others - left for optimisation.
* sma() now restricts the maximum order in case of order selection to 200. This corresponds to the case with global level for different time series and should be sufficient in 99.9% of cases.

Bugfixes:
* auto.ssarima() had a bug with dataMA.
* auto.ssarima() did not calculate correctly number of iterations for AR models.
* Several minor bugfixes in ges() and ssarima() functions (bugs with provided values).
* Because of R's unique feature of working with names of variables, the situation when CUpper is provided, but C is not, was not handled well.
* Check of maximum number of parameters to estimate did not take into account some of the provided values.
* sma() wasn't checking what is provided as order. Now it does.
* auto.ssarima() did not estimated percentage of estimated models correctly in cases of constant!=NULL.
* Cumulative variance was calculated incorrectly. Now the non-seasonal case is fixed. SEASONAL MODELS STILL HAVE THIS PROBLEM!
* Found bug in variance calculation for some seasonal models, which caused intervals for SSARIMA, GES and CES to be narrower than needed.

smooth v2.1.0 (Release date: 2017-08-01)
==============

Changes:
* Occurrence part of TSB model now accepts ETS models. So you can have trends / seasonality in probability.
* Both Croston and TSB in iss() can now also accept exogenous variables.
* es() now accepts model estimated using ets() function from forecast package.
* Probability in TSB is now restricted with [0, 1] region.
* We can now fit es() even on 3 observations, but with persistence forced to be equal to zero. Don't expect a good model, though...
* auto.ssarima() now allows defining whether constant is needed or not. By default it will check this automatically.
* Initials of xreg before the optimisation are now based on OLS estimates.
* In case of updateX=TRUE, we now check a very basic forecastability condition.
* A couple of new examples in vignettes.

Bugfixes:
* Parameteric prediction intervals for cases of h=1 did not work for some models.
* Fixed model selection on non-positive data, when model="YYY", intermittent!="n", but we don't have enough non-zero observations.
* Models with boundary probabilities returned -Inf as likelihood value, which is incorrect.
* xregDo now works with only one variable as well.
* intermittent="a" did not work with auto.ssarima() and auto.ces() functions.
* initials of xreg did not work correctly when Etype="A".
* Now we force the provided xreg to become a matrix.
* xreg did not work well with zoo, when xreg contained NAs. Now it should work.
* auto.ssarima() did not allow selecting the best model between AR models only. Now it does.
* Fixed xreg selection in cases of xreg having special characters in names.
* Centering of errors in sim.es() is now done automatically only for runif.
* Number of parameters returned by models was not correct, missing exogenous variables and intermittent model.


smooth v2.0.1 (Release date: 2017-07-05)
==============

Changes:
* Forecasts and prediction intervals of the rounded values are now produced analytically.
* PLS now needs vector of variances, which is produced only when intervals==TRUE. In all the other cases its value can be incorrect.
* New initials for the exogenous variables in case of multiplicative models + stricter check of correlations between the regressors.
* We also now check multiple correlations for exogenous variables.
* silent="all" is now the default value.

Bugfixes:
* Provided imodel sometimes would not be used correctly in the initialisation.
* Rounded values were not returned in cases when intervals=FALSE.
* PLS could not be calculated for some cases, when ts object was used.


smooth v2.0.0 (Release date: 2017-07-01)
==============

Changes:
* New function - ves(). Currently the basic features of all the pure additive and pure multiplicative models are implemented. No prediction intervals, no intermittence, no automatic model selection.
* New parameter - imodel, which determines the type of model for probability in case of iSS models. Can also accept models previously estimated using iss() function.
* Point forecasts in case of simulated data are now based on the simulation rather than analytical expression.
* Max order of SMA is now equal to obsInSample.
* Introduced a hidden parameter, rounded, which determines whether the rounded up value of demand sizes is assumed in the model. This influences the cost function and leads to a different results in case of intermittent model.
* If cumulative==TRUE, then we now return cumulative holdout values as well.
* New method pointLik() for smooth class. It returns the vector of log-likelihoods for each separate observation.
* Better integration of sim.es() objects and es() function. Now you can do something like this to fit the "true" model: x <- sim.es("MNN"); es(x$data,model=x).
* es() now also returns transition matrix.
* Optimised C++ code, which should result in the growth of computational speed for ~25%.
* es() now returns PLS value in the accuracy for all the types of models.

Bugfixes:
* simulator function in Rcpp did not cover the cases, when level could become negative. This is now fixed.
* ssarima() now checks if the number of observations is enough for the model and stops if it is not.
* es() didn't work in some cases of seasonal models, when number of in-sample observations was less than twice frequency of data. The seasonal model should not be used there in the first place.
* getResponse() function now returns the in-sample actuals.
* exists() functions in the code would look into the parent environments. Now they don't.
* sim.ssarima() returned state vector with wrong names in case of constant.
* When coef() was applied to es() objects, the initialSeason parameters were not returned because of the old name of the variable.
* Corrected a problem with initials of iETSX models.


smooth v1.9.9 (Release date: 2017-05-03)
==============

Changes:
* New parameter - cumulative - which makes functions return aggregated over the forecast horizon values (point and interval forecasts).
* graphmaker() now treats cumulative forecasts.
* Error measures take the possible cumulative nature of forecasts into account.
* auto() functions now also accept smooth.sim objects as data.
* polyroot() was working badly for multiple seasonal ARIMAs, so I had to ditch it in favour for my Rcpp function. SSARIMA now works even slower. Will need to optimise it somehow.
* Updated vignettes, showing how multiple seasonal ARIMA can be estimated.
* Renamed MLSTFE into GMSTFE - Geometric Mean Squared Trace Forecast Error. This is slightly easier to remember.
* Trace Forecast Likelihood is once again available as estimator.
* Started work on a new function - ves() - Vector Exponential Smoothing. It will be released in 2.0.0.

Bugfixes:
* datafreq is now used in all the functions.


smooth v1.9.1 (Release date: 2017-03-28)
==============

Changes:
* New function in error measures category - pls() - Prediction Likelihood Score.
* PLS is now included in accuracy measures of es().

Bugfixes:
* Fixed a problem with phi estimation in cases, when initial values for the optimiser are provided.
* Now we don't check C / CLower / CUpper if they are not provided.
* Fixed a problem with prediction intervals construction for binary variables.


smooth v1.9.0 (Release date: 2017-03-18)
==============

Changes:
* New function - sim.ges() - simulate data using GES model.

Bugfixes:
* Fixed bug with cfType="MSTFE" in case of multiplicative errors.


smooth v1.8.0 (Release date: 2017-03-12)
==============

Changes:
* New function - xregExpander(), which creates matrix of xreg with lagged values based on provided data and automatically fills in NAs with forecasted values using es().
* "optimal" is now the default initialisation method for ces().
* Created templates for roxygen2 for the consistency purposes of the documentation.
* plot() methods for classes smooth and smooth.sim now accept main and ylab parameters. Do whatever you want!

Bugfixes:
* In cases of df<=0 we now produce a warning and prediction intervals based on Chebyshev's inequality.
* es() now does not complain about failing to estimate something when persistence is predefined.
* Fixed a bug, when predicting binary variables using any iSS model, we would end up with errors. Now in this case we just select among the intermittent models, ignoring non-intermittent one.


smooth v1.7.1 (Release date: 2017-03-01)
==============

Changes:

* Mixed ETS models now produce negative forecasts. But it does not make much sense to my taste...
* The initial values of smoothing parameters before the optimisation are now set to 0.3, 0.2, 0.1 for both additive and multiplicative models.
* Some plot() methods for smooth now accept additional parameters.
* es() now also accepts hidden parameters C, CLower and CUpper for initialisation of optimiser and setting bounds in which to search for the optimal value.
* es(), ces(), ssarima() and ges() now accept smooth.sim objects and can automatically extract data from them. This is just for comfort...


smooth v1.7.0 (Release date: 2017-02-24)
==============

Changes:

* The package now uses roxygen2. It's a bit messy at the moment, but will be sorted out soon.
* We now import a couple of functions from forecast package (forecast and getResponse). This helps us make better connection between methods in packages.
* forecast() function for smooth now returns $method as a name of applied model and $model as a fitted R model (corresponds to what forecast does in forecast package).

Bugfixes:

* If data passed to functions was a matrix, then functions wouldn't work. Now they say about that out loud.
* Fixed a bug with mixed models with multiplicative errors. They produce sometimes senseless forecasts, but at least they produce them.
* Added some stuff to src folder (registerDynamicSymbol.c) in order to make CRAN checks shut up about some irrelevant things (R_useDynamicSymbols? R_registerRoutines? WTF?!).


smooth v1.6.4 (Release date: 2017-02-20)
==============

Changes:

* Added orders and lags method for the class Arima. This should allow easily extracting these values from models fitted using arima(), Arima() and auto.arima() functions from stats and forecast packages.
* modelType() is now renamed into model.type().
* If xreg contains NAs, we now substitute them with zeroes.

Bugfixes:

* Fixed a bug with initial value in backcasting, that was causing annoying problems in ssarima.
* Fixed a bug in sma() function and model provided to it.
* Fixed names of xreg in cases when we need to drop some of the variables.
* In some cases the second optimiser behaved badly and returned worsened value. Fixed it.
* Fixed a bug with phiEstimate becoming equal to TRUE, when phi is not needed at all.


smooth v1.6.3 (Release date: 2017-02-14)
==============

Changes:

* Fixed a problem with ETS(M,Z,Z) and xreg.
* Function now removes xreg which is equal to the value we need to forecast (if there is one).
* We also now return formula in es(), which is accesible via formula() function. This should help when you have problems in understanding what model has been constructed.

Bugfixes:

* Corrected description of accuracy measures in es(), ces(), ges() and ssarima().
* Fixed some bugs relating combination of models with xregDo="s".


smooth v1.6.2 (Release date: 2017-02-01)
==============

Changes:

* Addressed issue #58. Now matrix is first transposed and then model is fitted to data. This led to a tiny increase in speed.
* Prediction intervals for intermittent models are now rounded up.

Bugfixes:

* Non-parametric and semi-parametric intervals were broken since 1.6.0
* es() with backcasting and predefined persistence was complaining on estimation problems without any reason.
* Corrected initial quantiles for prediction intervals and optimisation mechanism (for correct prediction intervals for intermittent data).


smooth v1.6.1 (Release date: 2017-01-27)
==============

Bugfixes:

* Corrected a bug with nExovars in es()


smooth v1.6.0 (Release date: 2017-01-27)
==============

Changes:

* ssarima(), ges() and ces() now have xreg selection mechanism.
* auto.ssarima() and auto.ces() now also have that stuff.
* Finally es() does that as well.
* iSS models now return relevant error measures.
* es() now allows combining a pool of models, when the list includes "CCC".
* logLik() now also includes nobs as an attribute.
* We now report modelX if it includes xreg. For example, "ARIMAX" instead of ARIMA.
* Renamed some internal variables for consistency purpose.
* Redone prediction intervals for iSS models.

Bugfixes:

* Renamed some internal parameters for consistency purposes.
* Found a bug with nParam calculation in ges().
* Fixed a bug that did not allow to use combinations with intermittent demand in es().
* Fixed a bug in backcasting mechanism.
* Fixed a bug with incorrect df calculation for prediction intervals in combinations.


smooth v1.5.2 (Release date: 2016-12-18)
==============

Changes:

* Instead of having dozens of methods based on AIC and BIC, we now have logLik, nobs and AICc.default. The latter should also work with other, non smooth, classes (e.g. "ets","lm").
* sim functions now return likelihood via logLik value rather than "likelihood". This allows using logLik, AIC and other functions.
* iss function now also does the same...
* Introduced "SBA" as a separate method for intermittent demand.

Bugfixes:

* Parametric prediction intervals for iSS models always had width of 95%. This is now fixed.
* Corrected bug in Croston's iSS, where the last observation of data was included as non-zero demand.
* Fixed a bug when MNN was fit to intermittent data without intermittency.


smooth v1.5.1 (Release date: 2016-11-30)
==============

Changes:

* Now you can produce 0-steps ahead forecasts using smooth functions. Pretty cool, ah? And pretty useless for my taste. But here it is!
* iprob in sim functions now also accepts a vector, implying that probability may vary over time in style of TSB and Croston's method.

Bugfixes:

* intermittent data was not taken correctly into account in number of parameters calculation in functions.
* Fixed a bug with persistence not accepting matrices in es()
* persistence now looks nice in the output of sim.es()
* sim.ssarima() had a bug with array not becoming a matrix. Nailed it!


smooth v1.5.0 (Release date: 2016-11-13)
==============

Changes:

* auto.ssarima() now allows combining forecasts using IC weights. This is a first try. Prediction intervals for the combined model are currently incorrect.
* Made important changes to initialisation of SARIMA and some tuning in backcasting mechanism.
* Some tuning in sim functions in parts with ellipsis checks.
* sim.ssarima() now accepts orders as list. This should be handy when doing sim.ssarima(orders=orders(ourModel)). No need to define each order separately anymore.
* ssarima() also accepts orders as list. No need to specify separate ar.orders, ma.orders and i.orders (they are now optional) if you want to extract value from another model. Plus it is handy just to write orders=list(ar=1,i=1,ma=c(1,2,3)).
* auto.ssarima() now also uses orders as a list variable instead of ar.max, i.max and ma.max.
* sim.ssarima() now uses burn-in period if the initials were generated.
* Uodated manuals, so they are a bit more consistent.
* Got rid of silent parameter in sim functionst, because all the info they give needs to be put in warnings.
* sim functions now print proper warnings.
* Tuned initial values of es(). This should be helpfull in cases with backcasting of initials.
* Optimised auto.ssarima() mechanism. Not faster, but more accurate.

Bugfixes:

* sim.ssarima() wouldn't work in cases of ARIMA(0,0,0) with/without constant.
* polynomials were multiplied inccorectly in cases of ARIMAs with d>1.
* Fixed a bug with phiEstimate not beeing used correctly.


smooth v1.4.7 (Release date: 2016-11-01)
==============

Changes:

* New function - sim.ces(), that generates data from CES model with predefined parameters.
* Due to (1) simulate.smooth() now also works with CES.
* modelType() in cases of ces() now returns the full name of model instead of the first letter.
* auto.ces() has now a smaller pool of models: "none", "simple" and "full".

Bugfixes:

* Fixed problem with xreg length and provided initialX (issue #59 on github).
* Fixed a check of models pool in auto.ces().


smooth v1.4.6 (Release date: 2016-10-23)
==============

Changes:

* New function - sim.ssarima() that allows generating data from any ARIMA with any provided parameters.
* New methods for smooth class: lags, orders and modelType. First two are for ssarima(), ges() and sma(), the last one is for es(), ces() and ets() from "forecast" package.
* Introduced new class for simulation functions, "smooth.sim" and created print and plot methods for them.
* es() now accepts "XXX" as model. This allows excluding multiplicative components from the pool. This does not use branch and bound. So model="ZXZ" will go through all the models with T="N", T="A" and T="Ad".
* Similarly es() can now select the most appropriate non-additive model. This is regulated with: model="YYY".

Minor changes:

* Updated print for "smooth" class for es() and ges(): now we produce a nice vector with names of smoothing parameters.
* simulate.smooth() method update in order to take sim.ssarima() into account.
* AICc now also extracts AICc from ets() of "forecast" package.

Bugfixes:

* Fixed a bug with provided model with damped trend.
* Fixed a bug in pool of models with damped trend ("ZAdZ").


smooth v1.4.5 (Release date: 2016-10-16)
==============

Changes:

* Parameter intervals now accepts type of interval instead of intervalsType.
* Polynomials of ssarima() are now multiplied in C++. Initialisation is now done there as well. This slightly speeds up the estimation and construction of SSARIMA.

Bugfixes:

* Fixed names of returned smoothing parameters by es().


smooth v1.4.4 (Release date: 2016-09-20)
==============

Changes:

* auto.ssarima() function uses now a different algorithm. This allows speeding up order selection process and selecting models closer to the "true" one.
* Some corrections in smooth-Documentation.
* Package will now tell its version when loaded.

Bugfixes:

* Corrected C++ bug that caused problems on Solar OS.


smooth v1.4.3 (Release date: 2016-09-16)
==============

Changes:

* Removed "TFL" as a cost function type and "asymmetric" as intervals type. The functions still accept these parameters, but the parameters are now hidden, because currently they are not ready for wide audience.
* Changed how number of parameters is calculated when initials are provided. They should be counted in. Only backcasting now excludes initials in calculation of number of parameters.
* Prepared vignette for es(), ces(), ssarima(), ges(), sma() and sim.es(). This now includes examples with some comments.
* Uploaded documentation for the package to github (https://github.com/openforecast-org/smooth/smooth.pdf). This will be published as working paper and will be available via ResearchGate.

Bugfixes:

* Fixed a bug with intervalsType="s" not working for auto functions.
* data provided to auto functions is now checked.


smooth v1.4.2 (Release date: 2016-09-15)
==============

Changes:

* We now use vignettes, explaining how to work with functions and what they return. This is just a start of the work. Vignettes will be updated. There is also a work on documentation for models underlying smooth package. This is currently reviewed and will be available as a working paper soon.
* New function - sma() - Simple Moving Average. It fits one as a state space model. So, apparantely there is a model underlying simple moving average method...
* Named transitionX and persistenceX are now returned, when using exogenous variables are used with updateX=TRUE. This should simplify the analysis of these matrices.

Bugfixes:

* A fix for plot(es(...)) in case of inclusion of exogenous variables leading to states containing more than 10 columns.
* Warnings are now always printed out for unstable SSARIMA.


smooth v1.4.1 (Release date: 2016-09-09)
==============

Changes:

* We now suggest testthat package and do more extensive tests in order to make sure that everything works as it should.
* Introduced parameters A and B in ces() function.
* Got rid of parameter C in ces() function.

Bugfixes:

* ssarima() could not construct ARIMA(0,1,0) without constant. Fixed that.


smooth v1.4.0 (Release date: 2016-09-08)
==============

Changes:

* Started this NEWS file.
* Fixed a bug with ssarima() not accepting previously estimated models in cases with constant=TRUE.
* Removed NUS and sim.ces. They will return when they are in a better condition.
