Job Search Models: Dynamic Programming in Python

Dan Baumann
The Startup
Published in
5 min readJan 27, 2020

Daniel Baumann

Job Search (picture taken from jobacle.com)

Abstract

Throughout my three years studying and specialising in economics, the notion of dynamic programming and its application through theoretical models felt incredibly powerful. While I had a short stint at watching one of my lecturers solve urban economics problems with the programming language Julia, for the most part, sadly, my education in dynamic models stopped at pen and paper solutions. As I embark on my data science career and have accumulated a new set of skills, the prospect of solving these problems from within a completely new interface excites me greatly.

NB: This blog assumes intermediate level of labour economic understanding

Introduction

Unemployment has been a co-existing characteristic through the normal function of modern-day economies. Many economists argue that its existence is inevitable, or even a necessity for an economy to avoid typical bottleneck issues of inflation. As such, there have been many attempts to model unemployment and its subsequent effects. Olivier Blanchard estimated that a safe level of unemployment was approximately 6.5% between the years 1970–1998 in the United States. Macroeconomic findings such as these have been fascinating to learn about, however my interest resided more in the microeconomic decision-making process behind voluntary unemployment. This is when individuals essentially “solve models” when faced with various outcomes.

In this blog I wanted to revisit a model which I had come across whilst studying for my final year at university. The overarching premise of the model is as follows: individuals are tasked with the decision to enter the workforce, or hold out for a better job offer, given a multitude of factors.

The McCall Model of Job Search

John J. McCall attempted to create a dynamic model that provided a mathematically optimal rule when faced with the dilemma of job search.

The model can be summarised with these points:

  • Workers are faced with sequential job offers (i.e. one wage offer each period). They are assumed to know the distribution of wage offers, but can’t predict which offer they will receive next
  • Exogenously decided unemployment benefits, endogenously decided discount factor which reflects individual impatience for future consumption
  • Wage offers are independently and identically distributed. A dice throw is a perfect illustration of this, with the previous roll having no impact on the next
  • Workers have a minimum wage they would accept, as well as an upper limit which is determined by their skill level. This means that any offer below this minimum would be rejected, and any offer above the upper limit would not be feasible as a firm would reject the employee
  • Searcher thus accepts any wage

Calculating the reservation wage

Using a Beta Binomial Distribution, where probability of success in each of a known number of Bernoulli trials is random. A Bernoulli trial is a random experiment with exactly two possible outcomes “success” and “failure”

Also setting a minimum possible wage of $10 and maximum of $60

def compute_reservation_wage(UB=25,
β=0.95,
w_vals=w_vals,
ϕ_vals=ϕ_vals,
max_iter=500,
tol=1e-6):
# == First compute the value function == #v = w_vals / (1 - β)
v_next = np.empty_like(v)
i = 0
error = tol + 1
while i < max_iter and error > tol:
for j, w in enumerate(w_vals):
stop_val = w / (1 - β)
cont_val = c + β * np.sum(v * ϕ_vals)
v_next[j] = max(stop_val, cont_val)
error = np.max(np.abs(v_next - v))
i += 1
v[:] = v_next # copy contents into v# == Now compute the reservation wage == #return (1 - β) * (c + β * np.sum(v * ϕ_vals))

Testing this function:

compute_reservation_wage()
44.26228462720691
  • Unemployment benefit of $25
  • Discount factor of 0.95

RESERVATION WAGE = $44.3

Comparative Statics

Comparative statics is a powerful tool which allows us to compare two different economic outcomes before and after changing some underlying parameter. In this case, we could change the value of unemployment benefit or discount factors.

What we we expect to happen to the reservation wage if unemployment benefit fell?

If unemployment benefit falls, we would expect the reservation wage to also fall

But why?

In words, a fall in unemployment benefit decreases the opportunity cost of employment.

Similarly, what do we expect if discount factors change?

If discount factor was to fall, then said individual is more impatient and is willing to accept a lower wage. We can mathematically see this with discount rates (which is just one minus discount factor).

Present Value tells us how much money is worth in future periods.

Present Value Formula
  • Suppose we have two individuals with discount rates of 5% and 10% respectively (i.e. discount factors of 0.95 and 0.9)
  • For individual 1, we have a present value of:
  • For individual 2, we have a present value of:

We can see that individual 1 is more patient and values future income more than individual 2. Thus, we expect someone like individual 2 to be more willing to enter a workforce at a given wage rate.

Some concluding thoughts

While I have shown some very basic uses of dynamic programming (with the help of google), there is a lot to be desired with this type of modelling. There is a systemic problem with economic models which hold the natural assumption that humans are deemed to be “homo economicus”. This is that humans are consistently rational, and narrowly self-interest agents. And in being these flawlessly designed agents, we also pursue our subjectively defined ends optimally. However, I think we all know that human behaviour is often sporadic and inconsistent.

The onset of masses upon masses of recorded data could be highly important in recreating economic models which encompass far more variables. Economics will undoubtedly benefit from machine learning and artificial intelligence in future. While it may not be the perfect representation of each individual’s behaviour, the tracing of human behaviour can certainly be improved.

References

Thomas J. Sargent, John Stachurski, Job Search 1: The McCall Search Model (https://python.quantecon.org/mccall_model.html)

Olivier Blanchard and Lawrence F. Katz, What We Know and Do Not Know About the Natural Rate of Unemployment, 1997 (https://scholar.harvard.edu/files/lkatz/files/what_we_know_and_do_not_know_about_the_natural_rate_of_unemployment.pdf)

--

--