SMap
performs time series forecasting based on localised
(or global) nearest neighbor projection in the time series phase space as
described in Sugihara 1994.
SMap(pathIn = "./", dataFile = "", dataFrame = NULL,
lib = "", pred = "", E = 0, Tp = 1, knn = 0, tau = -1,
theta = 0, exclusionRadius = 0, columns = "", target = "", smapFile = "",
embedded = FALSE, const_pred = FALSE, verbose = FALSE,
validLib = vector(), generateSteps = 0, parameterList = FALSE,
showPlot = FALSE)
A named list with two data.frames [[predictions, coefficients]]
.
predictions
has columns Observations, Predictions
. If
const_pred
is TRUE the column Const_Predictions
is added.
The first column contains time values.
coefficients
data.frame has time values in the first column.
Columns 2 through E+2 (E+1 columns) are the SMap coefficients.
If parameterList = TRUE
a named list "parameters" is added.
path to dataFile
.
.csv format data file name. The first column must be a time index or time values. The first row must be column names.
input data.frame. The first column must be a time index or time values. The columns must be named.
string with start and stop indices of input data rows used to create the library of observations. A single contiguous range is supported.
string with start and stop indices of input data rows used for predictions. A single contiguous range is supported.
embedding dimension.
prediction horizon (number of time column rows).
number of nearest neighbors. If knn=0, knn is set to the library size.
lag of time delay embedding specified as number of time column rows.
neighbor localisation exponent.
excludes vectors from the search space of nearest neighbors if their relative time index is within exclusionRadius.
string of whitespace separated column name(s) in the input data used to create the library.
column name in the input data used for prediction.
output file containing SMap coefficients.
logical specifying if the input data are embedded.
logical to add a constant predictor column to the output. The constant predictor is X(t+1) = X(t).
logical to produce additional console reporting.
logical vector the same length as the number of data rows. Any data row represented in this vector as FALSE, will not be included in the library.
number of predictive feedback generative steps.
logical to add list of invoked parameters.
logical to plot results.
If embedded
is FALSE
, the data column(s)
are embedded
to dimension E
with time lag tau
. This embedding forms an
n-columns * E-dimensional phase space for the SMap
projection.
If embedded is TRUE
, the data are assumed to contain an
E-dimensional embedding with E equal to the number of columns
.
See the Note below for proper use of multivariate data (number of
columns
> 1).
Predictions are made using leave-one-out cross-validation, i.e. observation rows are excluded from the prediction regression.
In contrast to Simplex
, SMap
uses all
available neighbors and weights them with an exponential decay
in phase space distance with exponent theta
. theta
=0
uses all neighbors corresponding to a global autoregressive model.
As theta
increases, neighbors closer in vicinity to the
observation are considered.
Sugihara G. 1994. Nonlinear forecasting for the classification of natural time series. Philosophical Transactions: Physical Sciences and Engineering, 348 (1688):477-495.
data(circle)
L = SMap( dataFrame = circle,lib="1 100", pred="110 190", theta = 4,
E = 2, embedded = TRUE, columns = "x y", target = "x" )
Run the code above in your browser using DataLab