Skip to content

Commit 4e00b3b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into start-smooth-for-python
2 parents af62959 + 15dc55e commit 4e00b3b

32 files changed

+1568
-956
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ jobs:
3333
uses: actions/checkout@v2
3434

3535
- name: Setup R (${{ matrix.config.r }})
36-
uses: r-lib/actions/setup-r@v1
36+
uses: r-lib/actions/setup-r@v2
3737
with:
3838
r-version: ${{ matrix.config.r }}
3939
http-user-agent: ${{ matrix.config.http-user-agent }}
4040

4141
- name: Setup Pandoc
42-
uses: r-lib/actions/setup-pandoc@v1
42+
uses: r-lib/actions/setup-pandoc@v2
4343

4444
- name: Query dependencies
4545
run: |

CRAN-SUBMISSION

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 3.2.0
2-
Date: 2023-01-17 22:46:37 UTC
3-
SHA: 1e1609ec5c9faffd021b14d3709bf182af4b9801
1+
Version: 4.0.0
2+
Date: 2023-09-16 10:25:42 UTC
3+
SHA: 93d2e3fa4bded6ac4faee02dd50694428bb1fac6

DESCRIPTION

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
Package: smooth
22
Type: Package
33
Title: Forecasting Using State Space Models
4-
Version: 3.2.1.41001
5-
Date: 2023-01-18
4+
Version: 4.0.0
5+
Date: 2023-09-15
66
Authors@R: person("Ivan", "Svetunkov", email = "[email protected]", role = c("aut", "cre"),
77
comment="Lecturer at Centre for Marketing Analytics and Forecasting, Lancaster University, UK")
88
URL: https://github.com/config-i1/smooth
99
BugReports: https://github.com/config-i1/smooth/issues
1010
Language: en-GB
1111
Description: Functions implementing Single Source of Error state space models for purposes of time series analysis and forecasting.
12-
The package includes ADAM (Svetunkov, 2021, <https://openforecast.org/adam/>),
12+
The package includes ADAM (Svetunkov, 2023, <https://openforecast.org/adam/>),
1313
Exponential Smoothing (Hyndman et al., 2008, <doi: 10.1007/978-3-540-71918-2>),
1414
SARIMA (Svetunkov & Boylan, 2019 <doi: 10.1080/00207543.2019.1600764>),
1515
Complex Exponential Smoothing (Svetunkov & Kourentzes, 2018, <doi: 10.13140/RG.2.2.24986.29123>),
1616
Simple Moving Average (Svetunkov & Petropoulos, 2018 <doi: 10.1080/00207543.2017.1380326>)
1717
and several simulation functions. It also allows dealing with intermittent demand based on the
1818
iETS framework (Svetunkov & Boylan, 2019, <doi: 10.13140/RG.2.2.35897.06242>).
19-
License: GPL (>=2)
19+
License: LGPL-2.1
2020
Depends:
2121
R (>= 3.0.2),
22-
greybox (>= 1.0.7)
22+
greybox (>= 1.0.8)
2323
Imports:
2424
Rcpp (>= 0.12.3),
2525
stats,
@@ -44,6 +44,6 @@ Suggests:
4444
doParallel,
4545
foreach
4646
VignetteBuilder: knitr
47-
RoxygenNote: 7.2.1
47+
RoxygenNote: 7.2.3
4848
Encoding: UTF-8
4949
Roxygen: list(old_usage = TRUE)

NAMESPACE

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
S3method(AICc,smooth)
44
S3method(BICc,smooth)
5+
S3method(accuracy,smooth)
6+
S3method(accuracy,smooth.forecast)
57
S3method(actuals,adam)
68
S3method(actuals,msdecompose)
79
S3method(actuals,smooth)
@@ -74,6 +76,7 @@ S3method(plot,msdecompose)
7476
S3method(plot,oes)
7577
S3method(plot,oes.sim)
7678
S3method(plot,reapply)
79+
S3method(plot,reapplyCombined)
7780
S3method(plot,smooth)
7881
S3method(plot,smooth.forecast)
7982
S3method(plot,smooth.sim)
@@ -92,11 +95,13 @@ S3method(print,msdecompose)
9295
S3method(print,oes)
9396
S3method(print,oes.sim)
9497
S3method(print,reapply)
98+
S3method(print,reapplyCombined)
9599
S3method(print,smooth)
96100
S3method(print,smooth.forecast)
97101
S3method(print,smooth.sim)
98102
S3method(print,summary.adam)
99103
S3method(reapply,adam)
104+
S3method(reapply,adamCombined)
100105
S3method(reapply,default)
101106
S3method(reforecast,adam)
102107
S3method(reforecast,default)
@@ -123,6 +128,7 @@ S3method(summary,smooth.forecast)
123128
S3method(vcov,adam)
124129
S3method(xtable,adam)
125130
S3method(xtable,summary.adam)
131+
export(accuracy)
126132
export(adam)
127133
export(auto.adam)
128134
export(auto.ces)
@@ -175,6 +181,7 @@ export(xtable)
175181
import(Rcpp)
176182
import(zoo)
177183
importFrom(MASS,mvrnorm)
184+
importFrom(generics,accuracy)
178185
importFrom(generics,forecast)
179186
importFrom(grDevices,dev.interactive)
180187
importFrom(grDevices,devAskNewPage)

NEWS

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
1-
smooth v3.2.1 (Release data: 2023-01-18)
1+
smooth v4.0.0 (Release data: 2023-09-15)
22
=======
33

4+
Changes:
5+
* 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/config-i1/smooth/releases/tag/v3.2.2
6+
7+
8+
smooth v3.2.2 (Release data: 2023-09-15)
9+
=======
10+
11+
Changes:
12+
* Expanded info on simulate functions in the package description.
13+
* 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.
14+
* auto.msarima() is now a wrapper of adam() with orders=list(..., select=TRUE).
15+
* accuracy() is now implemented for smooth classes.
16+
17+
Bugfixes:
18+
* forecast.adam() would not work correctly if the newdata had missing values.
19+
* Finally found and fixed an annoying bug that caused ARIMA to fail in some cases.
20+
* Fix in forecast.adam() for cases of h=1 and analytical variance.
21+
* A fix for adam() with LASSO/RIDGE, where "lambdaOriginal was not found".
22+
23+
24+
smooth v3.2.1 (Release data: 2023-06-01)
25+
=======
26+
27+
Changes:
28+
* Combined ADAM now skips the models with weights less than 0.001, when producing forecasts.
29+
* forecast() for combined ADAM now also supports interval="complete".
30+
* reapply() method for combined ADAM.
31+
432
Bugfixes:
533
* Correct default for initial in auto.adam().
34+
* PACF in plot.smooth() dropped the first lag because of a typo.
35+
* adam() would not calculate logLik() correctly for Generalised Normal distribution in case of Multiplicative error models.
36+
* sma() with order selection would not work on data with number of observations lower than the frequency.
37+
* Fix in simulate.adam(), which would ignore the states of the model.
38+
* sm() now works with pure regression and regressors="select". But we now rely on greybox 1.0.8.
39+
* formula is now properly used in adam() in regressors="select".
40+
* smoothCombine() wouldn't work because of the wrong interval type.
41+
* coefbootstrap() now has a slightly larger smallest sample to consider (1 more observation). This should make it more robust.
42+
* Fix in adam() with Gamma distribution and mixed models.
43+
* Fixed a bug with ARIMA(0,d,0) with drift and an initial B becoming outside of bounds.
644

745

846
smooth v3.2.0 (Release data: 2023-01-18)

R/adam-es.R

+7-3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@
7878
#' Keep in mind that model selection with "Z" components uses Branch and Bound
7979
#' algorithm and may skip some models that could have slightly smaller
8080
#' information criteria.
81+
#' @param lags Defines lags for the corresponding components. All components
82+
#' count, starting from level, so ETS(M,M,M) model for monthly data will have
83+
#' \code{lags=c(1,1,12)}. However, the function will also accept \code{lags=c(12)},
84+
#' assuming that the lags 1 were dropped.
8185
#' @param phi Value of damping parameter. If \code{NULL} then it is estimated.
8286
#' @param initial Can be either character or a vector of initial states.
8387
#' If it is character, then it can be \code{"optimal"}, meaning that all initial
@@ -225,7 +229,7 @@
225229
#'
226230
#' @rdname es
227231
#' @export
228-
es <- function(y, model="ZZZ", persistence=NULL, phi=NULL,
232+
es <- function(y, model="ZZZ", lags=c(frequency(y)), persistence=NULL, phi=NULL,
229233
initial=c("optimal","backcasting","complete"), initialSeason=NULL, ic=c("AICc","AIC","BIC","BICc"),
230234
loss=c("likelihood","MSE","MAE","HAM","MSEh","TMSE","GTMSE","MSCE"),
231235
h=10, holdout=FALSE,
@@ -354,7 +358,7 @@ es <- function(y, model="ZZZ", persistence=NULL, phi=NULL,
354358
data <- ts(data, start=start(y), frequency=frequency(y));
355359
colnames(data)[1] <- "y";
356360
# Give name to the explanatory variables if they do not have them
357-
if(is.null(names(xreg))){
361+
if(is.null(colnames(xreg))){
358362
if(!is.null(ncol(xreg))){
359363
colnames(data)[-1] <- paste0("x",c(1:ncol(xreg)));
360364
}
@@ -397,7 +401,7 @@ es <- function(y, model="ZZZ", persistence=NULL, phi=NULL,
397401
"Please use forecast() method to produce cumulative values.")
398402
}
399403

400-
ourModel <- adam(data=data, model=model, persistence=persistence, phi=phi,
404+
ourModel <- adam(data=data, model=model, lags=lags, persistence=persistence, phi=phi,
401405
loss=loss, h=h, holdout=holdout, initial=initialValue,
402406
ic=ic, bounds=bounds, distribution="dnorm",
403407
silent=silent, regressors=regressors[1], ...);

R/adam-msarima.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ msarima <- function(y, orders=list(ar=c(0),i=c(1),ma=c(1)), lags=c(1),
197197
h=10, holdout=FALSE,
198198
# cumulative=FALSE,
199199
# interval=c("none","parametric","likelihood","semiparametric","nonparametric"), level=0.95,
200-
bounds=c("admissible","none"),
200+
bounds=c("usual","admissible","none"),
201201
silent=TRUE,
202-
xreg=NULL, regressors=c("use","select"), initialX=NULL, ...){
202+
xreg=NULL, regressors=c("use","select","adapt"), initialX=NULL, ...){
203203
# Copyright (C) 2022 - Inf Ivan Svetunkov
204204

205205
# Start measuring the time of calculations

R/adam-sma.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ sma <- function(y, order=NULL, ic=c("AICc","AIC","BIC","BICc"),
285285
# If the new IC is the same as one of the old ones, stop
286286
optimalICNotFound[] <- j!=i && j!=k && j!=0;
287287
}
288-
# Check a specifif order equal to frequency of the data
289-
if(is.na(ICs[yFrequency])){
288+
# Check a specific order equal to frequency of the data
289+
if(is.na(ICs[yFrequency]) && obsInSample>=yFrequency){
290290
ICs[yFrequency] <- CreatorSMA(yFrequency);
291291
if(!silent){
292292
cat(paste0("Order " , yFrequency, " - ", round(ICs[yFrequency],4), "\n"));

0 commit comments

Comments
 (0)