drisso/zinbwave

W2=0 when calculating two latent variables

vincr04 opened this issue ยท 3 comments

Hi,
I have some 10X single-cell data and am using zinbwave to infer latent variables. I realised that when using K=2 in zinbFit, W1 values are between ~-0.2 and ~0.2, but W2 values are all 0.
My code:
design <- model.matrix(~se$sex1*se$stim)
zinb <- zinbFit(Y=se, X=design, epsilon=1e6, K=2, verbose=T, BPPARAM=MulticoreParam(8))
se_zinb <- zinbwave(Y=se, X=design, epsilon=1e6, fitted_model=zinb, K=2, verbose=T, observationalWeights=T)
head(reducedDim(se_zinb))
Screenshot 2020-07-15 at 17 46 38

You can download the data here: https://github.com/vincr04/variousdata/blob/master/se.Robj

Somehow if I choose K=3 the problem doesn't occur...
zinb <- zinbFit(Y=se, X=design, epsilon=1e6, K=3, verbose=T, BPPARAM=MulticoreParam(8))
se_zinb <- zinbwave(Y=se, X=design, epsilon=1e6, fitted_model=zinb, K=3, verbose=T, observationalWeights=T)
head(reducedDim(se_zinb))
Screenshot 2020-07-15 at 17 47 50

Is this a bug, or did I do something wrong?

Thanks, this definitely looks like a bug, I will have a look at the data and update you here.

I can confirm that I'm able to reproduce your example. This is quite puzzling, but I'm looking into it.

I found the bug. This was due to softImpute sometimes returning a singular value of 0. I've fixed it in version 1.11.6.