PSLmodels / OG-USA

Overlapping-generations macroeconomic model for evaluating fiscal policy in the United States
https://pslmodels.github.io/OG-USA/
Creative Commons Zero v1.0 Universal
19 stars 34 forks source link

Missing file: psid_lifetime_income.pkl #51

Closed rickecon closed 2 years ago

rickecon commented 2 years ago

@jdebacker. I am running a reform in OG-USA that increases PIT marginal income tax rates in Tax-Calculator, estimates new tax functions, and runs the reform. My run gets through the estimation of tax functions, which is part of the Calibration class of the calibrate.py module. In the run of my reform, I call the Calibration class using the following code:

c2 = Calibration(
    p2, iit_reform=iit_reform, estimate_tax_functions=True, client=client
)

My run finishes the DEP tax function estimation on my reform, then I get the following error traceback.

Traceback (most recent call last):
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/./examples/run_ogusa_T040.py", line 125, in <module>
    main()
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/./examples/run_ogusa_T040.py", line 67, in main
    c2 = Calibration(
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/ogusa/calibrate.py", line 60, in __init__
    self.eta = transfer_distribution.get_transfer_matrix()
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/ogusa/transfer_distribution.py", line 100, in get_transfer_matrix
    df = ogcore.utils.safe_read_pickle(
  File "/Users/richardevans/opt/anaconda3/envs/ogusa-dev/lib/python3.9/site-packages/ogcore/utils.py", line 357, in safe_read_pickle
    with open(file_path, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/richardevans/Documents/Economics/OSE/OG-USA/ogusa/data/PSID/psid_lifetime_income.pkl'

In fact, this file psid_lifetime_income.pkl does not exist in the ogcore/data/PSID/ folder. Let me know if you have this file and if we need to add this to the repo. Or do we just need to update the code in line 100 of transfer_distribution.py to point to the default eta object in ogusa_default_parameters.json?

jdebacker commented 2 years ago

@rickecon Thanks for noting this issue. I'll open a PR to resolve this. But I would not recommend using the eta matrix computed from transfer_distribution.py without further inspection of the results, which have not yet been tested or scrutinized.

rickecon commented 2 years ago

@jdebacker. I commented out line 60 in calibrate.py to get my code to work. Re-ran the code and had the same issue and similar traceback with the calculation of the bequest matrix.

Traceback (most recent call last):
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/./examples/run_ogusa_T040.py", line 125, in <module>
    main()
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/./examples/run_ogusa_T040.py", line 67, in main
    c2 = Calibration(
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/ogusa/calibrate.py", line 63, in __init__
    self.zeta = bequest_transmission.get_bequest_matrix()
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/ogusa/bequest_transmission.py", line 101, in get_bequest_matrix
    df = ogcore.utils.safe_read_pickle(
  File "/Users/richardevans/opt/anaconda3/envs/ogusa-dev/lib/python3.9/site-packages/ogcore/utils.py", line 357, in safe_read_pickle
    with open(file_path, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/richardevans/Documents/Economics/OSE/OG-USA/ogusa/data/PSID/psid_lifetime_income.pkl'

Now I am running the script with line 63 of calibrate.py commented out. I suspect that will fix it.

rickecon commented 2 years ago

@jdebacker. Because I just commented out lines 60 and 63 in calibrate.py, the Calibration object had no attributes eta or zeta, as evidenced by the error in line 394 of calibrate.py.

Traceback (most recent call last):
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/./examples/run_ogusa_T040.py", line 125, in <module>
    main()
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/./examples/run_ogusa_T040.py", line 71, in main
    d = c2.get_dict()
  File "/Users/richardevans/Documents/Economics/OSE/OG-USA/ogusa/calibrate.py", line 394, in get_dict
    dict["eta"] = self.eta
AttributeError: 'Calibration' object has no attribute 'eta'

So I replaced lines 60 and 63 in calibrate.py with the following two commands, which simply take eta and zeta from the ParamTools object p.

self.eta = p.eta
self.zeta = p.zeta

These are only temporary solutions, because they only work with S=80 and J=7.

rickecon commented 2 years ago

This issue is resolved in PR #52.