QuantEcon / lecture-source-jl

Source files for "Lectures in Quantitative Economics" -- Julia version
https://julia.quantecon.org
BSD 3-Clause "New" or "Revised" License
131 stars 53 forks source link

McCall exercise solution index #879

Open wkeahi opened 3 years ago

wkeahi commented 3 years ago

Hello,

For the exercise solution for Job Search I: The McCall Search Model (mccall_model.ipynb), I'm wondering if the index is off when generating the random wage causing the estimated means to be off. The code segment is below

# Generate a wage draw
        w_val = w[rand(dist)]

Since support(dist) is in 0,...,50 shouldn't it be w_val = w[rand(dist)+1] so that it matches the indices of w which go from 1,...,51?

Nosferican commented 3 years ago

From having taken a look at the notebook I believe that is correct. Thanks for reporting it! I saw that you had made a fork of the repository. The fix should be as you described (i.e., w_val = w[rand(dist)+1]). Would you like to open a PR with the fix?

The change should be in this file.

wkeahi commented 3 years ago

Thanks! Opened a PR. First one, hope I did it correctly.

jlperla commented 3 years ago

@wkeahi thanks so much! I am waiting for Julia 1.6 to be released, them am planning on updating support and merging a bunch of these sorts of changes