stephens999 / ashr

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

implement plot method for classes normalmix, unimix, etc? #119

Closed willwerscheid closed 4 years ago

willwerscheid commented 4 years ago

It'd be nice to be able to plot the CDF of a mixture distribution by calling "plot" on the mixture object (i.e., plot(g)).

stephens999 commented 4 years ago

Does cdf.ash help? Or you know about that already?

On Mon, Apr 27, 2020, 18:34 Jason Willwerscheid notifications@github.com wrote:

It'd be nice to be able to plot the CDF of a mixture distribution by calling "plot" on the mixture object (i.e., plot(g)).

— 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/119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANXRRIA2OUAKQ3XLV442ZDROYJBZANCNFSM4MSLCP6Q .

willwerscheid commented 4 years ago

I was thinking methods for the unimix and normalmix classes since we use them in other packages (ebnm, flashr, etc).

willwerscheid commented 4 years ago

I guess we have mixcdf for those classes. Are you opposed to implementing plot on top of that?

willwerscheid commented 4 years ago

Looks like comp_cdf still needs to be implemented for unimix

stephens999 commented 4 years ago

it's there: comp_cdf.unimix = function(m,y,lower.tail=TRUE){ vapply(y,stats::punif,m$a,min=m$a,max=m$b,lower.tail) }

willwerscheid commented 4 years ago

Oh you're right. Not sure how I missed that. I guess you can do a one-line thing like curve(mixcdf(g, x), from = from, to = to), so no need for a plot method. I will close this issue.