Defining a range for the values a variable can take


I’m simulating a New Keynesian model with search frictions. The total labor force in the model is normalized to 1, and consists out of the sum of the employed and the ones who remain unemployed after matching took place.

The problem is the following. Theoretically at any point in time the number of unemployed as well as the number of employed cannot exceed 1 ( as this would imply that more people are employed or unemployed than the total labor force).However, when I look at the simulated results I find out that in several cases employment or unemployment exceeds the range 0,1}.

My question is if there is a way to define the range of values a variable can take, or do these results simply imply that there is a mistake in the code?

Thanks a lot for your help!



Suppose u is your unemployment rate in your data file at the moment.
Remove u from your list of endogenous variables, and add a new variable uf. Then add the following line to the start of your model block:

Run your simulations and you’ll get an irf for uf. This can then be transformed into an irf for u by adding the steadystate value of uf, then using the equation above. By construction it will remain in the unit interval.


In a stochastic setup, there is no real way of constraining the variables within an interval.

The point is that the solution provided by Dynare is an aprroximation of the solution which is only valid locally around the steady state. Hence in the domain of validity of the solution, the constraint is by construction satisfied.

When you make simulations with big shocks you can end up not verifying the constraint (and this can happen even with the solution proposed by cfp).

This means that you have to shrink the variance of your shocks, so that the local approximation remains a good approximation.