Aki Vehtari
unread,Mar 20, 2015, 4:11:10 PM3/20/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to stan...@googlegroups.com
I'm already used to this error message, but as I'm now teaching Stan for students, I hope this error message could be improved (a suggestion in the end)
Here's code for Bioassay example written by a student
---
data {
int<lower=0> N;
vector[N] x;
vector[N] y;
int<lower=0> n[N];
}
parameters {
real alpha;
real beta;
}
transformed parameters {
vector[N] mu;
mu <- alpha + beta*x;
}
model {
y ~ binomial_logit(n, mu);
}
---
and compilation gives an error, because y has not been declared as int. But the error message is bit confusing:
---
compile: SYNTAX ERROR, MESSAGE(S) FROM PARSER:
compile: no matches for function name="binomial_logit_log"
compile: arg 0 type=vector
compile: arg 1 type=int[1]
compile: arg 2 type=vector
compile: available function signatures for binomial_logit_log:
compile: 0. binomial_logit_log(int, int, real) : real
compile: 1. binomial_logit_log(int, int, real[1]) : real
compile: 2. binomial_logit_log(int, int, vector) : real
compile: 3. binomial_logit_log(int, int, row vector) : real
compile: 4. binomial_logit_log(int, int[1], real) : real
compile: 5. binomial_logit_log(int, int[1], real[1]) : real
compile: 6. binomial_logit_log(int, int[1], vector) : real
compile: 7. binomial_logit_log(int, int[1], row vector) : real
compile: 8. binomial_logit_log(int[1], int, real) : real
compile: 9. binomial_logit_log(int[1], int, real[1]) : real
compile: 10. binomial_logit_log(int[1], int, vector) : real
compile: 11. binomial_logit_log(int[1], int, row vector) : real
compile: 12. binomial_logit_log(int[1], int[1], real) : real
compile: 13. binomial_logit_log(int[1], int[1], real[1]) : real
compile: 14. binomial_logit_log(int[1], int[1], vector) : real
compile: 15. binomial_logit_log(int[1], int[1], row vector) : real
compile: unknown distribution=binomial_logit
compile: ERROR at line 16
compile: 14: }
compile: 15: model {
compile: 16: y ~ binomial_logit(n, mu);
compile: ^
compile: 17: }
compile: Execute "stanc --help" for more information
---
1) in the second line it mentions
"no matches for function name="binomial_logit_log""
although the code does not have binomial_logit_log (I know why _log, but students don't)
2) if students continue reading past 15 lines of function signatures for
binomial_logit_log, there's a line
"unknown distribution=binomial_logit"
and now students think there's error in the distribution name.
Below is my suggestion for an improved error message
---
compile: SYNTAX ERROR, MESSAGE(S) FROM PARSER:
compile: ERROR at line 16
compile: 14: }
compile: 15: model {
compile: 16: y ~ binomial_logit(n, mu);
compile: ^
compile: 17: }
compile: argument type mismatch for distribution=binomial_logit
compile: arg 0 type=vector
compile: arg 1 type=int[1]
compile: arg 2 type=vector
compile: log-density for distribution=binomial_logit is binomial_logit_log
compile: available function signatures for binomial_logit_log:
compile: 0. binomial_logit_log(int, int, real) : real
compile: 1. binomial_logit_log(int, int, real[1]) : real
compile: 2. binomial_logit_log(int, int, vector) : real
compile: 3. binomial_logit_log(int, int, row vector) : real
compile: 4. binomial_logit_log(int, int[1], real) : real
compile: 5. binomial_logit_log(int, int[1], real[1]) : real
compile: 6. binomial_logit_log(int, int[1], vector) : real
compile: 7. binomial_logit_log(int, int[1], row vector) : real
compile: 8. binomial_logit_log(int[1], int, real) : real
compile: 9. binomial_logit_log(int[1], int, real[1]) : real
compile: 10. binomial_logit_log(int[1], int, vector) : real
compile: 11. binomial_logit_log(int[1], int, row vector) : real
compile: 12. binomial_logit_log(int[1], int[1], real) : real
compile: 13. binomial_logit_log(int[1], int[1], real[1]) : real
compile: 14. binomial_logit_log(int[1], int[1], vector) : real
compile: 15. binomial_logit_log(int[1], int[1], row vector) : real
compile: Execute "stanc --help" for more information
---
Aki