# Weird Error when using an Indicator Function

Dear all,

I’ve got a weird error, when I’m doing the following thing:

1. I want to have a model, in which the shock values are only smaller than one. The shock follows an AR(1) process. Say, A is the shock variable.
2. So I use an approximation of the indicator function to achieve this: if the shock value (eps_A) (eps_A is declared with varexo in the dynare code) is larger than one, set the shock value to one, otherwise use the actual shock value:

A = exp(eps_A)(1-1/(1+exp(-500000(exp(eps_A)-1)))) + 1/(1+exp(-500000*(exp(eps_A)-1)));

1. If I do that with random variables, I got a wonderful data set, where the upper bound of the time series is 1.
2. But if I do it with dynare, dynare gives me allways A’s bigger than 1.

Why is dynare doing that???

With best wishes,
Daniel

Because you are not using the equation you write down, but a linear approximation (or higher order) to that equation.

Is there a way to solve this problem?

Depends on what exactly you are trying to achieve. The general answer would be: No, there is no way to do this that is consistent with rational expectations.

Ah, okay thank you. My problem can be solved when I used second order approximation and reduce the high number 500000 to 100.