stanc3 icon indicating copy to clipboard operation
stanc3 copied to clipboard

add syntax for mixtures of distributions

Open bob-carpenter opened this issue 10 years ago • 5 comments

Andrew suggested something to make mixture modeling easier. I'm not sure what he's thinking in terms of syntax, but maybe something like a distribution like this:

y ~ finite_mixture(lambda, 
                   normal(mu1,sigma1), 
                   normal(mu2,sigma2), 
                   normal(mu3,sigma3) );

or a special "function" like

target += finite_mixture(lambda,
                         normal_log(y,mu1,sigma1),
                         normal_log(y,mu2,sigma2),
                         normal_log(y,mu3,sigma3));

Of course, these aren't functions with the usual type of signature.

Another issue is how to deal with vectorization.

bob-carpenter avatar Mar 01 '14 19:03 bob-carpenter

If we did it, we’d want it to be the first form, because my correspondent was saying that the whole “increment_log_prob” thing was freaking people out.

On Mar 1, 2014, at 8:27 PM, Bob Carpenter [email protected] wrote:

Andrew suggested something to make mixture modeling easier. I'm not sure what he's thinking in terms of syntax, but maybe something like a distribution like this:

y ~ finite_mixture(lambda, normal(mu1,sigma1), normal(mu2,sigma2), normal(mu3,sigma3) ); or a special "function" like

increment_log_prob(finite_mixture(lambda, normal_log(y,mu1,sigma1), normal_log(y,mu2,sigma2), normal_log(y,mu3,sigma3))); Of course, these aren't functions with the usual type of signature.

Another issue is how to deal with vectorization.

— Reply to this email directly or view it on GitHub.

andrewgelman avatar Mar 01 '14 20:03 andrewgelman

Hi, just thinking about it more, yes, I think the first form could be perfect. A On Mar 1, 2014, at 8:27 PM, Bob Carpenter [email protected] wrote:

Andrew suggested something to make mixture modeling easier. I'm not sure what he's thinking in terms of syntax, but maybe something like a distribution like this:

y ~ finite_mixture(lambda, normal(mu1,sigma1), normal(mu2,sigma2), normal(mu3,sigma3) ); or a special "function" like

increment_log_prob(finite_mixture(lambda, normal_log(y,mu1,sigma1), normal_log(y,mu2,sigma2), normal_log(y,mu3,sigma3))); Of course, these aren't functions with the usual type of signature.

Another issue is how to deal with vectorization.

— Reply to this email directly or view it on GitHub.

andrewgelman avatar Mar 02 '14 15:03 andrewgelman

Does log_mix address this issue?

VMatthijs avatar Dec 13 '18 13:12 VMatthijs

Not fully. We really want to have syntax for general mixtures, not necessarily as described in this issue. We can brainstorm about possible syntaxes in person, but I think it should wait until the first version of stanc3 is released.

bob-carpenter avatar Dec 13 '18 14:12 bob-carpenter

Hi, yes, any of these make sense to me. My goal is to make the coding more transparent to users, so it's clear that it's a mixture model, then details can be under the hood. I think this will make it much easier for normie users. A

On Feb 25, 2020, at 7:44 AM, Bob Carpenter [email protected] wrote:

Andrew suggested something to make mixture modeling easier. I'm not sure what he's thinking in terms of syntax, but maybe something like a distribution like this:

y ~ finite_mixture(lambda, normal(mu1,sigma1), normal(mu2,sigma2), normal(mu3,sigma3) ); or a special "function" like

target += finite_mixture(lambda, normal_log(y,mu1,sigma1), normal_log(y,mu2,sigma2), normal_log(y,mu3,sigma3)); Of course, these aren't functions with the usual type of signature.

Another issue is how to deal with vectorization.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stan-dev/stanc3/issues/473?email_source=notifications&email_token=AAZYCUNEFM4KTFLP4BBI3H3REUHBDA5CNFSM4K3HY2A2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IQBZ4UA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZYCUJCVQA77DD6OEBFNV3REUHBDANCNFSM4K3HY2AQ.

andrewgelman avatar Feb 25 '20 23:02 andrewgelman