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(dataFrame = NULL, columns, target, lib, pred, E = NULL, Tp = 1, knn = 0,
tau = -1, theta = 0, exclusionRadius = 0, embedded = FALSE,
validLib = logical(0), noTime = FALSE, ignoreNan = TRUE,
backend = "RANN", pathIn = "./", dataFile = "", pathOut = "./",
predictFile = "", parameterList = FALSE, includeState = FALSE,
verbose = FALSE, showPlot = FALSE)A named list with three data.frames
[[predictions, coefficients, singularValues]].
predictions has columns Observations, Predictions.
The first column contains time or index values.
coefficients data.frame has time or index values in the first column.
Columns 2 through E+2 (E+1 columns) are the SMap coefficients.
singularValues data.frame has time or index values in the first column.
Columns 2 through E+2 (E+1 columns) are the SVD singularValues. The
first value corresponds to the SVD bias (intercept) term.
If parameterList = TRUE a named list "parameters" is added.
If includeState = TRUE a named list "internal" is added.
A data.frame of input data. The first column must be a time
index or time values unless noTime = TRUE. The columns must be named.
Column name(s) to build the embedding: character vector or space-separated string, or vector of column names used to create the library. If individual column names contain whitespace place names in a vector, or, append ',' to the name.
Target column name to predict.
string or vector with start and stop indices of input data rows used to create the library from observations. Mulitple row index pairs can be specified with each pair defining the first and last rows of time series observation segments used to create the library.
string with start and stop indices of input data rows used for predictions. A single contiguous range is supported.
Embedding dimension. Required (no default); must be a positive integer unless embedded = TRUE, in which case it is inferred as the number of columns.
Forecast interval (prediction horizon).
Number of nearest neighbours. 0 selects the method default.
Embedding delay (negative selects past lags).
S-map localisation parameter (0 = global linear map).
Temporal (Theiler) exclusion radius around each prediction point. Excludes vectors from the search space of nearest neighbors if their relative time index is within exclusionRadius.
If TRUE, columns already form the embedding.
Logical vector marking admissible library rows (or length 0 for all).
If TRUE, synthesise a 1..N time index instead of using column 1.
Remove rows with NaN in the embedding from the library and prediction sets.
File path for input dataFile.
Input dataFile, .csv format. The first column must be a time index or time values unless noTime is TRUE. The first row must be column names.
Output file path for predictFile
Output file name, .csv format.
Nearest-neighbour backend: "RANN" (default) or "brute".
Append named list of parameters/values to return.
If TRUE, also return an internal list of engine state: knn_neighbors, knn_distances, lib_i, pred_i, targetVec, embedding (1-based row indices; 0 = neighbour sentinel).
Emit diagnostic messages.
If TRUE, draw a base-graphics plot of the result.
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).
If ignoreNan is TRUE, the library (lib) is
internally redefined to exclude nan embedding vectors. If
ignoreNan is FALSE no library adjustment is made. The
(lib) can be explicitly specified to exclude nan library vectors.
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.