bunch: Bunching Analysis

Description Usage Arguments Details Value See Also Examples

Description

Given a kinked or notched budget set, this function gets a vector of earnings and analyzes bunching. The bunchr package has two main useful functions:

Usage

1
2
3
4
5
6
bunch(earnings, zstar, t1, t2, Tax = 0, cf_start = NA, cf_end = NA,
  exclude_before = NA, exclude_after = NA, force_after = FALSE,
  binw = 10, poly_size = 7, convergence = 0.01, max_iter = 100,
  correct = TRUE, select = TRUE, draw = TRUE, nboots = 0, seed = NA,
  progress = FALSE, 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.

Tax

"Penalty" tax for crossing zstar.

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.

force_after

For notch analysis, should bunch be forced to use of the provided exclude_after for the end of the bunching, rather than trying to find the bin where the sum of the integral is zero? See details at notch_estimator documentation.

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?

nboots

how many bootstraps should be run?

seed

specify seed for bootstraps (earnings sampling).

progress

Should a progress bar be desplayed?

title

Title for Plot output

varname

Name for running variable, to be desplayed in the plot

Details

bunch checks if the specification has a kink, i.e. if the Tax parameter is greater than zero. If so, it applies notch_estimator. Otherwise, it applies kink_estimator. Additionally, bunch can bootstrap by sampling the earnings vector, returning a vector with the estimated elasticities.

Value

bunch returns a list comprising of the parameters returned by kink_estimator and notch_estimator. If bootstraps were asked for, bootstrapped values are added to the list. Drawing of histograms is suppressed when running the bootsraps.

See Also

kink_estimator, notch_estimator

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# analyzing a kink
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, 20, 20, 1, 1, binw = 20)
estim <- bunch(earning_vec, 1000, 0, 0.2, Tax = 0, 20, 20, 1, 1,
binw = 20, draw=TRUE, nboots = 0, seed = 16)
estim$e

# analyzing a notch
earning_vec <- sapply(ability_vec, earning_fun, 0.2, 0.2, 0.2, 500, 1000)
bunch_viewer(earning_vec, 1000, 10, 40, 2, 22, binw = 50)
estim <- bunch(earning_vec, 1000, 0.2, 0.2, Tax = 500, 10, 40, 2, 22,
binw = 50, draw = FALSE, nboots = 0, seed = 16)
estim$e

trilnick/bunchr documentation built on May 31, 2019, 7:54 p.m.