Session 1 · Monday, August 24, 2026

AI for Data Analysis I

Leave today with your tools working and your own research project started. When a section has something to do, it appears in the panel on the right.

Opening

This course

  • Over the next five days you use AI agents in your own research.
  • An agent is AI that writes and runs code on your data, inside your project.
Live demo

An agent doing data analysis

  • Question: do countries differ in how much people value politics?
  • Data: the World Values Survey.
  • I hand the agent a single instruction and let it work:
Using Python: from the World Values Survey, find the item on how important politics is in a respondent's life, compute the country-level average, make a bar chart of countries by that average, and save it as a PNG.

What just happened

  • The agent wrote the code and ran it.
  • It hit errors, read them, and fixed them.
  • It checked its own output.
  • It returned a chart for you to inspect.
  • Your only inputs were the instruction at the start and your reading of the chart at the end.

You can push it further

  • The first instruction was only the beginning. You can continue:
    • "Validate the variable against the codebook."
    • "Handle the survey weights."
    • "Write a README so this re-runs with one command."
  • For bigger jobs, you can split the work:
    • one agent validates the data
    • one writes the code
    • one drafts the report
  • By Friday, you will have done all of these on your own project.

From tool user to director

  • You already analyze data in R, Stata, or Python.
  • The new skill is directing an AI agent to write and run that code.
  • The agent produced a country-level average in ninety seconds, and whether that average answers the question is still your call.
  • You remain the only one in the room who can say whether a number is credible.

Who this course is for

  • You have written and run your own scripts: load data, run a regression.
  • You brought a dataset or an ongoing project. Every exercise runs on it.
  • You do not need a software engineering background.
  • If you already use Claude Code or Cursor daily, this course will be too slow for you.

One tool, on purpose

  • This course runs on one coding agent. Claude Code (by Anthropic) and Codex (by OpenAI) both work; pick one and use it all week.
  • The pre-course email walked you through installing either one.
  • Every hands-on uses that tool's exact commands, and two instructors support a room far better with one setup per person.
  • What you build transfers anyway: the Skill format you learn on Wednesday is an open standard that many agents read.
  • The agent runs on a computer, so you need a Mac or Windows laptop; once it is running you can also reach it from a phone or tablet.

The five days

  • Monday: run your first analysis by directing an agent.
  • Tuesday: direct a full analysis, deciding at each stage what to hand over.
  • Wednesday: make your analysis re-run with a single command.
  • Thursday: use the agent to search literature and draft writing.
  • Friday: build a small tool around your own project.
  • Each day adds to one project of your own, and on Friday you leave with it.

Where this is going: your Friday project

  • By Friday you will present a project of your own.
  • It does not need to be finished; some will have results, some will have a start.
  • What matters is the account you give: your question, what you built, and how far you got.
  • For each main step, say who did it: which parts you decided, and which parts the agent did.
  • Share the experience: what worked, what the agent got wrong, and how you caught it.

Today

  • First, the concept: what an AI agent is.
  • Then setup: get your tools running.
  • After the break, build your own research project.
  • We close with a checkpoint on your own data.

What an AI agent is

Isn't this just ChatGPT?

  • Underneath it is the same kind of model. The difference is the machine built around it.
  • Ask ChatGPT for the WVS analysis, and it hands you a block of code to run yourself.
  • Give the agent the same request, and it writes the code, runs it, hits an error, and fixes it, until the chart exists.
  • ChatGPT answers once and stops. The agent keeps working until the task is done.
  • That difference comes from three engineering breakthroughs, solved between 2023 and 2025.

It works in a folder, not a chat

  • The biggest change from ChatGPT is where your work lives: in a folder on your computer.
  • You pick one folder for your project, and the agent works inside it.
  • Your data, your scripts, and your notes are all in there together.
  • The agent only touches things in that folder, so it stays out of the rest of your computer.
  • Its notes stay in the folder, so next time it picks up where you left off, instead of starting over like a chat.

Condition 1: tool use

  • A language model on its own only produces text.
  • Tool use gives it real actions: read a file, write a file, run a command, search the web.
  • Every time it edits your script or runs python analysis.py, that is tool use at work.
  • The model asks to run an action, the action runs on your computer, and the result goes back to the model.
  • This is why the agent asks permission before it acts: it is running on your machine.

Condition 2: the agent loop

  • A chatbot answers once. An agent works in a loop until the goal is met.
  • On the WVS chart the loop ran like this:
    • it read the survey file and the codebook,
    • it wrote code to compute the country averages,
    • it ran the code and hit an error on missing values,
    • it read the error and rewrote that step,
    • it ran again and produced the chart.
  • The loop repeats until the task is done, or until you stop it.
  • It pauses for your approval, and that pause is where your judgment enters.

