I am trying to use NIPALS to impute my missing data for my MS proteomic block.
When I run the following command:
nipals(untargeted.ru, ncomp = 10, reconst = TRUE)
I get this error:
Error in ph.new/drop(sqrt(crossprod(ph.new))) : non-conformable arrays
untargeted.ru is my proteomic dataset; with 49 samples in rows, and 409 proteins in columns. The missing values are indicated by NA. There is a very high rate of missingness in the dataset - 8237 out of 20041 observations are NA. Is this too much missing data?
Hi I ran into this error as well, and it seems to be caused when the maximum variance column of your data selected by th = X[, which.max(apply(X, 2, var, na.rm = TRUE))] has NA’s at indices that cover all the non-NA values of any other column. Not sure what this means in terms of the validity of the input, but it produces a divide by zero for one element of ph.new, which produces an NA when crossprod(ph.new) is called.
library(mixOmics)
data("liver.toxicity")
X <- liver.toxicity$gene[,1:100]
maxvar_idx = which.max(apply(X, 2, var, na.rm = TRUE))
# 64
na_idx = sample(1:dim(X)[1], 10, replace = F)
X[na_idx, maxvar_idx] <- NA
X[-na_idx, 5] <- NA # choose random column that is not the one with max variance
result = nipals(X, reconst = TRUE, ncomp = 10)
Error in ph.new/drop(sqrt(crossprod(ph.new))) : non-conformable arrays