Computes a least-cost matrix from a distance matrix. This version differs from cost_path_orthogonal_cpp() in the way it solves ties. In the case of a tie, cost_path_orthogonal_cpp() uses the first neighbor satisfying the minimum distance condition, while this function selects the neighbor that changes the axis of movement within the least-cost matrix. This function is not used anywhere within the package, but was left here for future reference.
cost_path_slotting_cpp(dist_matrix, cost_matrix)
Arguments
dist_matrix: (required, numeric matrix). Distance matrix between two time series.
cost_matrix: (required, numeric matrix). Least-cost matrix generated from dist_matrix.
Returns
data frame
Examples
#simulate two time seriesx <- zoo_simulate(seed =1)y <- zoo_simulate(seed =2)#distance matrixdist_matrix <- distance_matrix_cpp( x = x, y = y, distance ="euclidean")#least cost matrixcost_matrix <- cost_matrix_orthogonal_cpp( dist_matrix = dist_matrix
)#least cost pathcost_path <- cost_path_slotting_cpp( dist_matrix = dist_matrix, cost_matrix = cost_matrix
)
cost_path
See Also
Other Rcpp_cost_path: cost_path_cpp(), cost_path_diagonal_bandwidth_cpp(), cost_path_diagonal_cpp(), cost_path_orthogonal_bandwidth_cpp(), cost_path_orthogonal_cpp(), cost_path_sum_cpp(), cost_path_trim_cpp()