Skip to content

modify opt_tax_recur #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 10, 2021
Merged

modify opt_tax_recur #204

merged 4 commits into from
Jun 10, 2021

Conversation

shizejin
Copy link
Member

@shizejin shizejin commented Jun 2, 2021

Refactorize code in the lecture opt_tax_recur as listed in #203.

@github-actions
Copy link

github-actions bot commented Jun 2, 2021

σ = self.σ
if σ == 1.:
U = np.log(c)
else:
U = (c**(1 - σ) - 1) / (1 - σ)
return U - n**(1 + self.γ) / (1 + self.γ)
return U - (1-l) ** (1 + self.γ) / (1 + self.γ)
Copy link
Member

@QBatista QBatista Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that n+l=1 is not supposed to be enforced for this case (at least with with n>=0 and l>=0). Quoting from Tom's email: "It is ok if [n] exceeds 1; this part of the lecture is using the alternative utility and technology specification". Of course, you can define l this way, but then, I think it won't match what leisure is supposed to be under this "alternative utility and technology specification".

More generally, at least in the AMSS lecture, there's a mismatch between the model being solved and the model described in the lecture. Is this the case here too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about the amss lecture but here n+l=1 is enforced (see equation (1)).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the "Specification with CRRA Utility" section that says "We also eliminate Lucas and Stokey’s restriction that ℓt+nt≤1."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that right below the sentence you quoted, it says "With these adjustments, the analysis of Lucas and Stokey prevails once we make the following replacements".

To me the original complete formulation of the model from eq. (1)-(26) is what I should follow closely when we design the code, and the CRRA case which eliminates "l+n=1" is just a special case and special replacements are needed to fit it into the original general framework.

Since I am not imposing a restriction on l, the possible range for n in the CRRA case after replacements should still be [0,+∞], and imposing n+l=1 is no more than a linkage of a special specification to the general framework defined above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I understand. My point is just that you'll get l<0 since n>1. I don't think the lecture specifies l<0, but negative leisure is surprising. In the LS paper, the utility function seems to be a mapping from R^2_{+} to R (below eq 2.2), so it looks like they don't allow for negative leisure although I would probably need to read the paper carefully to verify this. Hence, my guess is that the n in the CRRA specification is not the n in (1).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the CRRA formulation eliminates l, it is probably not so meaningful to discuss the sign of l.

I may want to clarify my two reasons for designing the code like this: (1) I prefer to impose n+l=1 in the class, since this is how it is defined at the very beginning when introducing the general framework, (2) we want to fit the CRRA case into the general framework, in that case n=1-l is necessary. Since the "economic" meaning of l has been eliminated in the CRRA case, l plays a role no more than linking the specific CRRA case to the general framework, and a negative l associated with n>1 does not bother me too much.

Might this sound a little more reasonable to you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you want to fit the CRRA case into the "general" framework. I am just wondering whether imposing n=1-l is the right way to do it. I'll double-check with Tom.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure it would be great to consult Tom about this. Please include me in the communication.

from quantecon import MarkovChain
from scipy.optimize import root


class RecursiveAllocation:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the choice of class names in these lectures. In the lecture, allocations seem to be sequences. Are RecursiveAllocation and SequentialAllocation supposed to represent sequences?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just keeping what was used originally but these names do not bother me too much. Quoting one sentence from the content: "After first presenting the model in a space of sequences, we shall represent it recursively in terms of two Bellman equations formulated along lines that we encountered in Dynamic Stackelberg models." It seems that the lecture is emphasizing the contrast between sequential representation and recursive representation. If you come up with better names for these representations, it would be great, but we would need to adjust the lecture content in a consistent way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do you mean you don't like "Allocation"s in the class names?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about SequentialLS and RecursiveLS standing for the sequential and recursive representations of the Lucas-Stokey model? The other lecture has RecursiveAllocationAMSS -- I can shorten that to AMSS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do you mean you don't like "Allocation"s in the class names?

Yes -- I guess those should be classes that are meant to represent the model(s) described in the lecture.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SequentialLS and RecursiveLS sound good if you insist. But I want to note that in the recursive representation, allocation is actually formulated in a recursive way (see the time invariant functions in eq. (32)), and I have to admit that it's not obvious to me yet how does changing these names improve the clearness.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“The difference between the right word and the almost right word is really a large matter – it is the difference between the lightning and the lightning bug.” -- Mark Twain :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I was saying is that I am not so sure why one is "right" and the other is "almost right", since "RecursiveAllocation" and "SequentialAllocation" form a good contrast in how the model solution is formulated as emphasized in the content, but it seems that you have a strong preference for what you are proposing, and I am indifferent between these. I will add this modification to this PR.

@mmcky
Copy link
Contributor

mmcky commented Jun 3, 2021

@shizejin can you ping me when this is ready to review (from a publishing perspective). Thanks!

@shizejin
Copy link
Member Author

shizejin commented Jun 3, 2021

@shizejin can you ping me when this is ready to review (from a publishing perspective). Thanks!

Sure @mmcky , I will let you know!

@shizejin
Copy link
Member Author

shizejin commented Jun 9, 2021

Hi @mmcky, with the careful review and help from @QBatista, I think this PR is now ready for your review from a publishing perspective.

@mmcky
Copy link
Contributor

mmcky commented Jun 10, 2021

thanks @shizejin and @QBatista -- amazing work! Does @thomassargent30 need to review this or has this happened already?

@mmcky mmcky merged commit 4f8fec4 into master Jun 10, 2021
@mmcky mmcky deleted the mod_amss branch June 10, 2021 01:30
@shizejin
Copy link
Member Author

Hi @mmcky, thanks so much for merging! I think Tom approves this. And @QBatista would you like to continue working under the mod_amss branch? In that case we should probably restore the branch.

@mmcky mmcky restored the mod_amss branch June 10, 2021 04:24
@mmcky
Copy link
Contributor

mmcky commented Jun 10, 2021

@QBatista It is usually better to get the latest master and then work from that in a new branch. I have found that workflow typically saves a lot of headaches when time comes to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants