stephenslab / mashr

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

added nullweight parameter into mash function #105

Closed eweine closed 2 years ago

pcarbo commented 2 years ago

@eweine I'm adding your comments here:

I was recently experimenting with the "nullbiased" prior option in the mash function. I noticed that in many cases, setting prior = "nullbiased" did not substantially change the resulting estimates of the mixture components pi. I looked through the ashr package, and I noticed that in the ash function there is a parameter for the nullweight. I've created a https://github.com/stephenslab/mashr/pull/105 to add this same parameter to the mash function that should be completely backwards compatible. Setting this parameter to a large number in the mash function seems to substantially increase the weight on the null effects matrix.

Perhaps it would not be a good idea to merge this, especially if you'd like to discourage users from increasing the nullweight. If that is the case, could you explain why you selected a value of 10 for the nullweight for the "nullbiased" prior? I noticed that this value is hardcoded in the set_prior function in the mash.R file.

pcarbo commented 2 years ago

@eweine Thanks for this contribution. Could you please provide a small example illustrating the use of the new nullweight option?

pcarbo commented 2 years ago

@eweine Also can you please make the following change:

-set_prior = function(K,prior,nullweight){
+set_prior = function(K,prior,nullweight = 10){

This is needed for backward compatibility because some calls to set_prior in the code don't specify nullweight.

eweine commented 2 years ago

Hey Peter,

Thanks for the comments! I've added the default argument as well as an example.

Let me know if I can do anything else,

Eric.

pcarbo commented 2 years ago

Thanks @eweine. This all looks great. However I'm wondering if you could cook up a small example where setting nullweight is actually doing something useful? (After all you seemed to have a good reason for making this change!) The example you wrote gave me the same result as the example using the default nullweight setting (or maybe I ran it incorrectly?).

eweine commented 2 years ago

Hey Peter,

Sorry about that. I just added an example where changing the parameter makes a substantial difference.

Best,

Eric.

pcarbo commented 2 years ago

Thanks!