Conditional equations

Hi Dear All
In my model, households own banks. I want to define that only if the banking profit is positive or zero, the bank will pay this profit to the household. For example, if the banking profit is defined as follows:

Proft=a-b

The profit that the bank pays to the household:

Max((a-b),0)

I am a beginner in Dynare and I do not know how to define this in Dynare. Thank you in advance for helping me with this

Will this be a stochastic or a perfect foresight model?

Thanks Professor
My model is stochastic.It should be noted that if the banking profit becomes negative, the comerical bank will transfer this negative value to the central bank. in fact, the bank overdrafts from the central bank, and the central bank always cooperates with him in this matter.Now I do not know if the stochastic model is better or deterministic (due to this overdraft).
But for now, My model is stochastic

For a stochastic model, this will be hard to implement as perturbation solutions do not allow for a kink like the one you had in mind. But you may be able to use Occbin.

Thanks a lot Professor
Is there a good text or mod file to learn about using the Occbin?
What method is used in the deterministic model?
Thank you very much for your time

  1. There is the original paper at https://www.sciencedirect.com/science/article/abs/pii/S0304393214001238
  2. In the deterministic model, Dynare will solve the model nonlinearly. Here the max operator is fine.
  3. An alternative to the hard constraint in a stochastic model could be a penalty function. See

many thanks