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

leuk example uses poisson_log but does not use log rate #114

Open
paciorek opened this issue Jul 20, 2017 · 1 comment
Open

leuk example uses poisson_log but does not use log rate #114

paciorek opened this issue Jul 20, 2017 · 1 comment
Assignees
Labels

Comments

@paciorek
Copy link

It looks like the use of poisson_log is incorrect, because the expression used (see below) is for the Poisson rate not the Poisson log rate.

Y[i, j] * exp(beta * Z[i]) * dL0[j]  # this is Poisson rate, but used as log rate

In non-deprecated Stan code, the revised code would be:

target += poisson_lpmf(dN[i, j] | Y[i, j] * exp(beta * Z[i]) * dL0[j]);

Or perhaps a sampling statement is cleaner:

dN[i, j] ~ poisson(Y[i, j] * exp(beta * Z[i]) * dL0[j]);
@bob-carpenter
Copy link
Contributor

Thanks much for reporting. We really need to bring all of our old programs up to current standards.

I'd be inclined to use a vectorized sampling statement to make it

dN[i] ~ poisson_log(log_Y[i] + beta * Z[i] + log_dL0);

assuming all the other types are compatible. That assumes log(Y) is defined as log_Y and same for dL0.

@bob-carpenter bob-carpenter self-assigned this Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants