yoshidk6 / rstanemax

Simple Emax model fit with Stan
https://yoshidk6.github.io/rstanemax/
GNU General Public License v3.0
5 stars 1 forks source link

Extending the `rstanemax` package for binary outcomes #46

Open kirangauthier opened 1 year ago

kirangauthier commented 1 year ago

Hi Kenta,

I repurposed your Stan model to include parameter estimation when the response outcome is binary and was wondering if you would like to add it to the package. If so I can fork your main branch and push the changes, but didn't want to create too much overhead for creating binary=TRUE/FALSE flags for your functions if that's the way you wanted the user to access it.

Maybe we can have a short function that tests if the data is 0/1 and then use either the regular exposure-response or the binary exposure-response instead.

Best, Kiran

yoshidk6 commented 1 year ago

Thanks Kiran for the comment and glad to hear you were able to re-purpose it!

I like the idea of extending it to the binary outcome. However I suspect there might be a quite significant work needed to make it seamlessly work with the existing functionality (which you might have done already) + documentation, and I'm afraid I won't be able to spend significant efforts at this moment. If you are interested in pursuing further, my recommendation is to create a separate function (e.g. stan_emax_binary()?) a Stan model, and an S3 class dedicated to binary endpoint modeling.

kirangauthier commented 1 year ago

Hi Kenta,

Sure! This will be my first time pushing to an existing repo so I'll take my time to make sure everything is set up properly. I really appreciate the package and am grateful to be able to contribute.

As a slight change between your implementation and mine, I changed the priors on EC50 and gamma to be lognormally distributed as they are strictly positive and led to less divergences in the HMC, do you want me to use your previous normal priors for the sake of consistency?

yoshidk6 commented 1 year ago

Thanks a lot Kiran that would be very much appreciated!

Also thanks for your suggestion, interesting you saw divergence with normal distribution. At least in the Stan model was set and I don't remember seeing much problems, maybe it became instable by handling binary endpoints. I probably like to keep the existing function as it is (or add an option to specify lognormal dist while keeping the normal as the default somehow), but I'm fine with having lognormal as the default for binary outcome modeling function as long as the documentation is clear.