no print for syntax error in RStan?

44 views
Skip to first unread message

Bob Carpenter

unread,
Apr 1, 2016, 4:57:22 PM4/1/16
to Stan users mailing list
I ran into an unexpected behavior in RStan when I tried to
fit a model:

> fit <- stan("exon-diff-hier.stan", data=c("I", "J", "K", "N", "y"),
+ chains=1, iter=100, refresh = 1);
>

So I ran stan() and got no output whatsoever.

Then I quit R, restarted, ran the same script, and got this at the
same stage:

> fit <- stan("exon-diff-hier.stan", data=c("I", "J", "K", "N", "y"),
+ chains=1, iter=100, refresh = 1);
SYNTAX ERROR, MESSAGE(S) FROM PARSER:


ERROR at line 35

33: parameters {
34: matrix[I, J] logit_mu; // exon expression level in group
35: matirx<lower=0>[I, J] sigma; // replicate variability
^
36: real logit_psi_raw[I, J, K]; // exon inclusion level (non-centered)

PARSER EXPECTED: <one of the following:
a variable declaration, beginning with type,
(int, real, vector, row_vector, matrix, unit_vector,
simplex, ordered, positive_ordered,
corr_matrix, cov_matrix,
cholesky_corr, cholesky_cov
or '}' to close variable declarations>
Error in stanc(file = file, model_code = model_code, model_name = model_name, :
failed to parse Stan model 'exon-diff-hier' due to the above error.


I believe I followed the directions to run in parallel (which does happen)
and to not recompile (which does not happen---it recompiles the model each time).

- Bob

P.S.

> sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] rstan_2.9.0 ggplot2_2.0.0

loaded via a namespace (and not attached):
[1] colorspace_1.2-4 grid_3.1.3 gridExtra_2.0.0 gtable_0.1.2
[5] inline_0.3.13 munsell_0.4.2 plyr_1.8.1 Rcpp_0.11.3
[9] scales_0.3.0 stats4_3.1.3

- Bob

Ben Goodrich

unread,
Apr 1, 2016, 5:32:55 PM4/1/16
to Stan users mailing list
On Friday, April 1, 2016 at 4:57:22 PM UTC-4, Bob Carpenter wrote:
I believe I followed the directions to run in parallel (which does happen)
and to not recompile (which does not happen---it recompiles the model each time).

It parses in the main thread, so I don't know why you would have not gotten an output the first time. The conditions under which it recompiles were relaxed at some point, so you might upgrade to the latest RStan.

Ben

Reply all
Reply to author
Forward
0 new messages