Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/fittestWavelet.r
The function automatically applies a maximal overlap discrete wavelet
transform to a provided univariate time series. The resulting components of
the decomposed series are used as base for predicting and returning the next
n consecutive values of the provided univariate time series using also
automatically fitted models (ets
or arima
). It
also evaluates fitness and prediction accuracy of the produced models.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | fittestWavelet(
timeseries,
timeseries.test = NULL,
h = 1,
filters = c("haar", "d4", "la8", "bl14", "c6"),
n.levels = NULL,
maxlevel = NULL,
boundary = "periodic",
model = c("ets", "arima"),
conf.level = 0.95,
na.action = stats::na.omit,
rank.by = c("MSE", "NMSE", "MAPE", "sMAPE", "MaxError", "AIC", "AICc", "BIC",
"logLik", "errors", "fitness"),
...
)
|
timeseries |
A vector or univariate time series. |
timeseries.test |
A vector or univariate time series containing a
continuation for |
h |
Number of consecutive values of the time series to be predicted. If
|
filters |
A vector containing character strings indicating which
wavelet filter to use in the decomposition. If |
n.levels |
An integer specifying the level of the decomposition. If
|
maxlevel |
A numeric integer value corresponding to the maximal level
of candidate wavelet decompositions to be produced and evaluated. If
|
boundary |
Character string. Indicates which boundary method to use.
See |
model |
Character string. Indicates which model is to be used for fitting and prediction of the components of the decomposed series. |
conf.level |
Confidence level for prediction intervals. See the
|
na.action |
A function for treating missing values in |
rank.by |
Character string. Criteria used for ranking candidate decompositions/models/predictions generated during parameter selection. See 'Details'. |
... |
Additional arguments passed to the modeling functions.
~~Describe |
The function produces a maximal overlap discrete wavelet transform of
timeseries
. It performs a time series decomposition of level
n.levels
using the wavelet filter filters
. See the
modwt
function. Each component series resulting from
the decomposition (n.levels
wavelet coefficients series and
n.levels
scaling coefficients series) is separately used as base for
model fitting and prediction. If model="arima"
, arima models are used
and automatically fitted using the auto.arima
function. If model="ets"
, the function fits
[forecast]ets
models. The set of predictions for all component
series are then reversed transformed in order to produce the next h
consecutive values of the provided univariate time series in
timeseries
. See the imodwt
function.
If length(filters)>1
or filters=NULL
, it is automatically
selected. For that, a set of candidate wavelet decompositions with different
options of filters is generated and used for model fitting and prediction.
Also, if n.levels
is NULL
, it is automatically set as a value
within the interval 1:maxlevel
(if maxlevel
is not provided,
it is calculated according to the wavelet filter based on code from
modwt
). For that, candidate decompositions are
specified with different levels. The options of filter and/or level of
decomposition which generate the best ranked model fitness/predictions
acoording to the criteria in rank.by
are selected.
The ranking criteria in rank.by
may be set as a prediction error
measure (such as MSE
, NMSE
, MAPE
,
sMAPE
or MAXError
), or as a fitness criteria
(such as AIC
, AICc
, BIC
or
logLik
). In the former case, the candidate wavelet
decompositions are used for time series prediction and the error measures
are calculated by means of a cross-validation process. In the latter case,
the component series of the candidate decompositions are modeled and model
fitness criteria are calculated based on all observations in
timeseries
. In particular, the fitness criteria calculated for
ranking the candidate decomposition correspond to the model produced for the
n.levels
th scaling coefficients series as it can be considered the
main component of a decomposition of level n.levels
(Conejo,2005).
If rank.by
is set as "errors"
or "fitness"
, the
candidate decompositions are ranked by all the mentioned prediction error
measures or fitness criteria, respectively. The wheight of the ranking
criteria is equally distributed. In this case, a rank.position.sum
criterion is produced for ranking the candidate decompositions. The
rank.position.sum
criterion is calculated as the sum of the rank
positions of a decomposition (1 = 1st position = better ranked model, 2 =
2nd position, etc.) on each calculated ranking criteria.
A list with components:
WT |
An object of class
|
level |
The level of wavelet decomposition provided or automatically selected. |
filter |
A character string indicating the (provided or automatically selected) wavelet filter used in the decomposition. |
AICc |
Numeric value of the computed AICc criterion of
the fitted model for the |
AIC |
Numeric value of the computed AIC criterion of the fitted model
for the |
BIC |
Numeric
value of the computed BIC criterion of the fitted model for the
|
logLik |
Numeric value of
the computed log-likelihood of the fitted model for the |
pred |
A list with the components
|
MSE |
Numeric value of the resulting MSE error of prediction. Require
|
NMSE |
Numeric value of the resulting NMSE
error of prediction. Require |
MAPE |
Numeric
value of the resulting MAPE error of prediction. Require
|
sMAPE |
Numeric value of the resulting sMAPE
error of prediction. Require |
MaxError |
Numeric value of the maximal error of prediction. Require
|
rank.val |
Data.frame with the fitness or
prediction accuracy criteria computed based on all candidate decompositions
ranked by |
rank.by |
Ranking criteria used for ranking candidate decompositions
and producing |
Rebecca Pontes Salles
A. J. Conejo, M. A. Plazas, R. Espinola, A. B. Molina, Day-ahead electricity price forecasting using the wavelet transform and ARIMA models, IEEE Transactions on Power Systems 20 (2005) 1035-1042.
T. Joo, S. Kim, Time series forecasting based on wavelet filtering, Expert Systems with Applications 42 (2015) 3868-3874.
C. Stolojescu, I. Railean, S. M. P. Lenca, A. Isar, A wavelet based prediction method for time series. In Proceedings of the 2010 International Conference Stochastic Modeling Techniques and Data Analysis, Chania, Greece (pp. 8-11) (2010).
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.