#' The TSIMD Function
#'
#' Allows Dimension Reduction of Multivariate Time Series.
#'
#' @param X Predictors.
#' @param y Target.
#' @keywords TS MV DM.
#' @export
#'
#'
#'
TSIMD <- function(X, y, n_slices = 10, n_lags = 12){
output <- matrix(nrow = n_lags, ncol = ncol(X))
for (i in 1:n_lags){
# Leading the y up, removeing the relevent NA
output[i,] <- AlgoTSIMD(X, y, n_slices = n_slices, n_lags = n_lags)
y <- leadTSIMD(y)[-length(y)]
X <- X[-nrow(X),]
}
colnames(output) <- colnames(X)
result <- output / sum(output)
return(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.