PSLmodels / ui_calculator

Calculator for unemployment insurance benefits
22 stars 12 forks source link

earnings_history vs base_period #12

Open resultsmayterry opened 1 year ago

resultsmayterry commented 1 year ago

Hi! I'm a research assistant trying to use this code for our own project. However, our data is large, so I'm rewriting ui_calculator.py in a way that takes advantage of column/dataframe operations (as opposed to the current approach of calculating everything one row at a time via list comprehension).

Why is there a distinction made between earnings_history and base_period?

Per observation, earnings_history is a list [q1, q2, q3, q4, 0] . I interpret this as the earnings history (q1-q4) plus a 0 to represent the current quarter where the individual is unemployed. This is from the definition of calc_weekly_state_quarterly().

Then, in the definition of calc_weekly_state(), we create base_period = earnings_hist[-5:-1], which is the same as [q1, q2, q3, q4]. From here, we only use base_period. Why add the 0 just to ignore it completely?

Somewhat related, I notice we index [-5:-1] when [:4] is equivalent; is the intended result a reversing ordering like [q4, q3, q2, q1]?