Giter Club home page Giter Club logo

ui_calculator's Introduction

Unemployment insurance benefit calculator

Peter Ganong, Pascal Noel, Peter Robertson and Joseph Vavra

This code enables you to calculate the level of weekly unemployment insurance (UI) benefits for every state based on an individual's quarterly earnings history. We use this calculator in Ganong, Noel and Vavra (2020).

The calculator can be used from Python, R and Stata. Above, you will find minimum working examples for each language.

The core of the calculator is a Python function calc_weekly_state_quarterly.

  • Inputs: q1_earnings, q2_earnings, q3_earnings, q4_earnings, state
  • Output: weekly benefit amount (wba)

minimum working example using Current Population Survey and R

Annual earnings Annual weeks worked State
1600 8 IN
88000 52 AZ
35000 52 NV
library(reticulate) #package to call Python functions from R.
use_condaenv()
source_python("source/ui_calculator.py")
library(tidyverse)

example %>%
  mutate(weekly_earnings = earnings/weeks_worked,
         q1_earnings = weeks_worked - 39,
         q2_earnings = weeks_worked - 26,
         q3_earnings = weeks_worked - 13,
         q4_earnings = weeks_worked) %>%  
  mutate_at(vars(matches("q[1-4]_earnings" )), ~ case_when(.x > 13 ~ 13*weekly_earnings,
                                                           .x < 0 ~ 0,
                                                           TRUE ~ .x*weekly_earnings)) %>%
  mutate(benefits_amount = calc_weekly_state_quarterly(q1_earnings,
                                                       q2_earnings,
                                                       q3_earnings,
                                                       q4_earnings,
                                                       state) %>% map_dbl(1))
Annual earnings Annual weeks worked State Weekly benefits
1600 8 IN 0
88000 52 AZ 240
35000 52 NV 350

The worker in Indiana does not meet the eligibility requirements so recieves 0. The worker in Arizona recieves the maximum benefit amount of 240. The worker in Nevada recieves 1/25th of their highest quarter wage, which we calculate to be $350.

The calc_weekly_state_quarterly returns benefits as a list, so you may find it helpful to combine the function with another function which converts a list of numerics to a vector e.g. purrr::map_dbl(x, 1), purrr::flatten_dbl(x) or unlist(x).

Comparison of estimated benefits from calculator to actual benefits

Benchmarks source: Unemployment Insurance Benefit Accuracy Measurement data

Calculator Details

The calculator computes the benefits of a worker without dependendents as of January 2020. It also can be used to simulate alternative policies, such as Federal Pandemic Unemployment Compensation.

Many states have complex UI benefit rules. We follow the rules described in "Significant Provisions of State Unemployment Laws". If a state has multiple ways of satisfying eligibility or multiple ways of calculating benefits, we include only the first listed way. This document, and therefore our calculator, do not capture every aspect of a state's UI rules. A dictionary of the features used by the calculator can be found in data_dict.md.

Acknowledgements

If you find a problem, please open a github issue or even better propose a fix using a pull request.

Thank you to Maya Sweedler for helpful feedback.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

ui_calculator's People

Contributors

peterobertson avatar ganong123 avatar raheem03 avatar thirdhuman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.