bioFAM / MOFA2

Multi-Omics Factor Analysis
https://biofam.github.io/MOFA2/
GNU Lesser General Public License v3.0
300 stars 52 forks source link

Get noise terms with MOFA2 R package #145

Open BangzhuoTongUU opened 8 months ago

BangzhuoTongUU commented 8 months ago

Hello, thanks for having this super cool tool!

I have a stupid question regarding the relationship among Matrix, W and Z matrix when I use MOFA2 R package on my data: Say I have three input matrices, namely M1, M2, M3, and I run MOFA2 with factor number = 26. I wanted to see if the dot product of M1 and W matrices equals to Z (if I did not understand it wrongly from the paper).

So I retrieved my the Z, W1 (W for M1) matrices from the model with model@expectations$Z$group1 and get_weights(model, views = "M1", factors = "all")$M1 . The dimension of Z and W1 are 270 * 26and 211 * 26 respectively, and the dimension of my M1 is 270 * 211 . I expect the dot product from Z and t(W1) to be identical with M1. But it turned out to be not identical.

And I am aware that there are noise terms for each of my input matrix as well, was it because of the noise term that made my results not identical? Could I get the noise term with any command from MOFA2 R package? Thanks in advance!

Best,

Ben