Skip to contents

Least cost path between two time series x and y. NA values must be removed from x and y before using this function. If the selected distance function is "chi" or "cosine", pairs of zeros should be either removed or replaced with pseudo-zeros (i.e. 0.00001).

Usage

cost_path_cpp(
  x,
  y,
  distance = "euclidean",
  diagonal = TRUE,
  weighted = TRUE,
  ignore_blocks = FALSE
)

Arguments

x

(required, numeric matrix) multivariate time series.

y

(required, numeric matrix) multivariate time series with the same number of columns as 'x'.

distance

(optional, character string) distance name from the "names" column of the dataset distances (see distances$name). Default: "euclidean".

diagonal

(optional, logical). If TRUE, diagonals are included in the computation of the cost matrix. Default: FALSE.

weighted

(optional, logical). If TRUE, diagonal is set to TRUE, and diagonal cost is weighted by y factor of 1.414214. Default: FALSE.

ignore_blocks

(optional, logical). If TRUE, blocks of consecutive path coordinates are trimmed to avoid inflating the psi distance. Default: FALSE.

Value

data frame