janboone / applied-economics

course material for the course applied economics
17 stars 21 forks source link

Last plot - Financial Crisis #29

Closed florisvanlaarhoven closed 4 years ago

florisvanlaarhoven commented 4 years ago

Hello,

For the last plot in the notebook of Financial Crisis, you already pre-coded the following for us:

plt.plot(range_outside_options,[outcome_h(o) for o in range_outside_options]) plt.xlabel('outside option') plt.ylabel('probability of safe choice $q_a$') plt.show()

How can it be that this code works, since you never defined 'range_outside_options'? I know that for some previous question we had to make a range of the outside_option, but I called that range 'range_q_out'. So how come that 'range_outside_options' also works without defining it in the first place?

janboone commented 4 years ago

Thanks for this: I will correct it in the notebook and state explicitly that the range needs to be called range_outside_options when we first use it.

To answer your question: python is wonderful but still cannot read our minds. If you evaluate range_outside_options in a cell, what do you get?

Could it be that it was defined when you were following along in one of the screencasts? Once it is in the kernel, it does not matter that you delete the cell in which it was defined (until you close the kernel).

florisvanlaarhoven commented 4 years ago

Thank you. When I restarted the kernel and ran all necessary cells, 'range_outside_options' did not work anymore, so maybe I somehow defined it at some point. So I understand now.