diff --git a/tensorPredictors/R/TSIR.R b/tensorPredictors/R/TSIR.R index 1c364d1..4ee49a8 100644 --- a/tensorPredictors/R/TSIR.R +++ b/tensorPredictors/R/TSIR.R @@ -45,7 +45,7 @@ TSIR <- function(X, y, y <- as.integer(y) # center `X` - X <- X - c(rowMeans(X, dim = length(modes))) + X <- X - as.vector(rowMeans(X, dim = length(modes))) # Slice `X` into slices governed by `y` slices <- Map(function(s) { @@ -119,7 +119,7 @@ TSIR <- function(X, y, } # mode sample covariance matrices - Omegas <- Map(function(k) n^-1 * mcrossprod(X, mode = k), modes) + Omegas <- Map(function(k) prod(dim(X)[-k])^-1 * mcrossprod(X, mode = k), modes) # Check condition of sample covariances and perform regularization if needed if (is.finite(cond.threshold)) {