When defining var(log) K; an auxiliary variable LOG_K is created. But we cannot access it in many commands. For example, rplot LOG_K or stoch_simul LOG_K will result in
ERROR: stoch_simul: Variable LOG_K was not declared.
Designs
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Note that this is not specific to var(log) auxiliary variables; this behaviour is displayed with all auxiliary variables.
Technically, auxiliary variables are not yet created at the point when the preprocessor makes most syntactical checks. Substantial refactoring would thus have to be done in the preprocessor to achieve the behaviour requested in this ticket.
Also note that currently don’t guarantee that auxiliary variable names follow a specific pattern. For implementing this ticked, we would have to commit to auxvar name stability.
A simple workaround is to create the log(x) variable by hand. This does not preclude the user from declaring var(log) x. The auxvar and the manually created log(x) var would be identical, but that’s not a problem (except for performance, if you do not use block decomposition).
I envision something similar to what we allow for Ramsey in dynare#1355 (closed). Is that infeasible?
The manual in this case documents the naming pattern, so we should commit to it. It's natural and predictable.
Of course, I can manually define an auxiliary, but then what's the point of the option? It will even prevent me from using the name LOG_y and may create confusion as it is case-sensitive and allows log_y
I did not remember that we had implemented this in another context. It’s a horrible hack, I’m surprised I let it in, but indeed we could extend it to variables in log.
The main point of the option is that it does the substitution x → exp(LOG_X) everywhere in the model.
Then we should extend it. At least for stochastic simulations there is no point in an automatic substitution if the results are not accessible to users.