Ad hoc analysis of Policy Engine flat file 2023

Comparison to taxdata 2023

Author

Don Boyd

Published

February 27, 2024

1 Introduction

This website compares the evolving PolicyEngine flat file for 2023 to the current taxdata flatfile for 2023.

The basic steps are:

  • Prepare data files for Tax-Calculator:

    • Construct a variant of the taxdata file that only has variables that it has in common with the PE file. Stack the PE file and this taxdata variant, and put an indicator on each record indicating its source (pe or td).

    • Construct another taxdata variant that keeps all input variables but drops the calculated variables that are on it. Put an indicator on each record indicating its source (tdall).

  • Run the stacked pe-td file through Tax-Calculator, 2023 baseline law.

  • Separately run the tdall file through Tax-Calculator, 2023 baseline law.

  • Get the two Tax-Calculator output files, add back record-source indicators (they are stripped away by Tax-Calculator), stack them, and save the output as an rds file.

  • Analyze the resulting output file. Although most analysis is of initial variables rather than calculated variables, running the file through Tax-Calculator was important because it constructs AGI, which is an important classifier for distributional analysis.

  • The R code that does the above is on GitHub in the pe_flatfile folder.