Suggested Constraints syntax

Hi, might be interesting - I asked https://chat.openai.com how to put constraints on parameters in Stan and it came up with this syntax:

parameters{
vector[3] alpha;
}

constraints{
alpha[1] + alpha[2] + alpha[3] = 0
}

and various versions of that, like sum(alpha) = 0.

At first I thought that the syntax was real, and that I’d missed it somehow.

2 Likes

I’d give it partial credit.

2 Likes

We can’t even do what BUGS does, which is move operators from the LHS to RHS with inverse, e.g.,

logit(x) = y

which would assign x = inv_logit(y) and similarly for other invertible functions. I always found those hard to read in BUGS and didn’t want to muddy conventional assignment syntax.