Welfare computation for heterogenous agent model

De Fiore, Uhlig - 2015 - Corporate Debt Structure and the Financial Crisis.pdf (457.4 KB)
Dear all,

I have question regarding welfare computation for heterogenous agent model.
I tried to replicate de Fiore & Uhlig (2015) model. I did the first-order approximation of the model by hand, and use numerical analysis (grid, interpolation, and aggregation) for computing the steady state and coefficients in front of all variables.
Then I put the linear equations in Dynare, using external steady-state file and it works well.
However, I have problem when I need to compute welfare since it is a linear model. What I understand is I cant re-write again all the model in non-linear form and simulate in dynare using 2nd order approximation since some of the variables are obtained from numerical analysis which is non-differentiable
(I tried but the error said the Jacobian matrix is NaN).

Is there any other way to compute welfare from linear model?

I am thinking to derive second order approximation of the household utility by hand, and then use the variables in square (example : c_hat square) as variance (var(c_hat). Is it legal to do this?

This is my utility function:
U_{t}=\left[ log\left( c_{t}\right) -\frac{\eta }{1+\frac{1}{\kappa }}% h_{t}^{1+\frac{1}{\kappa }}\right]

and I can get the second order approximation is:
U_{t}(c,h)\simeq \overline{U}+\overline{U}_{c}\overline{c}\widehat{c}_{t}+% \overline{U}_{h}\overline{h}\widehat{h}_{t}+\frac{1}{2}\overline{U}_{cc}% \overline{c}^{2}\widehat{c}_{t}^{2}+\frac{1}{2}\overline{U}_{hh}\overline{h}% ^{2}\widehat{h}_{t}^{2}+\overline{U}_{ch}\overline{c}\overline{h}\widehat{c}% _{t}\widehat{h}_{t}

Can I write \widehat{h}_{t}^{2} as variance \widehat{h}_{t} such that I can compute:

U_{t}(c,h)\simeq \overline{U}+\overline{U}_{c}\overline{c}\widehat{c}_{t}+% \overline{U}_{h}\overline{h}\widehat{h}_{t}+\frac{1}{2}\overline{U}_{cc}% \overline{c}^{2}var(\widehat{c}_{t})+\frac{1}{2}\overline{U}_{hh}\overline{h}% ^{2}var(\widehat{h_{t}})+0 ?

Thank you in advance for anyone that can give any clue.