Bayesian Estimation Kirmann Model

I suspect it’s this part that’s giving you an error.

while (k<x){
k=k+1;
}
k=k-1;
if (x-k>0.5){
k=k+1;

At least when I run your model I get:

DIAGNOSTIC(S) FROM PARSER:
Info: left-hand side variable (name=k) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.
Info: left-hand side variable (name=k) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.
Info: left-hand side variable (name=k) occurs on right-hand side of assignment, causing inefficient deep copy to avoid aliasing.

See the deep copy warning here