-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Adding HARK-SSJ-notebook [WIP] #1424
base: master
Are you sure you want to change the base?
Conversation
@mnwhite can you help Will get this over the finish line? |
I'm very confused about what this PR represents. There is one commit, which adds 113,000 lines of code across 111 files. The original post doesn't say what it does or what it's supposed to do, just refers to one added notebook that doesn't work with HARK. I can work with Will, but I don't know what this is, what the goal is, what changes were made to the local version of HARK (and why), etc. |
@mnwhite I was instructed to make a pull request that adds a notebook I created over a year ago that had demonstrated how HARK can be connected to SSJ. The original notebook was intended for expositional purposes and I had altered my local version of HARK to allow it to solve a simple HANK model. The notebook is 'KS-HARK-presentation-notebook.ipynb' can be found in a folder named 'HARK-SSJ-Example' in the 'examples' module. It runs on an altered version of the ConsIndShockModel named 'ConsIndShockModel_HANK.py'. From what I can recall, 'ConsIndShockModel_HANK.py' differs from the standard ConsIndShockModel.py by adding new distribution engines that multiplies the income shock process by a function that takes in inputs that can later be shocked with the calc_jacobian method. To clarify, income is now y_{it} = p_{it} \theta_{it} func(X) where X could be equal to a tuple (wage,tax) and func(X) = (1-tax)*wage. You can specify this func(X) in the code and it will then allow for the computation of jacobians to the wage or to taxes. The current issue is that the notebook can run perfectly only with the local version of HARK in the 'HARK-SSJ-Example' folder. The notebook can be run with HARK 0.13.0 but it will produce the wrong results. For all other versions of HARK, the notebook does not run. Alan's best guess is that the local version of HARK in the 'HARK-SSJ-Example' folder for which it works is somewhere between 0.13.0 and 0.14.0. Whatever the bug is is causing the transition matrix simulation of aggregate consumption to be off by 1e-1 which is also causing the Jacobians to be incorrect. My guess is that maybe the formulation of distribution engines has changed? Or If the transition matrix code or calc_jacobian method is the problem then that would have showed up on the checks. |
@mnwhite Actually I think the bug for why HARK 0.13.0 has to do the with specification of how much wealth is given to newborns. I will look into this issue this weekend. No matter that bug, the notebook still does not run with HARK 0.14.0 . Not sure if you have any thoughts on that end. |
That's helpful, thank you. So the PR includes a copy of all of HARK in a
subdirectory, and *some* of those files have been edited relative to an
older version of HARK. Is that correct?
…On Wed, May 15, 2024 at 9:41 PM Will Du ***@***.***> wrote:
@mnwhite <https://github.com/mnwhite> Actually I think the bug for why
HARK 0.13.0 has to do the with specification of how much wealth is given to
newborns. I will look into this issue this weekend.
No matter that bug, the notebook still does not run with HARK 0.14.0 . Not
sure if you have any thoughts on that end.
—
Reply to this email directly, view it on GitHub
<#1424 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADKRAFOZGTEPBSNVM3IP42LZCQFEHAVCNFSM6AAAAABHLXTYLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJTG42TQNBUHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
So, when it worked for Haruki and the students in my class, that was
because they had pulled in an entire proprietary WDu version of HARK?
I'm very eager to get this cleaned up -- integration of HARK with SSJ is a
primo selling point for HARK, and if these notebooks don't work then we
don't have any working example of that.
I think changes from 13 to 14 are functionally minor, so if it were working
with 13.0 it might work directly with 14.0.
Will, your git commit history should be able to tell you the exact point at
which your proprietary version of HARK last connected with some commit on
the HARK-dev repo. It should be a fairly simple matter to compare whatever
it is you have now with that first commit to your fork to remind yourself
what changes you made.
On Wed, May 15, 2024 at 9:52 PM Matthew N. White ***@***.***>
wrote:
… That's helpful, thank you. So the PR includes a copy of all of HARK in a
subdirectory, and *some* of those files have been edited relative to an
older version of HARK. Is that correct?
On Wed, May 15, 2024 at 9:41 PM Will Du ***@***.***> wrote:
> @mnwhite <https://github.com/mnwhite> Actually I think the bug for why
> HARK 0.13.0 has to do the with specification of how much wealth is given
to
> newborns. I will look into this issue this weekend.
>
> No matter that bug, the notebook still does not run with HARK 0.14.0 .
Not
> sure if you have any thoughts on that end.
>
> —
> Reply to this email directly, view it on GitHub
> <#1424 (comment)>,
or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ADKRAFOZGTEPBSNVM3IP42LZCQFEHAVCNFSM6AAAAABHLXTYLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJTG42TQNBUHA>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#1424 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKCK76A37VU7CS47PAWIUDZCQGMFAVCNFSM6AAAAABHLXTYLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJTG44TKMZZGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
- Chris Carroll
|
Yes that is correct. I know that the function 'gen_tran_matrix_1D' in the utilities.py file has a slight difference and I believe this may be causing the bug when running the notebook with HARK 0.13.0, but it would not explain why the notebook breaks with HARK 0.14.0 I don't think much else of the local HARK folder has been altered (but I don't recall perfectly). That is why I defined the new ConsIndShockModel_HANK.py, to try to keep the changes self contained in that file. |
I agree with Chris. We need to figure out what you did. Did you do the work for this in your own fork of HARK, making commits as you went? |
Yes. Although, I think I figured out what is causing the bug in 0.13.0 and will get back to you on this by Monday.
No, I did this all locally. It was quickly put together with some tools I had locally. |
That's going to make this significantly harder. The |
@llorracc @mnwhite Fixed a major bug in the notebook. The Jacobians look great, the impulse responses look great, the goods market clears to a magnitude of 1e-5 in the impulse responses however the goods market in steady state is off by 2.5% (goods_mkt is 2.5e-2 instead of 1e-9). The reason why is because I assume newborns receive no wealth whatsoever and this is not accounted for in the difference equations in the notebook. This assumption is convenient for purposes I will explain to Chris in my next meeting with him. To fix this bug, it is a one line change in the notebook somewhere. Chris, I'll discuss with you on the this tiny issue Friday. |
Please ensure your pull request adheres to the following guidelines:
The notebook "KS-HARK-presentation-notebook.ipynb" in the folder that was added to examples does not work with any version of HARK that can be pip installed.
The notebook instead calls on the a local version of HARK that is closest to econ-ark==0.13.0
With econ-ark==0.13.0, the notebook will not produce any errors but there will be a bug in the computation in the Jacobians as well as the steady state values of aggregate consumption.