Condition 3: running the code

  • Much of research work is code: cleaning data, running a model, drawing a chart.
  • For that work, code you have written is only a guess until it runs.
  • The agent runs its own code, reads what breaks, fixes it, and runs again, so you end up with a result that works.
  • Some tasks are not code, like reading a codebook or drafting a paragraph, and there the agent just does the writing.
  • Running its own code is what lets the agent finish the job.

The three conditions together

A model aloneAn agent
generates a code snippetwrites, runs, tests, and fixes code
describes what a script should doimplements it and verifies it
suggests an approachexecutes it and iterates to a result
  • Take away any one of the three, and the system falls back to a chatbot.

A short history

  • ChatGPT: end of 2022.
  • Tool use became reliable in mid-2023.
  • The agent loop matured through 2023–2024.
  • Code execution became dependable during 2024–2025.
  • The first agentic coding tools, in 2025, combined all three in the terminal.
  • If an AI coding tool underwhelmed you two years ago, it likely had one or two of the three, and this is why.

The agent is your RA

  • You have been the research assistant: a professor hands you a task, and you go do it.
  • Now you are on the other side, and the agent is your RA.
  • It is fast, and it takes instructions literally, so a vague brief comes back as a vague result.
  • Your job is the part the professor kept: decide what to ask for, and judge what comes back.

One warning for the week

  • These models are built to sound fluent, and fluent language can still be wrong.
  • The case to fear is the answer that is confident and wrong at once.
  • So you check every result the agent gives you, every time.
  • The rule for these five days: an unverified result is not a result.

What it is good and bad at

  • A 2026 benchmark ran AI agents through a full social-science replication and scored each step:
StepScore
Run the analysis96
Read and interpret the result93
Find the data it needs31
Judge whether it replicates79%
  • You lean on it for the code and the reading; you own the data and the final call.

Source: Nguyen et al., "ReplicatorBench: Benchmarking LLM Agents for Replicability in Social and Behavioral Sciences" (2026), arXiv:2602.11354.

Setup · do it on the right

What the terminal is

  • The terminal is a text interface to your computer: you type a command, it prints the result.
  • On a Mac it is the app called Terminal; on Windows it is PowerShell.
  • Agents live here because this is where programs are run.
  • You need very little of it: cd folder moves into a folder, ls lists what is there.
  • Everything else you can ask the agent to type for you.

When something breaks

  • Something will break today. That is part of the course, on purpose.
  • When the agent runs a command that fails, it reads the error and fixes it on its own; you watch and steer.
  • When you are stuck yourself, tell the agent in plain words what happened.
  • Error messages are information, and the agent is very good at reading them.

Your research project · do it on the right

What a whole project looks like

  • Most research projects go through the same steps, and you can hand each one to the agent:
    • find and collect the data
    • clean it and get it ready
    • build the measures you need
    • run the analysis
    • make the figures and write up the result
  • This week you do all of these on your own project.
  • Today you start at the beginning: get your data in and take a first look.

The agent can set up the whole project

  • You can ask the agent to make the folders, write the first scripts, and run them.
  • Setting up a project is one of the first things it does well.
  • Many people do not know this, and set everything up themselves by hand.
  • You say what you want, and you check what it made.

One project, one folder

  • Everything in this course lives in one folder for your own project.
  • Ask the agent for a clear layout, so you and it always know where things are:
README.mdwhat this project is
data/your data
scripts/analysis code
output/tables and figures
notes/literature and writing (Thursday)
  • You keep adding to this one project all week.

Wrap

Where you are

  • Your tools are running, and your own project has its first script.
  • Tomorrow you run a full analysis in stages, deciding at each stage what to hand the agent.

How you work for the rest of the week

  • You do not write code yourself. You direct the agent, and it writes and runs the code.
  • You can hand it every part of the work: finding and collecting data, cleaning it, building your measures, running the analysis, and drawing the figures.
  • Your job is to decide what to ask for and to check what comes back.

Pick your project now

  • Choose one project tonight and carry it through all five days.
  • It can be a dataset you want to analyze, a question you have been putting off, or a messy file you never had time to clean.
  • By Friday, aim for something that also looks good: a clear figure, a short readable report, or a small website that shows your result.

Before you go, and tonight

  • Show a neighbor your script running on your own data.
  • If your environment is still broken, you pair up tomorrow and get a fix slot with Bing before Session 2.
  • Tonight, write one sentence: the first analysis you want to run on your data.