pbsEDM: Forecast via Empirical Dynamic Modelling

pbsEDMR Documentation

Forecast via Empirical Dynamic Modelling

Description

Perform short-term nonlinear forecasting via Empirical Dynamic Modelling.

Usage

pbsEDM(
  N,
  lags,
  p = 1L,
  first_difference = FALSE,
  centre_and_scale = FALSE,
  exclusion_radius = "half",
  verbose = FALSE
)

Arguments

N

A data frame with named columns for the response variable and covariate time series.

lags

A list of named integer vectors specifying the lags to use for each time series in N.

p

The integer forecast distance.

first_difference

Logical. First-difference each time series?

centre_and_scale

Logical. Centre and scale each time series?

exclusion_radius

Number of points around $\bf x_t^*$ to exclude as candidate nearest neighbours; either default of 'half' as used for our manuscript (see equation (6)), or a number to match the 'exclusionRadius' setting in 'rEDM::Simplex()'. See '?pbsDist' for more details.

verbose

Logical. Print progress?

Details

The name of the first element in lags must match the name of the response variable in N. Unlagged time series, including the response variable, must be specified by a zero in the corresponding named vector in lags. For example, given a data.frame with named columns Predator, Prey and Temperature, Predator can be specified as the unlagged response variable by

lags = list(Predator = c(0, ...), ...).

This places the unlagged time series of Predator abundance (or its optionally first-differenced and/or centred and scaled counterpart) along the first axis of the reconstructed state space. To predict Predator abundance from its first two lags, and from the unlagged and first lags of Prey and Temperature, lags can be specified as

lags = list(Predator = c(0:2), Prey = c(0:1), Temperature = c(0:1)).

This example generalizes to arbitrary (possibly non-consecutive) lags of arbitrarily many covariates (up to limitations of time series length).

Value

A list of class pbsEDM containing:

  • N [matrix()] Response variable and unlagged covariates as columns

  • N_observed [vector()] Response variable time series

  • N_forecast [vector()] Forecast of response variable time series

  • X [matrix()] Unlagged and lagged state variables as columns

  • X_observed [vector()] Transformed response variable time series

  • X_forecast [vector()] Forecast of transformed response variable

  • X_distance [matrix()] Square distance matrix between pairs of points in state space (pairs of rows in X)

  • neighbour_distance [matrix()] Distance by focal time (row) and rank (column)

  • neighbour_index [matrix()] Neighbour index by focal time (row) and distance rank (column)

  • neighbour_value [matrix()] Neighbour value by focal time (row) and distance rank (column)

  • neighbour_weight [matrix()] Neighbour weight by focal time (row) and distance rank (column)

  • projected_index [matrix()] Projected neighbour index by projected time (row) and neighbour distance rank (column)

  • projected_value [matrix()] Projected neighbour value by projected time (row) and neighbour distance rank (column)

  • projected_weight [matrix()] Projected neighbour weight by projected time (row) and neighbour distance rank (column)

  • lags [list()] A named list of integer vectors specifying the lags to use for each time series in N

  • p [integer()] The forecast distance

  • first_difference [logical()] First difference each time series?

  • centre_and_scale [logical()] Centre and scale each time series?

  • results [data.frame()] A summary of forecast accuracy

Author(s)

Luke A. Rogers

Examples

N <- matrix(rep(1:30, 5), ncol = 5)
colnames(N) <- c("A", "B", "C", "D", "E")
lags <- list(A = c(0, 1, 2), B = c(0, 1), C = c(0, 1, 2))
m1 <- pbsEDM(N, lags, verbose = TRUE)

N <- data.frame(x = simple_ts)
lags <- list(x = 0:1)
m2 <- pbsEDM(N, lags, verbose = TRUE)

N <- data.frame(x = simple_ts)
lags <- list(x = 0:1)
m3 <- pbsEDM(N, lags, first_difference = TRUE, verbose = TRUE)


luke-a-rogers/pbsedm documentation built on June 3, 2024, 5:20 a.m.