Hi，
I am a beginner of dynare, and I would like to ask, if there is a form of max {a ， b} or min {a， b} in my model equation, where a and b is an endogenous variable, can dynare handle such an equation, and how to write code?Thanks！

It depends on the context. If you want to do perfect foresight, then you can often simply use the min or max operator. If it’s an occasionally binding constraint, you could also use OccBin.

Thanks a lot for your response. I have two questions that follow. Firstly,how to tell a “perfect foresight”, or what conditions does a perfect foresight need to meet? Given that DSGE model contains random variables, is the impulse response obtained by random simulation a “perfect foresight”?

In addition，you suggest me that I can also use OccBin when it comes to an occasionally binding constraint, unfortunately, I’m not sure whether max{} or min{} belong to the occasionally binding constraint. If I directly input “max{a,b}” or “min{a,b}”, is it recognizable by Dynare?

In a perfect foresight context, agents perfectly know all future shocks and do not anticipate any uncertainty about future outcomes to arise.

Most solvers for occasionally binding constraints (including OccBin and LMMCP) involve a particular setup that does not allow for min() or max()-operators. There are various examples available, depending on what you are trying to do.

Thanks a lot for your time.I built a simple two-country model with outputs Y1 and Y2, and my country’s fiscal spending rules as:

``````ln（G1t/G1）=rho*ln（G1t-1/G1）+upsi*max{Y1t/Y1-Y2t/Y2,0}+epsi
``````

I tentatively typed the above expression directly into the model and simulated it with `stoch_simul`. Yet surprisingly it showed a result. It really confused me that whether dynare has taken the part of ‘max{}’ in the formula above into account? Should I still use Occbin to get the correct result in this occasion?

`stoch_simul` should display a warning that non-differentiable operators like `min` or `max` will be ignored.
Yes, you could easily implement the above setup in OccBin.

Thanks a lot for your excellent step-by-step explenation, I finally have a better understanding of it.