Hi,

I’m trying to incorporate a loss aversion component into my asset pricing model. This requires a function that, I believe, has an if-then statement inside the function. I’ve searched the user guide and examples but have found none that could help guide me. Would this require an “external” if-then MATLAB code?

Can anybody point me to the right direction?

Thanks, guys.

Please elaborate. For what is the if-condition? Does it depend on parameters or variables. If it depends on variables and introduces a non-differentiability, then you cannot use it for stochastic models. If it is for parameters, then you can use the macro-processor’s if-clause.

Hi, thanks for the quick reply, Mr. JP.

My consumption CAPM for the household optimization is

beta*((C^(1-gamma)/(1-gamma))+(theta*(((1-N)^1-chi)/(1-chi))+(beta*(v(X(+1),Z))))

My problem is the third component: (beta*(v(X(+1),Z)))

the variables are X(+1) and Z.

X(+1) = R(+1)-R_f

If X(+1) > 0, then (v(X(+1),Z))

If X(+1) > 0, then (lambda*(v(X(+1),Z))

Based on your question, it appears my issue fall under variable dependent and non-differentiable.

Does that sound right, Mr. JP?

Thanks and regards,

Jomar

That sounds like a Karush-Kuhn-Tucker problem/occasionally binding constraint. You cannot use this type of constraint in a stochastic model in Dynare as the kink at 0 introduces a non-differentiability. Essentially, you need to assume that you are always in one of the two cases to use Dynare.

Thanks for your inputs, Mr. JP.