Module 2 Lab: Empty Folder to Verified Figure

In this lab you run the same loop you watched in the demo: empty folder, download script, clean panel, publication-style figure, reproducibility README. The difference is that you choose the measure. The demo built R&D intensity, and your lab measure is a different one, so when you check your figure at the end you are checking your own work rather than a copy of the demo. The starter pack (lab2_starter.zip) contains an opening-prompt template with blanks for your measure, tags, and aggregation; a verify checklist; and a card explaining DECISIONS.md and LOG.md. The zip has no data in it. FSDS is public, and downloading it yourself is part of the exercise.

NoteWhat you’re building in this module

By the end of the lab you will have:

  • a fresh project folder with a complete pipeline of named scripts (download, clean-and-join, measure, figure), none of which exist only as chat output;
  • a DECISIONS.md and LOG.md that you requested in your opening prompt rather than added afterward, plus an attrition table that explains every change in sample size;
  • a DATA_PROFILE.md written before your first figure;
  • one publication-style figure, with two sanity checks written down and sourced;
  • a README a labmate could follow to reproduce your entire pipeline in a fresh clone of the folder.

Choose your measure

Start the same way the demo did: mkdir ~/lab2 && cd ~/lab2 && claude. Because the folder is empty, Claude sees this project and nothing else. Then pick one of the three measures below. They are tiered by ambition. Choose the tier that matches how much cleaning judgment you want to practice in this module, which need not be the hardest one.

Base: leverage by industry and year. Compute book leverage (long-term debt divided by total assets) as the median by two-digit SIC code (sic2) and year. This is the closest variant of the demo: the same join and the same aggregation, with a different pair of XBRL tags.

Standard: R&D intensity, different industry grain. Build the demo’s R&D-intensity measure (R&D expense over total assets), but aggregate by one-digit SIC (sic1) instead of the demo’s sic2. You already know the measure. What is new is the grouping decision and how it changes the pattern you see.

Stretch: revenue concentration. For each year, compute the share of total reported revenue that comes from the ten largest filers by revenue. This tier takes more cleaning judgment than the other two. You have to decide how to handle firms that report revenue under more than one tag, and how to break ties at the tenth-largest boundary. Pick it if you want more practice with ambiguous cleaning decisions rather than with the mechanics of the join.

Whichever tier you pick, use the known-good quarters the starter pack pins for you: Q4 of 2012, 2015, 2018, 2021, and 2023. Five quarters give you a long enough time series for a meaningful plausibility check without downloading and cleaning fourteen quarters in an 80-minute lab. Tag coverage in FSDS also varies by quarter. A value reported under one tag in an earlier filing sometimes appears under a slightly different tag in a later one. That is another reason to pin exact quarters instead of defaulting to all of them.

Requirements, regardless of tier

The deliverable has the same shape as the demo’s:

  • named scripts only;
  • DECISIONS.md and LOG.md requested in your opening prompt before any analysis runs, not added later once something looks off;
  • an attrition table showing every point where your sample size changed and why;
  • one publication-style figure;
  • a README that lets a stranger, or you in three weeks, rerun the whole pipeline from scratch.

Adapt the opening-prompt template in the starter pack to your tier. Fill in the measure, the tags, and the aggregation. Leave the paper-trail section exactly as written, and do not trim it if you are short on time. It is the part that produces DECISIONS.md and LOG.md.

TipVerify this: your checklist for this module

Work through every line before you call the lab complete. As in Module 1, the checklist is self-graded and pass/fail. The instructor will spot-check a sample rather than grade every box.

Stretch for finishers: if your pipeline is done with time to spare, do one of two things. Either rerun the same research question with a second measure and compare what changes, or write a paragraph (not code) on what the WRDS version of this pipeline would need to change: which table replaces sub.txt and num.txt, which key replaces adsh, and which filters Compustat would require that FSDS does not. This previews Module 4. It is not homework, and a few sentences is enough.

TipWRDS CHECKPOINT — hard gate, due by the end of this module

Before you leave this module, submit one of two things on your exit ticket. Either submit a tunnel_status screenshot showing ssh wrds connecting, a Duo push arriving, and the connection succeeding, or, if it did not work, a flag describing exactly what went wrong. This checkpoint is required. Module 4’s main lab depends on this connection, and the instructor needs tonight to triage problems and announce fixes in the next module, not the night before Module 4. If your WRDS access is not working at this checkpoint, you are provisionally assigned to the public-data fallback track for Module 4, so you can plan for it now rather than at the last minute. If you get access working before Module 4, you can move to the live track. If you have not tried the connection since Module 1’s homework, do it before lab starts.

Debrief and exit ticket

We regroup for a short debrief. Whose first-draft figure was right on the first attempt? If almost nobody’s was, that is the expected outcome and not a problem with the lab. Where did Claude recover from an error on its own, and where did you have to step in and redirect it?

Complete the standard three-question exit ticket (one concept that clicked, one thing that broke, one thing you’d want to verify before trusting a similar result). Then add this module’s two items: the WRDS checkpoint above, and one sentence on sub-agents. If you saw Claude start a sub-agent at any point during your lab, what do you think it was for? We will answer that properly in Module 4.