OG-USA icon indicating copy to clipboard operation
OG-USA copied to clipboard

Calibration object cannot retrieve previous tax function estimates

Open rickecon opened this issue 3 years ago • 2 comments

@jdebacker. Because estimating tax functions by age (in the DEP case) takes about an hour, it is often nice to just do that once, save the TxFuncEst_policy.pkl file, and then just pass the path in to the Calibration object. In the old OG-USA API, we would use code like the following, where run_micro=False and the tax_func_path is passed in.

kwargs = {'output_base': base_dir, 'baseline_dir': base_dir,
            'test': False, 'time_path': True, 'baseline': True,
            'og_spec': og_spec_base, 'guid': '',
            'run_micro': False, 'tax_func_path': base_tax_func_path,
            'data': 'cps', 'client': client,
            'num_workers': num_workers}
runner(**kwargs)

In the new OG-USA API, the Calibration class in calibrate.py takes the boolean argument estimate_tax_functions instead of the old run_micro argument. The old run_micro argument is still used in the Calibration class sub method get_tax_function_parameters, but it can no longer be passed by calling the Calibration class. That is, there is no connection between the estimate_tax_functions argument of the Calibration class object and the run_micro argument of the get_tax_function_parameters method. As such, there is no way to instantiate a Calibration class object with estimated tax functions from a path without re-running the tax function estimation.

Code I have tried that does NOT successfully get the estimated tax function information from the TxFuncEst_policy.pkl path is the following. If I set estimate_tax_functions=True with the tax_func_path, it still reruns the tax function estimation.

c2 = Calibration(
    p2, iit_reform=iit_reform, estimate_tax_functions=False,
    tax_func_path=tax_func_path, client=client, guid='T040'
)

rickecon avatar Dec 01 '21 09:12 rickecon

@rickecon Thanks for raising this issue. Seems like a good solution might be to either add the run_micro argument to the Calibration class or assume that if estimate_tax_functions=False and tax_func_path != None, then it will look for a file to retrieve parameter estimates from (i.e., call the get_tax_function_parameters method with run_micro=False).

But there might be other solutions too.

jdebacker avatar Dec 01 '21 13:12 jdebacker

@jdebacker. Yes. I think there are three options with the tax functions in the Calibration class.

  1. Estimate the tax functions: estimate_tax_functions=True
  2. (Default) Do not estimate the tax functions and take them from the default parameters: estimate_tax_functions=False and tax_func_path=None.
  3. Do not estimate the tax functions and take them from a saved TxFuncEst_policy.pkl or TxFuncEst_base.pkl file: estimate_tax_functions=False and tax_func_path=path.

It is this third case that is not defined in the Calibration class. I will open a PR.

rickecon avatar Dec 01 '21 17:12 rickecon