When you have a constant variable in your data (ie same value for all the sample), and use block.spls with scale = TRUE there is an error because infinite values are created during the scaling process. It would be interesting to add a test after the scale function to detect it and stop the execution with a text describing the problem.
exampel code : library(mixOmics)
n < 50 p < 100 X = list("bloc1" = matrix(rnorm(np), n, p, dimnames = list(paste0("ind",1:n), paste0("varb1_",1:p))), "bloc2" = matrix(rnorm(np), n, p, dimnames = list(paste0("ind",1:n), paste0("varb2_",1:p))))
X$bloc1[,10] = 1 Y = X$bloc1[,1:5]%%c(2,1,1,2,1) + X$bloc2[,1:5]%%c(2,1,1,2,1) rownames(Y) = paste0("ind",1:n) colnames(Y) = "Y1"
design = matrix(c(0,0,1,0,0,1,1,1,0), nrow = 3, dimnames = list(c("bloc1", "bloc2", "Y"),c("bloc1", "bloc2", "Y"))) res < block.spls(X, Y, ncomp = 2, keepX = list("bloc1" = 10, "bloc2" = 10), keepY = 1, mode = "regression", scale = TRUE)
Comments (2)


 changed status to resolved
Constant variables are not included in the model per default (loadings of 0)
 Log in to comment
Hi there,
That could be a nice proposal indeed. So far, mixOmics assumes that the data has been normalised and preprocessed; a constant variable should have been discarded by these steps.