mixOmics icon indicating copy to clipboard operation
mixOmics copied to clipboard

Add background.predict support for mint.splsda

Open aljabadi opened this issue 5 years ago • 1 comments

Hi,

trying to perform this:

data(stemcells)
res = mint.splsda(X = stemcells$gene, Y = stemcells$celltype, ncomp = 3,
                  study = stemcells$study)


background = background.predict(res, comp.predicted = 2, dist = "max.dist")

plotIndiv(res, background = background, legend = TRUE, alpha.background = 0.3 )

I get the following error:

Error in matrix(attr(Y, "scaled:center"), nrow = nrow(t.pred[[1]]), ncol = q, : 'data' must be of a vector type, was 'NULL'

I tried to debug it and found out that the mean_centering_per_study function expects "scaled:center" and "scaled"scale" attributes in res$ind.mat which in MINT case have different names and are on a per-study basis: mean:[study-index] and sigma:[study-index]. I was thinking maybe defining a pre-study max.dist and take the max of those for membership would be a good idea but I wasn't sure and the code is a bit hard to follow without comments. Would appreciate if you could add it to the mixOmics.

aljabadi avatar May 30 '19 01:05 aljabadi

I find the same error in 6.14.0 when using the result of plsda(...) as input if dist = 'max.dist', but not when considering centroids.dist or mahalanobis.dist.

Benfeitas avatar Nov 23 '20 19:11 Benfeitas