Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to access the distributional objects inside a mixture distribution #113

Open
statasaurus opened this issue Jun 4, 2024 · 1 comment

Comments

@statasaurus
Copy link
Contributor

It would be very helpful to have a function would return a list of distributional objects that make up a mixture distribution so that conjugacy can be used to calculate posteriors where possible. In Pharma we often use a mixture of normals to approximate other distributions for simulation work.


I have tried working around it like this:

x <- dist_mixture(dist_normal(), dist_normal(sigma = 10), weights = c(0.5, 0.5))
y <- parameters(x)$dist[[1]]
dist_mixture(!!!y, weights = parameters(x)$w[[1]])

But, the problem is the list isn't a list of distributional objects, so when you try to reconstitute it into a mixture distribution it doesn't work.

Sorry for so many issues. We are working on a bayesian dynamic borrowing package and your package is nearly perfect, we just need a few modifications

@statasaurus
Copy link
Contributor Author

If I wrote this function would it be something you want to include in your package? If not I am happy to close the issue and I will work on this elsewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant