multiview {rEDM} | R Documentation

## Perform forecasting using multiview embedding

### Description

`multiview` applies the method described in Ye & Sugihara (2016) for forecasting, wherein 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 = c(1, floor(NROW(block)/2)),
      pred = c(floor(NROW(block)/2), NROW(block)), norm_type = c("L2 norm",
      "L1 norm", "P norm"), P = 0.5, E = 3, tau = 1, tp = 1,
      max_lag = 3, num_neighbors = "e+1", k = "sqrt", na.rm = FALSE,
      target_column = 1, stats_only = TRUE, first_column_time = FALSE,
      exclusion_radius = NULL, silent = FALSE, short_output = 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 (or 2-element vector) where each row specifes the first and last *rows* of the time series to use for attractor reconstruction
`pred` | (same format as lib), but specifying the sections of the time series to forecast.
`norm_type` | the distance function to use. see 'Details'
`P` | the exponent for the P norm
`E` | the embedding dimensions to use for time delay embedding
`tau` | the lag 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
`num_neighbors` | the number of nearest neighbors to use for the in-sample prediction (any of "e+1", "E+1", "e + 1", "E + 1" will peg this parameter to E+1 for each run, any value < 1 will use all possible neighbors.)
`k` | the number of embeddings to use (any of "sqrt", "SQRT" will use k = floor(sqrt(m)))
`na.rm` | logical. Should missing values (including `NaN` be omitted from the calculations?)
`target_column` | the index (or name) of the column to forecast
`stats_only` | specify whether to output just the forecast statistics or the raw predictions for each run
`first_column_time` | indicates whether the first column of the given block is a time column (and therefore excluded when indexing)
`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
`short_output` | specifies whether to return a truncated output data.frame whose rows only include the predictions made and not the whole input block

### Details

uses multiple time series given as input to generate an attractor reconstruction, and then applies the simplex projection or s-map algorithm to make forecasts. This method generalizes the `simplex` and `s-map` routines, 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. Rownames will be converted to numeric if possible to be used as the time index, otherwise 1:NROW will be used instead. 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_type "L2 norm" (default) uses the typical Euclidean distance:

distance(a, b) := √(∑(a_i - b_i)^2)

norm_type "L1 norm" uses the Manhattan distance:

distance(a, b) := ∑|a_i - b_i|

norm type "P norm" uses the P norm, generalizing the L1 and L2 norm to use $p$ as the exponent:

distance(a, b) := (∑(a_i - b_i)^p)^(1/p)

### Value

If stats_only, then a data.frame with components for the parameters and forecast statistics:

E | embedding dimension
tau | time lag
tp | prediction horizon
nn | number of neighbors
k | number of embeddings used
num_pred | number of predictions
rho | correlation coefficient between observations and predictions
mae | mean absolute error
rmse | root mean square error
perc | percent correct sign
p_val | p-value that rho is significantly greater than 0 using Fisher's z-transformation
const_rho | same as rho, but for the constant predictor
const_mae | same as mae, but for the constant predictor
const_rmse | same as rmse, but for the constant predictor
const_perc | same as perc, but for the constant predictor
const_p_val | same as p_val, but for the constant predictor

Otherwise, a list where the number of elements is equal to the number of runs (unique parameter combinations). Each element is a list with the following components:

params | data.frame of parameters (E, tau, tp, nn, k)
lib_stats | data.frame of in-sample forecast statistics
model_output | data.frame with columns for the time index, observations, and predictions
pred_stats | data.frame of forecast statistics

### Examples

    data("block_3sp")
    block <- block_3sp[, c(2, 5, 8)]
    multiview(block, k = c(1, 3, "sqrt"))

[Package rEDM version 0.7.2 Index]