stephens999 / ashr

An R package for adaptive shrinkage
GNU General Public License v3.0
80 stars 36 forks source link

ash produces (small) negative LFSRs and svalues in a simple example #117

Closed pcarbo closed 4 years ago

pcarbo commented 4 years ago

Here is the example (data is attached):

library(ashr)
load("ashr_bug.RData")
out <- ash(b,s)
min(out$result$lfsr)   # Should output -2.2e-16.
min(out$result$svalue) # Should output -2.2e-16.

Any thoughts about how to fix this?

Here is my sessionInfo:

R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3
Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
other attached packages:
[1] ashr_2.2-49
loaded via a namespace (and not attached):
 [1] compiler_3.6.2    Matrix_1.2-18     mixsqp_0.3-31     Rcpp_1.0.3
 [5] SQUAREM_2017.10-1 grid_3.6.2        truncnorm_1.0-8   irlba_2.3.3
 [9] invgamma_1.1      lattice_0.20-38

ashr_bug.RData.gz

stephens999 commented 4 years ago

i just pushed a fix

On Wed, Apr 8, 2020 at 7:10 AM Peter Carbonetto notifications@github.com wrote:

Here is the example (data is attached):

library(ashr) load("ashr_bug.RData")out <- ash(b,s) min(out$result$lfsr) # Should output -2.2e-16. min(out$result$svalue) # Should output -2.2e-16.

Any thoughts about how to fix this?

Here is my sessionInfo:

R version 3.6.2 (2019-12-12) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Catalina 10.15.3 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ashr_2.2-49 loaded via a namespace (and not attached): [1] compiler_3.6.2 Matrix_1.2-18 mixsqp_0.3-31 Rcpp_1.0.3 [5] SQUAREM_2017.10-1 grid_3.6.2 truncnorm_1.0-8 irlba_2.3.3 [9] invgamma_1.1 lattice_0.20-38

ashr_bug.RData.gz https://github.com/stephens999/ashr/files/4450325/ashr_bug.RData.gz

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stephens999/ashr/issues/117, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANXRRIEDCEDEF66B2B6XXTRLRST7ANCNFSM4MD4E6DQ .

pcarbo commented 4 years ago

Okay, that works. It could be useful in some cases to (accurately) compute very small LFSRs (e.g. < 1e-16) if you want to compare with very small p-values, for example. I'm not sure the existing implementation allows for that. I'm going to create a separate issue as a reminder to revisit this --- if someone has time and is motivated.