kink_estimator {bunchr} | R Documentation |
Analyzing Bunching at a Kink
Description
Given a kinked budget set, this function gets a vector of earnings and
analyzes bunching. This function could be run independently, but best used
through the bunch
function.
Usage
kink_estimator(earnings, zstar, t1, t2, cf_start = NA, cf_end = NA,
exclude_before = 2, exclude_after = 2, binw = 10, poly_size = 7,
convergence = 0.01, max_iter = 100, correct = TRUE, select = TRUE,
draw = TRUE, title = "Bunching Visualization", varname = "Earnings")
Arguments
earnings |
Vector of earnings, hopefully a very large one. |
zstar |
Place of kink (critical earning point). |
t1 |
Marginal tax rate before kink. |
t2 |
Marginal tax rate after kink. |
cf_start |
Number of bins before the kink bin where counter-factual histogram should start. |
cf_end |
Number of bins after the kink bin where counter-factual histogram should start. |
exclude_before |
Number of excluded bins before the kink bin. |
exclude_after |
Number of excluded bins after the kink bin. |
binw |
Bin width. |
poly_size |
Order of polynomial used to calculate counter-factual histogram. |
convergence |
Minimal rate of change of bunching estimate to stop iterations. |
max_iter |
Maximum number of iterations for bunching estimates. |
correct |
Should the counter-factual histogram be corrected to compensate for shifting left because of the notch? See details. |
select |
Should model selection be used to find counter-factual histogram? See details. |
draw |
Should a graph be drawn? |
title |
Title for plot output |
varname |
Name for running variable, to be desplayed in the plot |
Details
A histogram is created from the earnings vector, with the kink point zstar as the center of one of the bins.
Correction of the counter-factual is required, as the kink-induced bunching will shift the whole distribution on the right side of the kink to the left. This option follows Chetty et al (2009) in correcting for this.
Model selection works using the step
function from the stats package.
It runs backwards from the full polynomial model, trying to find the best
explanatory model using the Akaike information criterion.
Value
kink_estimator
returns a list of the following variables:
e
Estimated elasticity
Bn
The sum of total estimated extra bunching in the excluded bins
b
The rate of extra bunching in the excluded area, divided by the length of area in \$
data
A data frame with bin mids, counts, counter-factual counts, and excluded dummy
References
Chetty, R., Friedman, J., Olsen, T., Pistaferri, L. (2009) Adjustment Costs, Firm Responses, and Micro vs. Macro Labor Supply Elasticities: Evidence from Danish Tax Records, Quarterly Journal of Economics, 126(2).
See Also
Examples
ability_vec <- 4000 * rbeta(100000, 2, 5)
earning_vec <- sapply(ability_vec, earning_fun, 0.2, 0, 0.2, 0, 1000)
# bunch_viewer(earning_vec, 1000, 40, 40, 1, 1, binw = 10)
kink_estimator(earning_vec, 1000, 0, 0.2, 40, 40, 1, 1, binw = 10, draw = FALSE)$e