RfastOfficial / Rfast2

A collection of Rfast2 functions for data analysis. Note 1: The vast majority of the functions accept matrices only, not data.frames. Note 2: Do not have matrices or vectors with have missing data (i.e NAs). We do no check about them and C++ internally transforms them into zeros (0), so you may get wrong results. Note 3: In general, make sure you give the correct input, in order to get the correct output. We do no checks and this is one of the many reasons we are fast.
38 stars 4 forks source link

negbin.regs Hang Forever! #10

Open xiekunwhy opened 3 years ago

xiekunwhy commented 3 years ago

Hi,

I found that negbin.regs() in Rfast2 Hang Forever sometimes, it is a nightmare when using negbin.regs() inside a apply or for loop, I think it is a serious bug. And the attached data can be used to reproduce the bug and to reproduce the warnings(warning: solve(): system seems singular; attempting approx solution) in this issue https://github.com/RfastOfficial/Rfast/issues/48 abnormal_y.xls

The script I have used: library(Rfast2) exp <- read.table("abnormal_y.xls", header = T, stringsAsFactors = F) x <- as.matrix(exp$x)

y1 <- exp[,1] t1 <- negbin.regs(y1, x) ## end normally

y2 <- exp[,2] t2 <- negbin.regs(y2, x) ## Hang Forever

sessionInfo() R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale: [1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] Rfast2_0.0.9 Rcpp_1.0.7

loaded via a namespace (and not attached): [1] Rfast_2.0.3 compiler_4.1.0 RcppZiggurat_0.1.6 parallel_4.1.0
[5] tools_4.1.0 RANN_2.6.1

Best, Kun

xiekunwhy commented 3 years ago

Hi Rfast developers,

I found that the problem is in negbin.mle() function, Rfast::negbin.mle(y)$loglik hang forever but Rfast::negbin.mle(y, type = 2) works well. So would you please add an option to negbin.regs() to make it possible to choose type value?

The same problem also take place in when running score.negbinregs()

statlink commented 3 years ago

Can you send me the response variable data with an email to check this? We will add this argument you just mentioned.

Michail

xiekunwhy commented 3 years ago

Hi Michail ,

I can not find your e-mail address, please provide one. I will send you same 10X-RNA-seq data to test multiple ys to single x.

Best, Kun

statlink commented 3 years ago

mtsagris@uoc.gr