Multilevel decomposition for DIABLO and symmetry observed with 2 repeated measures

Hello mixOmics team,

I’ve been trying to perform a DIABLO analysis to discriminate samples across several data sets based on their outcome category.

My data has repeated measures of individuals, and thus I tried to code a script to implement multilevel decomposition before running the final diablo model.

However, when I run the script and plot my results with plotDiablo, plotIndiv, plotArrow, and others plot, I clearly see that my plotted data has a symmetry that suggests to me that some kind of unwanted artifact is messing with the data. If I don’t run the multilevel decomposition, such artifacts are not present.

I have been using the “DIABLO TCGA case study” and the “Case study 2: Allergic Asthma” as my reference to apply DIABLO and the multilevel decomposition, but there must be something I’m missing.

I attached the arrow plot here, and I would share my R script, but I can’t do it here.

. Can anybody explain to me what is generating my issue and how to solve it?

(Privately and confidentially, I could also share my datasets if that could help solve the issue)

hi @Frasco

Apologies for the delayed answer. (on the plus side, we finally explain why we observe symmetry in the multilevel decomposition with 2 data points).

  1. Extracting Xw directly in mixOmics

You do not need to code the multilevel decomposition yourself. The withinVariation() function returns the within-subject matrix Xw directly, which you can then pass to block.plsda() / block.splsda():

Xw.block1 = withinVariation(X = block1, design = data.frame(sample = subject.id))
Xw.block2 = withinVariation(X = block2, design = data.frame(sample = subject.id))

X = list(block1 = Xw.block1, block2 = Xw.block2)
res = block.splsda(X, Y, ncomp = ..., keepX = ..., design = ...)

Note that block.plsda() / block.splsda() do not accept a multilevel argument (unlike pca, pls, plsda, splsda), so using the withinVariation() function per block then input into the function.

  1. The symmetry with multilevel

This is a geometric consequence of the multilevel decomposition when there are exactly two repeated measurements per subject.

If subject s contributes samples x1 and x2, the subject mean is xbar = (x1 + x2) / 2, and the two rows of Xw for that subject are:

x1 - xbar =  (x1 - x2) / 2
x2 - xbar = -(x1 - x2) / 2

The two residual profiles are exact negatives of each other, variable by variable. Any linear projection of Xw (multilevel PCA, PLS-DA, DIABLO) therefore places the two samples of each subject as a perfect mirror pair through the origin. This disappears as soon as three or more repeats per subject are available.

Worth checking: multilevel is only appropriate when the outcome you want to discriminate varies within subject (e.g. pre vs post treatment). If the outcome is fixed at the subject level, the multilevel decomposition will remove the class signal.

Related posts:

Kim-Anh