In the past couple of weeks I have been adapting a code from the quantecon lecture on Default Risk in Python that includes selective default.
Basically, the model follows Arellano (2008) framework, but, different from the standard, I assume two bonds: b_d and b_f, where b_f are bonds borrowed by the government from risk-neutral foreign investors (standard) and b_d bonds borrowed by the government from risk-averse domestic households. Therefore, there will be two asset pricing equations: one for q_f (which depends only to the risk-free rate r and the endogenous probability of external default) and one for q_d, which comes from the Euler equation, depending on u’© and u’(c’).
My problem is how to built an algorithm for this framework. Here, different from the lecture, there are two more endogenous states, once q_d depends also to the FOC constraints. The idea is to built a toy model for the selective default framework. We assume fully discrimination of creditors from the government.
Here what I’ve so far: https://github.com/victoralexs/Selective-Default-algorithm/blob/master/paper1.py
If anyone has an insight, will be more than welcome. It is the prototype to my PhD thesis.