# Code Lab 03: Dynamic Labor Supply, Temporary Wage Variation, and Persistence

**Course:** Labor I: Workers, Human Capital, and Inequality  
**Module / Week:** Week 3 --- Dynamic labor supply and lifecycle responses  
**Associated chapter:** `03-dynamic-labor-supply.md`  
**Lab slug:** `03-dynamic-labor-supply`  
**Scope tier:** Standard  
**Primary language:** Python  
**Estimated student time:** 4 core hours + 2 optional hours  
**Prerequisites:** Week 2 static labor supply, basic command-line use, introductory `pandas`, comfort reading grouped summaries and simple plots  
**Core economic question:** What does randomized temporary wage variation tell us about intertemporal substitution, and how does persistence change the measured response?  
**Core design / estimator:** reduced-form comparison of synthetic shift-level outcomes across randomized temporary bonus conditions  
**Source paper for reproduction:** Fehr, Ernst and Lorenz Goette. 2007. *Do Workers Work More if Wages Are High? Evidence from a Randomized Field Experiment.* *American Economic Review* 97(1): 298--317.  
**Secondary lifecycle anchor:** Attanasio, Orazio, Hamish Low, and Virginia Sanchez-Marcos. 2008. *Explaining Changes in Female Labor Supply in a Life-Cycle Model.* *American Economic Review* 98(4): 1517--1552.  
**Transfer dataset source:** local synthetic teaching files generated by `src/build_week3_synthetic_data.py`

## Why this lab exists

Week 3 is where labor supply stops being a one-period comparative statics exercise and becomes a timing problem. [@fehrGoette2007] is a strong lab anchor because temporary randomized wage variation is one of the cleanest ways to isolate an intertemporal substitution motive. The bounded local path keeps that design logic while remaining fully runnable without restricted external files.

## Learning objectives

By the end of this lab, students should be able to:

1. reproduce one bounded response to randomized temporary wage variation;
2. explain why that response is closer to a Frisch-style object than a permanent wage-change elasticity;
3. diagnose how persistence and adjustment costs can mute measured responses;
4. transfer the same design to a persistence comparison without changing the empirical family;
5. explain how the short-run experiment links conceptually to lifecycle labor-supply work such as [@attanasioLowSanchezMarcos2008].

## Scope rules

This lab is intentionally bounded.

- Reproduce one temporary-wage reduced-form object only.
- Diagnose the design in a short memo or notebook cell block.
- Transfer the workflow to one persistence comparison only.
- Do not turn the exercise into a full structural lifecycle model.
- Keep the smoke path fully local and synthetic.

## Lab roadmap

1. **Reproduce** a temporary-bonus response using a synthetic shift panel.
2. **Diagnose** what object the response is closest to.
3. **Transfer** the same design to a persistence environment with different adjustment costs.
4. **Reflect** on how the short-run design relates to lifecycle labor supply and Week 4 human capital.

## Part 0. Setup and orientation

### Official package reality

The source paper is the conceptual benchmark. The bounded course path does **not** ship the official external replication materials. Instead, it generates synthetic teaching files that preserve the logic of temporary randomized pay variation and persistence.

### Required local structure

```text
labs/03-dynamic-labor-supply/
  README.md
  lab.md
  run-log.md
  smoke.sh
  environment/
    requirements.txt
  original/
    README.md
    source-notes.md
    reduced/
      fehr_goette_shift_synthetic.csv
  transfer/
    README.md
    data-notes.md
    data/
      fehr_goette_persistence_synthetic.csv
  src/
    build_week3_synthetic_data.py
    reproduce_fehr_goette_design.py
    transfer_dynamic_response.py
  output/
    reproduced/
    transfer/
```

### First commands to run

```bash
conda run -n research python src/build_week3_synthetic_data.py

conda run -n research python src/reproduce_fehr_goette_design.py \
  --input original/reduced/fehr_goette_shift_synthetic.csv \
  --outdir output/reproduced

conda run -n research python src/transfer_dynamic_response.py \
  --input transfer/data/fehr_goette_persistence_synthetic.csv \
  --outdir output/transfer
```

## Part I. Reproduce

### Objective

Recover a bounded response to randomized temporary wage variation and relate it back to Week 3's Frisch interpretation.

### Student tasks

1. Run `src/build_week3_synthetic_data.py`.
2. Read `original/source-notes.md`.
3. Run the reproduction script on `original/reduced/fehr_goette_shift_synthetic.csv`.
4. Inspect the summary table and the output figure in `output/reproduced/`.
5. Write a short note on whether the response should be read as temporary substitution, income effects, or something else.

### Required questions

- Why is this design closer to a Frisch or intertemporal substitution object than a permanent wage change?
- Why does randomized temporary variation still not identify a universal labor-supply elasticity?
- Which margins here look most like effort timing and which could still hide persistence?

### Minimum output

- one reproduced figure;
- one summary CSV;
- one short interpretation note.

## Part II. Diagnose

### Objective

Move from "hours rise on high-bonus shifts" to a disciplined statement about what the estimate means.

### Student tasks

1. Explain why temporary and permanent wage changes are different estimands.
2. List at least two reasons a measured temporary response could understate desired reoptimization.
3. Map the reproduced response back to Equation {eq}`eq-week3-frisch` in the chapter.
4. Explain how Equation {eq}`eq-week3-adjustment` changes the interpretation of a muted response.

### Minimum output

- a one-page design memo;
- one paragraph distinguishing substitution from wealth effects;
- one paragraph on persistence risk.

## Part III. Transfer

### Objective

Use the same temporary-shock design in a new persistence environment.

### Bounded transfer path

Run `src/transfer_dynamic_response.py` on the synthetic transfer file and compare bonus responses across `low_adjustment_cost` and `high_adjustment_cost` observations.

### Student tasks

1. Produce one grouped response figure.
2. Save the summary table by persistence environment.
3. Write a short paragraph explaining whether the design changed or only the environment changed.
4. State whether the smaller response in the high-adjustment-cost group should be read as weaker preferences or greater friction.

### Scope constraints

- Keep the same temporary incentive design.
- Produce one main figure and one compact summary table.
- Do not add structural estimation.
- Keep the transfer discussion focused on persistence.

## Part IV. Optional lifecycle bridge

Use [@attanasioLowSanchezMarcos2008] to explain how a short-run temporary-bonus design differs from a lifecycle model. The goal is not to estimate the lifecycle model here. The goal is to write a short note on what additional state variables a lifecycle exercise would need: age, experience, family status, and anticipated wage growth.

## Part V. Reflection

### Student prompts

1. What does the bounded teaching path teach especially well about Week 3?
2. What would still be missing before making a policy prediction about a permanent tax reform?
3. How does this lab set up Week 4's focus on human-capital accumulation?

## Deliverables checklist

- [ ] run log  
- [ ] reproduced figure  
- [ ] reproduced summary CSV  
- [ ] design memo  
- [ ] transfer figure and summary table  
- [ ] reflection note  
- [ ] clear distinction between bounded teaching path and full replication benchmark

## Instructor notes

- The bounded path is the default for routine course use.
- The strongest payoff comes from separating identification logic from elasticity rhetoric.
- Use the optional lifecycle bridge to connect short-run experiments to the richer models students will see next.
