PSLmodels / OG-Core

An overlapping generations model framework for evaluating fiscal policies.
https://pslmodels.github.io/OG-Core/
Creative Commons Zero v1.0 Universal
67 stars 119 forks source link

Integrate microsimulation model (tax-calculator) with dynamic model #144

Closed rickecon closed 8 years ago

rickecon commented 9 years ago

This issue contains the discussion of how to integrate the rich tax functions produced by the microsimulation model into the dynamic (OG-USA) model.

rickecon commented 9 years ago

@jdebacker, @kerkphil , and I talked about what levers a user should be able to pull in the OG-USA model through a web app. We thought the following list of three parameter (non-tax) levers would be a good start.

Parameter levers:

  1. Growth rate of labor augmenting technological change, g_{y,t}. This ends up being the long-run productivity growth rate of the economy. Lines 127 and 192 of OG-USA/Python/dynamic/parameters.py.
  2. The Frisch elasticity of labor supply. The parameter upsilon in the elliptical disutility of labor specification is proportional to the Frisch elasticity of labor supply. Lines 132 and 197 of OG-USA/Python/dynamic/parameters.py.
  3. Long-run population growth rate g_{n,t} (by a constant change in all of the fertility rates by age, holding all the mortality rates by age constant). This will be a more difficult manipulation of the functions in OG-USA/Python/dynamic/demographics.py.
rickecon commented 9 years ago

@jdebacker , @kerkphil , and I talked about what output to show in an initial version of the dynamic model integrated with the microsimulation model. We thought showing percent changes in dynamic model variables over a 10-year window. Macro variables for which to show percent changes are:

  1. Aggregate output Y_t
  2. Aggregate consumption: C_t
  3. Aggregate investment I_t
  4. Aggregate labor supply L_t
  5. Average wage w_t
  6. Average interest rate (return on investment) r_t

We also thought it would be straightforward to show some percent changes in the distribution of certain variables across the population in each year, similar to the distributional tables from the microsimulation model output. Population distribution variables could include the following:

  1. individual consumption c_{j,s,t} by age and income
  2. individual labor supply n_{j,s,t} by age and income
  3. individual wealth b_{j,s,t} by age and income

I think all of these variables are output in the pickle OG-USA/Python/OUTPUT/TPIinit/TPIinit_vars.pkl. We would simply have to calculate the percent change from the pickle of Case Y from the pickle of Case X.

rickecon commented 9 years ago

@chrisrytting and I have been working on integrating the tax data from the microsimulation model into the OG-USA model. Our current work is in the repository https://github.com/rickecon/microsimint. The current python script in that repo, simtaxfuncs.py, generates 1,600 series of synthetic tax rate and income data that should have the same properties as the data that comes from tax-calculator. We are currently writing code to estimate parameters for tax functions from each of those 1,600 data series and incorporate those parameters into the tax functions and Euler equations of the OG-USA model.

talumbau commented 9 years ago

The duplication of parameter values in dynamic/parameters.py is on me. I put two functions in there as an expedient way to get two different simulations to run: the real one and a "fake" one for a smoke test. A reasonable refactor is to have these values specified in a JSON file, and then have each simulation read from the JSON file. The effort level for such a task is not high.

rickecon commented 9 years ago

@MattHJensen and @Amy-Xu. The tax data we need from the tax calculator is the total effective (average) tax rate for individuals as well as their labor income and capital income for all individuals of a given age and for a given period (t=1=the first year to t=10=the final year of the forecast). This means we need three data series (tax rate, capital income, labor income) for each age group in e@ch year of the forecast. This is a block of data the dimensions of which are S x T x N x 3. Instead of the total effective tax rate (total taxes paid / total income) you could just give us total taxes paid, total income, and capital income and we can back out the rest. @jdebacker @kerkphil @chrisrytting

jdebacker commented 9 years ago

I have a detailed email written and will follow up. Unexpected power outage here.

On Oct 21, 2015, at 2:31 PM, Richard Evans notifications@github.com wrote:

@MattHJensen and @Amy-Xu. The tax data we need from the tax calculator is the total effective (average) tax rate for individuals as well as their labor income and capital income for all individuals of a given age and for a given period (t=1=the first year to t=10=the final year of the forecast). This means we need three data series (tax rate, capital income, labor income) for each age group in e@ch year of the forecast. This is a block of data the dimensions of which are S x T x N x 3. Instead of the total effective tax rate (total taxes paid / total income) you could just give us total taxes paid, total income, and capital income and we can back out the rest. @jdebacker @kerkphil @chrisrytting

― Reply to this email directly or view it on GitHub.

rickecon commented 9 years ago

@chrisrytting @jdebacker . Chris, will you please go ahead and start estimating tax functions from the data that we currently have. @jdebacker is working with @Amy-Xu and @MattHJensen to make sure the data are correct and fix some potential problems. Here are the steps that we need to do.

  1. Select the observations with age == s for a given year of data.
  2. Apply the following rules for dropping outlier observations. 2A. Drop all obs with effective tax rates greater than 0.5 (we will change this to be a function of the maximum marginal tax rate later on) 2B. Drop all obs with effective tax rates less than -0.15 (we will change this to be a function of the phase in rate later on) 2C. Drop all observations with negative adjusted total income, negative total labor income, or negative capital income.
  3. Use that data to estimate a tax function tau_{s,t}(x,y) = exp(A_x^2 + B_y^2 + C_x_y + D_x + Ey + F) - G 3A. This function is a little different from what we have previously discussed, but I think it has some virtues. 3B. We can estimate the function via OLS by adding G to both sides and taking logs, which gives ln(tau{s,t}(x,y) + G) = A_x^2 + B_y^2 + C_x_y + D_x + E_y + F. We simply set G the smallest nonnegative number that makes all tax rates greater than 0.01. For example, if the minimum tax rate in the restricted sample is tau = -0.15, then G must equal 0.25. This makes all the variables strictly positive, which allows us to take the log of both sides. 3C. Set the right-hand-side variables to percent deviation form so that the estimation doesn't have scaling issues. 3D. Make sure to include the population weights in the estimation: beta = (X'_WX)^{-1}(X'_W*Y)
  4. Check the estimated functions with the data to make sure that they look right. 4A. Print out average errors and maximum absolute errors. 4B. Plot the estimated tax functions against the total tax data. This is a little tricky because the estimated tax functions are functions of x and y, whereas total income is x + y. 4C. If those estimations don't look good, we can go to a third order polynomial in the exponent. However, that might require a constrained minimizer in order to keep the derivatives positive.
jdebacker commented 8 years ago

This seems to now be integrated. @rickecon if you are satisfied, we can close this issue.

rickecon commented 8 years ago

This one is done.