Exercises 10.7 and 10.12

Forums I think I found a bug Exercises 10.7 and 10.12

This topic contains 1 reply, has 2 voices, and was last updated by Fabian Kindermann June 28, 2021 at 10:40 am.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1925

    Alessandro Di Nola
    User

    Hello,
    regarding Exercise 10.7 (solve life-cycle model with endogenous labor supply using VFI), on lines 103-104 of sol_prog10_07m.f90 it is written

    cons_com = available + wage*lab_com - a_plus
     cons_lim = max(cons_com, 1d-10)

    The idea is obviously to prevent consumption from being negative. However, on line 114 we have

    valuefunc = -((cons_com**nu*(1d0-lab_com)**(1d0-nu))**egam/egam + &
                          beta*psi(ij_com+1)*vplus)

    so that cons_lim is never used. I think cons_com on line 114 should be replaced with cons_lim. If not, you may risk raising a negative number to a real power, which results in a runtime error.
    There is a similar typo also in Exercise 10.12 (solving the female labor supply model with VFI), file sol_prog10_12m.f90 line 127

    Thanks for providing such an excellent resource on github!

    Best,
    Alessandro

    • This topic was modified 5 months, 3 weeks ago by Alessandro Di Nola.
    • This topic was modified 5 months, 3 weeks ago by Alessandro Di Nola.
    • This topic was modified 5 months, 3 weeks ago by Alessandro Di Nola.
    #1931

    Fabian Kindermann
    Moderator

    Dear Alessandro,

    you are of course totally right. This definitely is a typo. I corrected it in the github repository.

    Thanks so much for pointing this out.

    Best,
    Fabian

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.