if condition in model block
Posted: Tue Aug 18, 2015 1:23 pm
Hello,
I wonder if it is possible to define a Macro-variable to equal to a parameter. Something like
parameters sig_c;
sig_c=1;
@#define sig_c_par=sig_c
I am trying to estimate a model using Dynare. My model has a CRRA utility function, so the model equation of the utility function will be
U= c^(1-sig_c) / (1-sig_c) or U= log(c), depending on the intertemporal elasticity of substitution sig_c. I want to bayesian estimate sig_c, and I wonder how to tell dynare to use the equation U=log(c) when sig_c=1. I have tried the following code, but got the error msg ' ERROR in macro-processor ... Unknown variable: sig_c'.
parameters sig_c;
sig_c=1;
@#define sig_c_par=sig_c
...
model;
@#if sig_c_par==1
U=log(c);
@#else
U= c^(1-sig_c) / (1-sig_c);
@#endif
...
end;
Does anyone have a suggestion how to solve the problem? Any help will be much appreciated!
I wonder if it is possible to define a Macro-variable to equal to a parameter. Something like
parameters sig_c;
sig_c=1;
@#define sig_c_par=sig_c
I am trying to estimate a model using Dynare. My model has a CRRA utility function, so the model equation of the utility function will be
U= c^(1-sig_c) / (1-sig_c) or U= log(c), depending on the intertemporal elasticity of substitution sig_c. I want to bayesian estimate sig_c, and I wonder how to tell dynare to use the equation U=log(c) when sig_c=1. I have tried the following code, but got the error msg ' ERROR in macro-processor ... Unknown variable: sig_c'.
parameters sig_c;
sig_c=1;
@#define sig_c_par=sig_c
...
model;
@#if sig_c_par==1
U=log(c);
@#else
U= c^(1-sig_c) / (1-sig_c);
@#endif
...
end;
Does anyone have a suggestion how to solve the problem? Any help will be much appreciated!