stephenslab / ebnm

R package to fit Empirical Bayes Normal Means model.
https://stephenslab.github.io/ebnm/
12 stars 9 forks source link

Recent update breaks flashr::flash call #46

Closed gaow closed 3 years ago

gaow commented 3 years ago

Using version 0.1.32, and the flash documentation example

library(flashr)
set.seed(1) # for reproducibility
ftrue = matrix(rnorm(200), ncol=2)
ltrue = matrix(rnorm(40), ncol=2)
ltrue[1:10, 1] = 0 # set up some sparsity
ltrue[11:20, 2] = 0
Y = ltrue %*% t(ftrue) + rnorm(2000) # set up a simulated matrix
f = flash(Y)

I get:

Error in (function (f, p, ..., hessian = FALSE, typsize = rep(1, length(p)),  : 
  missing value in parameter

Earlier version, 0.1.24 for example, works fine for the flash call.

pcarbo commented 3 years ago

@gaow @willwerscheid I'm not sure what the solution is here, but the issue is that you are calling ebnm_pn with ebnm_param$g$pi = c(1,0), which doesn't make much sense. If I set ebnm_param$g$pi = c(0.9999,0.0001) instead it works fine.

For the record, the error occurs in this line in function flashr::calc_update_vals:

a = do.call(ebnm_fn, list(ebnm_args$x, ebnm_args$s, ebnm_param))
willwerscheid commented 3 years ago

Hi @gaow , your code now works with the latest versions of flashr and ebnm. I will close this issue but can you please confirm? Thanks!

gaow commented 3 years ago

@willwerscheid I confirm it works for my case. Thanks!