-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
modify opt_tax_recur
#204
Conversation
σ = 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.γ) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)).
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
@shizejin can you ping me when this is ready to review (from a publishing perspective). Thanks! |
thanks @shizejin and @QBatista -- amazing work! Does @thomassargent30 need to review this or has this happened already? |
@QBatista It is usually better to get the latest |
Refactorize code in the lecture
opt_tax_recur
as listed in #203.