Parser error...help!

18 views
Skip to first unread message

kris2...@gmail.com

unread,
Jul 22, 2013, 12:50:31 PM7/22/13
to stan-...@googlegroups.com

OK, I think I've done something stupid and just can't see it. Here is my transformed parameters block:

transformed parameters {
  cov_matrix[2] SIG;
  vector[2] mu[J]; 
  vector[J] alpha;
  vector[J] beta;
  SIG[1,1] <- pow(sig.a,2);
  SIG[1,2] <- rho*sig.a*sig.b;
  SIG[2,1] <- rho*sig.a*sig.b;
  SIG[2,2] <- pow(sig.b,2);
 
  for (j in 1:J) {
    mu[j][1] <- delta_0 + delta_1*LC[j];
    mu[j][2] <- gamma_0 + gamma_1*LC[j];
    alpha[j] <- alpha_beta[j][1];
    beta[j]  <- alpha_beta[j][2];
  }

}

For some reason I'm getting this error from the parser

Error in stanc(file = file, model_code = model_code, model_name = model_name,  : 
  failed to parse Stan model 'model01' with error message:
EXPECTATION FAILURE LOCATION: file=input; line=32, column=5

    mu[j][1] <- delta_0 + delta_1*LC[j];
    ^-- here


DIAGNOSTIC(S) FROM PARSER:
Parser expecting: "}"

I can't see why I would need a curly brace where it's indicating. Any thoughts?


Jiqiang Guo

unread,
Jul 22, 2013, 1:47:38 PM7/22/13
to stan-...@googlegroups.com
Seemingly, we need to use mu[j, 1] instead of mu[j][1].

--
Jiqiang 




--
You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bob Carpenter

unread,
Jul 22, 2013, 2:22:22 PM7/22/13
to stan-...@googlegroups.com
Thanks for reporting.

That's a bug. I'll file an issue.

The problem is that the way it's implemented,
mu[j] returns an Eigen::Block. I need to implement
the getter for blocks that returns an LHS reference.

- Bob

On 7/22/13 1:47 PM, Jiqiang Guo wrote:
> Seemingly, we need to use mu[j, 1] instead of mu[j][1].
>
> --
> Jiqiang
>
> stan-users+...@googlegroups.com <mailto:stan-users%2Bunsu...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages