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

How to write truncated distribution in flist? #451

Open
ctfysh opened this issue Dec 19, 2024 · 2 comments
Open

How to write truncated distribution in flist? #451

ctfysh opened this issue Dec 19, 2024 · 2 comments

Comments

@ctfysh
Copy link

ctfysh commented Dec 19, 2024

In Stan code, there are truncated distributions, like

y ~ normal(0, 1) T[-0.5, 2.1];

So how can this be put in the flist for ulam?

@rmcelreath
Copy link
Owner

This can be done with custom(), but it's not really a supported feature.

@ctfysh
Copy link
Author

ctfysh commented Dec 22, 2024

I have tried to do this with custom(), it is useful for vectors (like observations), but not for scalars, like the following sample in Stan reference manual.

y ~ normal(0, 1);
if (y < -0.5 || y > 2.1) {
  target += negative_infinity();
} else {
  target += -log_diff_exp(normal_lcdf(2.1 | 0, 1),
                          normal_lcdf(-0.5 | 0, 1));
}

I don't know if I miss someting, or it's not supported. Thanks!

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

2 participants