stephenslab / mashr

An R package for multivariate adaptive shrinkage.
https://stephenslab.github.io/mashr
Other
88 stars 19 forks source link

Separate fitting the hierarchical model and computing posteriors in `mash` call #20

Closed gaow closed 6 years ago

gaow commented 6 years ago

Currently mashr::mash computes weights and posterior quantities in one function call. It makes it difficult when I only want to use a subset of "random null" data to "train" the mash model, but apply the model to another subset of data, or even to all the data.

Should we propose a new interface for this goal? Or should we permanently replace mashr::mash with a two-step procedure?

stephens999 commented 6 years ago

you can use the estimates from a previous fit (m) on new data by mash(newdata, g=get_fitted_g(m), fixg=TRUE)

stephens999 commented 6 years ago

or something like that... we should add an example!

gaow commented 6 years ago

I see, good pointer. But should we implement an option to skip computing posterior if for a first round I only need the weights? You see my training set is a "random" set that does not necessarily have those top eQTLs that I might ultimately care about, nor does it contain everything to render a complete result. Therefore the posteriors computed here are a bit wasteful.

stephens999 commented 6 years ago

maybe using outputlevel ?

On Mon, Oct 2, 2017 at 1:09 PM, gaow notifications@github.com wrote:

I see, good pointer. But should we implement an option to skip computing posterior if for a first round I only need the weights?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stephenslab/mashr/issues/20#issuecomment-333617332, or mute the thread https://github.com/notifications/unsubscribe-auth/ABt4xXXozIaCK_bTGeAu0k3yX953Gae2ks5soSblgaJpZM4PrBBU .

gaow commented 6 years ago

maybe using outputlevel ?

Ok ... so you suggest we use outputlevel = 0 to trigger computation for loglik / weights, outputlevel = 1 for complete results including posterior, and outpputlevel = 99 for everything including debug quantities? I can change the code if we have an agreement here.

Also the parameter fixg looks a bit redundant to me -- I did not look into every appearance of g, but what's the harm of we remove fixg and use missing(g$pi) to decide whether or not we fit the mixture model?

gaow commented 6 years ago

Ok I can see the appeal to have fixg as a separate option. Anyways I've implemented the outputlevel as proposed in the previous thread, with default set to 1. With that I was able to complete the analysis. I'm going to push it anyways and leave the ticket open for additional comments.

gaow commented 6 years ago

Example usage see here.