Learn R Programming

rEDM (version 1.8.2)

multiview: Perform forecasting using multiview embedding

Description

multiview applies the method described in Ye & Sugihara (2016) for forecasting, where multiple attractor reconstructions are tested, and a single nearest neighbor is selected from each of the top k reconstructions to produce final forecasts.

Usage

multiview(block, lib = NULL, pred = NULL, norm = 2, E = 1, tau = -1, 
    tp = 1, max_lag = 3, num_neighbors = "e+1", k = "sqrt", na.rm = FALSE, 
    target_column = 1, stats_only = TRUE, save_lagged_block = FALSE, 
    first_column_time = FALSE, exclusion_radius = NULL, silent = FALSE)

Arguments

block

either a vector to be used as the time series, or a data.frame or matrix where each column is a time series

lib

a 2-column matrix, data.frame, 2-element vector or string of row indice pairs, where each pair specifies the first and last *rows* of the time series to create the library. If not specified, all available rows are used

pred

(same format as lib), but specifying the sections of the time series to forecast. If not specified, set equal to lib

norm

the distance measure to use. see 'Details'

E

the embedding dimensions to use for time delay embedding. The default value of 1 does not embed the data.

tau

the time-delay offset to use for time delay embedding

tp

the prediction horizon (how far ahead to forecast)

max_lag

the maximum number of lags to use for variable combinations. If max_lag == 3, a variable X will be embedded with lags X[t], X[t + tau], X[t + 2*tau]

num_neighbors

the number of nearest neighbors to use. Note that the default value will change depending on the method selected. (any of "e+1", "E+1", "e + 1", "E + 1" will set this parameter to E+1 for each run.)

k

the number of embeddings to use for ensemble averaging. "sqrt" or 0 will use k = sqrt(m) where m is the number of multiview combinations of the set of input variables

na.rm

logical. Should missing values (including `NaN`` be omitted from the calculations?)

target_column

the name (index) of the column to forecast

stats_only

specify whether to output just the forecast statistics or the raw predictions for each run

save_lagged_block

specify whether to output the lagged block that is constructed as part of running multiview

first_column_time

indicates whether the first column of the given block is a time column and excluded when building the library

exclusion_radius

excludes vectors from the search space of nearest neighbors if their *time index* is within exclusion_radius (NULL turns this option off)

silent

prevents warning messages from being printed to the R console

Value

A named list with items "View" and "Predictions". View is a data.frame with components:

col_i,... col_j column indices of the embedding
name_i,... nam_j column names of the embedding
rho correlation of the projection
MAE maximum absolute error of the projection
RMSE root mean square error of the projection

Predictions is a data.frame of the predictions from the best multivew ensemble.

Details

multiview uses multiple time series given as input to generate an attractor reconstruction, and then applies the simplex projection to make forecasts. This method generalizes the simplex routine, and allows for "mixed" embeddings, where multiple time series can be used as different dimensions of an attractor reconstruction.

The default parameters are set so that, given a matrix of time series, forecasts will be produced for the first column. By default, all possible combinations of the columns are used for the attractor construction, the k = sqrt(m) heuristic will be used, forecasts will be one time step ahead. If a time vector is not supplied, 1:NROW will be used. The default lib and pred are to use the first half of the data for the "library" and to predict over the second half of the data. Unless otherwise set, the output will be just the forecast statistics.

norm = 2 (only option currently available) uses the "L2 norm", Euclidean distance: $$distance(a,b) := \sqrt{\sum_i{(a_i - b_i)^2}} $$

Examples

Run this code
# NOT RUN {
block <- block_3sp[, c(2, 5, 8)]
multiview( block, k=10 )
# }

Run the code above in your browser using DataLab