View source: R/calculate_taxes.R
taxsim_calculate_taxes | R Documentation |
This function calculates state and federal income taxes using the TAXSIM 35 tax simulator. See http://taxsim.nber.org/taxsim35/ for more information on TAXSIM 35. The function uses a compiled WebAssembly (wasm) version of the TAXSIM app that is part of the package to calculate taxes. Details about generating the wasm file can be found here: https://github.com/tmm1/taxsim.js
taxsim_calculate_taxes(
.data,
marginal_tax_rates = "Wages",
return_all_information = FALSE
)
.data |
Data frame containing the information that will be used to calculate taxes. This data set will be sent to TAXSIM. Data frame must have specified column names and data types. |
marginal_tax_rates |
Variable to use when calculating marginal tax rates. One of 'Wages', 'Long Term Capital Gains', 'Primary Wage Earner', or 'Secondary Wage Earner'. Default is 'Wages'. |
return_all_information |
Boolean (TRUE or FALSE). Whether to return all information from TAXSIM (TRUE), or only key information (FALSE). Returning all information returns 42 columns of output, while only returning key information returns 9 columns. It is faster to download results with only key information. |
The output data set contains all the information returned by TAXSIM 35, using the same column names. Descriptions of these columns can be found at the bottom of the page containing TAXSIM 35's documentation.
In the input data set, .data
, each column is a tax characteristic (year, filing status, income, etc.)
and each row is a tax filing unit.
Columns should take the same names, and fulfill the same requirements, as those needed for TAXSIM 35. Potential columns, with there names and descriptions, can be found at: http://taxsim.nber.org/taxsim35/.
The following columns are required: taxsimid
, year
, mstat
, and state
.
There are two points where taxsim_calculate_taxes
departs from TAXSIM 35.
For filing status, mstat
, users can either enter the number allowed by TAXSIM 35
or one of the following descriptions:
"single"
"married, jointly"
"married, separately"
"dependent child"
"head of household"
For state
, users can either enter the SOI code, as required by TAXSIM 35,
the two-letter state abbreviation, or the full name of the state.
It is OK if the input data set, .data
, contains columns in addition to the ones that are used by TAXSIM 35.
The NBER's TAXSIM 35 tax simulator does all tax calculations. This package simply lets users interact with the tax simulator through R. Therefore, users should cite the TASXSIM 35 tax simulator when they use this package in their work:
Feenberg, Daniel Richard, and Elizabeth Coutts, An Introduction to the TAXSIM Model, Journal of Policy Analysis and Management vol 12 no 1, Winter 1993, pages 189-194.
family_income <- data.frame(
taxsimid = c(1, 2),
state = c('North Carolina', 'NY'),
year = c(2015, 2015),
mstat = c('single', 'married, jointly'),
pwages = c(10000, 100000),
page = c(26, 36)
)
family_taxes <- taxsim_calculate_taxes(family_income)
merge(family_income, family_taxes, by = 'taxsimid')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.