# Indicator function

Does anyone know how to include an indicator function in a dynare code?
Giovanni

Dear Giovanni,

can you specify more in detail what you mean by the indicator function? Can you explain your what is your idea why you want to include an indicator function in your model?

Regards,
Pavel

Hi Giovanni,

There is indeed an equal operator which evaluates to 1 if the equality is satisfied, or 0 otherwise.

For example, you can put this in your model:

``x = delta*(y == 3);``

x=delta when y=3, and x=0 otherwise.

Similarly, you have other comparison operators: != < > <= >=

However note that the use of this only make sense in a deterministic setup where we fully handle the non-linearities.

In a stochastic setup, we make a local approximation around the steady state. So if the steady state doesn’t satisfy the equality, the equality will always be unsatisfied in the neighborhood of the steady state, so Dynare will act as if the equality is always unsatisfied. And if the steady state satisfies the equality, then you can’t make a local approximation, because you have a singularity at the steady state.

Best,

Dear Sebastien,

Thank you for your answer. It’ll be very helpful to me. I’m not sure whether in my case I am going to have the problems you have mentioned. However, it is indeed worth trying. I’ll let you know.

Best

Giovanni

Dear Giovani,

if you send me your code or at least explain how you use the indicator function, I will try to find out if it can cause some problems.

Pavel