Conditional operator issues

I’m using the conditional operator as an indicator function in the model block:

X.*( Y > operator*(W ,col(R ,1) ) ? 1 : 0 ).*Z

In the above, X, Y, Z are all some column vectors with the same length, R is some matrix. I want the condition to return 1 if the condition Y > operator*(W ,col(R ,1) is true and 0 otherwise.

However, an error message points to the question mark ? and reminds:

Error in stanc(file = file, model_code = model_code, model_name = model_name, :
failed to parse Stan model ‘4301009676b6513298bd4284a108fe8c’ due to the above error.

I am unsure whether this error is related to the usage of conditional operator? Thanks.

I guess I figured it out. The condition I applied here is a vector, which might be illegal.

1 Like