Dear all,
I would apprecaite it, if someone could answer these quick questions.

When you define your ODE function:
vector ode(real time, vector state, …)
what is the role of “time”? It doesn’t apprear in the definition. Why do you need it?

int is not allowed in “transformed parameters”; what to do if you want to have a counter there? By “counter” I mean something like: int k = 0; k += 1;

Is there any built-in counter in Stan on interation number? For example:
if(ITER == 10) print (XX); to print XX only at the 10th HMC iteration

The initial values of parameters are chosen from [-2, 2]. Isn’t it often better to start from prior distributions?

Sometimes I see people set a constraint on data. What does that mean?

You cannot declare integers as parameters, nor as transformed parameters. Here are some options:

Find a way to do the necessary computation without declaring integers. For example, maybe you can use a for loop to achieve what you want.

Compute the quantities you need as local variables in the model block rather than in the transformed parameters block.

Write a function (in the functions block) that does the computation you need, declaring the relevant integer variables inside the function. Then call this function in the transformed parameters block.

No

Perhaps, but it is not in general possible to easily generate random number from the prior in a Stan program. For problems where you understand the prior structure and see that RNG generation is tractable, you can do this yourself (e.g. in R or python) and pass the inits explicitly.

It means that if they at any point pass this model data that don’t meet the constraint, it will alert them to the issue.