Simplex {rEDM} | R Documentation |
Simplex forecasting
Description
Simplex
performs time series forecasting based on
weighted nearest neighbors projection in the time series phase space as
described in Sugihara and May.
Usage
Simplex(pathIn = "./", dataFile = "", dataFrame = NULL, pathOut = "./",
predictFile = "", lib = "", pred = "", E = 0, Tp = 1, knn = 0, tau = -1,
exclusionRadius = 0, columns = "", target = "", embedded = FALSE,
verbose = FALSE, validLib = vector(), generateSteps = 0,
parameterList = FALSE, showPlot = FALSE, noTime = FALSE)
Arguments
pathIn |
path to |
dataFile |
.csv format data file name. The first column must be a time index or time values unless noTime is TRUE. The first row must be column names. |
dataFrame |
input data.frame. The first column must be a time index or time values unless noTime is TRUE. The columns must be named. |
pathOut |
path for |
predictFile |
output file name. |
lib |
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. |
pred |
string with start and stop indices of input data rows used for predictions. A single contiguous range is supported. |
E |
embedding dimension. |
Tp |
prediction horizon (number of time column rows). |
knn |
number of nearest neighbors. If knn=0, knn is set to E+1. |
tau |
lag of time delay embedding specified as number of time column rows. |
exclusionRadius |
excludes vectors from the search space of nearest neighbors if their relative time index is within exclusionRadius. |
columns |
string of whitespace separated column name(s), 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 used for prediction. |
embedded |
logical specifying if the input data are embedded. |
verbose |
logical to produce additional console reporting. |
validLib |
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. |
generateSteps |
number of predictive feedback generative steps. |
parameterList |
logical to add list of invoked parameters. |
showPlot |
logical to plot results. |
noTime |
logical to allow input data with no time column. |
Details
If embedded is FALSE
, the data column(s)
are embedded to
dimension E
with time lag tau
. This embedding forms an
E-dimensional phase space for the Simplex
projection.
If embedded is TRUE
, the data are assumed to contain an
E-dimensional embedding with E equal to the number of columns
.
Predictions are made using leave-one-out cross-validation, i.e.
observation vectors are excluded from the prediction simplex.
To assess an optimal embedding dimension EmbedDimension
can be applied. Accuracy statistics can be estimated by
ComputeError
.
Value
A data.frame with columns Observations, Predictions
.
The first column contains the time values.
If parameterList = TRUE
, a named list with "predictions" holding the
data.frame, "parameters" with a named list of invoked parameters.
References
Sugihara G. and May R. 1990. Nonlinear forecasting as a way of distinguishing chaos from measurement error in time series. Nature, 344:734-741.
Examples
data( block_3sp )
smplx = Simplex( dataFrame = block_3sp, lib = "1 100", pred = "101 190",
E = 3, columns = "x_t", target = "x_t" )
ComputeError( smplx $ Predictions, smplx $ Observations )