Session 1 · Monday, August 24, 2026
AI for Data Analysis I
Leave today with working tools and your own research project started. When a part of the session has hands-on work, it appears in the right panel.
Opening
This course
- You will use AI agents in your own research over the next five days.
- An agent is AI and it writes code, runs code on your data, and works inside your project.
Live demo
Data analysis agent
- Do countries differ in how much people value politics?
- Data: the World Values Survey.
- I give the agent one 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 the agent did
- The agent wrote the code and ran it.
- It found 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.
More tasks to delegate
- The first instruction was only the beginning. You can continue:
- "Validate the variable against the codebook."
- "Handle the survey weights."
- "Write a README that lets me re-run this with one command."
- For bigger jobs, you can split the work:
- one agent validates the data
- one writes the code
- one drafts the report
- You will do all of these on your own project by Friday.
Your new role: direct the agent
- You already analyze data and use R, Stata, or Python.
- The new skill is directing an AI agent. It can write code and run that code.
- The agent made a country-level average in ninety seconds, but it is still your call if that average answers the question.
- You are the only person who can decide if a number is believable.
Who this course is for
- You wrote your own scripts and ran them. You loaded data and ran a regression.
- You provided a dataset or a current project, and every exercise uses it.
- You do not need a software engineering background.
- If you already use Claude Code or Cursor every day, this course will be too slow for you.
Pick one tool to use all week
- This course uses one coding agent. Claude Code (by Anthropic) works and Codex (by OpenAI) also works. Pick one and use it all week.
- The pre-course email explained how to install either one.
- Every student uses the tool's exact commands, and two instructors support a class much better when everyone runs the same setup.
- What you build moves regardless. The Skill format you learn on Wednesday is an open standard, and many agents read it.
- The agent runs on a computer, and you need a Mac or Windows laptop. Once it is running, you can use it from a phone or tablet.
Outline of the week
- Monday: Direct an agent to run your first analysis.
- Tuesday: Lead a complete analysis and at every stage, decide what to hand over.
- Wednesday: Teach the agent your standards, so every new session follows them.
- Thursday: Use the agent, collect data, and search the literature.
- Friday: Build a small tool for your own project.
- Every day builds your own project, and you leave with it on Friday.
Your Friday project
- You will present your own project by Friday.
- It does not need to be finished. Some will have results or a start.
- Your account is what matters. Tell your question, say what you built, and state how far you got.
- For each main step, say who did it: which parts you decided, and which parts the agent did.
- Tell us your experience and say what worked and what the agent did wrong and explain how you caught the error.
Today
- First, the concept: what an AI agent is.
- Then setup: get your tools running.
- Build your own research project after the break.
- We end with a check of your data.
What an AI agent is
Isn't this just ChatGPT?
- The same kind of model is underneath it, but the software built around it is different.
- Ask ChatGPT for the WVS analysis, and it gives you a block of code which you must run yourself.
- Give the agent the same request. It writes the code, runs the code, hits an error, and fixes the error. It repeats this until the chart exists.
- ChatGPT answers once and then stops, but the agent continues to work until the task is finished.
- That difference comes from three engineering problems, solved between 2023 and 2025. They are the three conditions below.
The agent works in one folder
- The biggest change from ChatGPT is where your work lives: in a folder on your computer.
- Pick one folder for your project and the agent works inside that folder.
- Your data, scripts, and notes are all inside together.
- The agent only touches items in that folder and does not touch the rest of your computer.
- The memory stays in the folder, and next time, it picks up where you left off and does not start over like a chat.
Condition 1: tool use
- A language model alone only makes text.
- Tool use gives it real actions. The basic set:
- read a file — your data, your script, a codebook, a PDF;
- write or edit a file — create a script, fix a line, or draft a note;
- run a command — execute a script, install a package, or list a folder;
- Search the web, read pages, look up documentation, and find a source.
- You can plug in more tools later, which include a browser or your reference manager, and you will use some of them this week.
- Every action runs on your computer, the result goes back into the model, and the model decides what to do next.
Condition 2: the agent loop
- A chatbot answers one time and an agent works in a loop until the goal is finished.
- On the WVS chart the loop ran like this:
- it read the survey file and the codebook,
- It wrote code, which computes country averages.
- It ran the code and hit an error. The error was due to missing values.
- It read the error and rewrote that step.
- it ran again and produced the chart.
- The loop repeats, continues until the task is done, and also stops if you stop it.
- You control how often it asks you first. By default it asks before acting, and looser modes let routine actions through.
- You will use the strictest setting tomorrow.
- Whichever mode you choose, judging the result stays your job.
Condition 3: code execution
- Code tells a computer what to do. It can do any task and does not just do statistics.
- This is a statistical script, and it is one type of code. Code can also download data, collect and sort papers, clean text files, and build a website. This week covers mostly code that the agent writes.
- Code is just a guess until it runs. The agent runs its own code, reads the errors, fixes them, and runs the code again. This way, you get a result that works.
- Some tasks do not need any code, examples include reading a codebook or drafting a paragraph, and in those cases, the agent just reads and writes.
- The agent runs what it writes, which lets the agent finish a job, and it does not hand you code to run yourself.
The three conditions together
| A model alone | An agent |
|---|---|
| generates a code snippet | writes, runs, tests, and fixes code |
| describes what a script should do | implements it and verifies it |
| suggests an approach | executes it and iterates to a result |
- Remove any one of the three and the system will fall back to a chatbot.
A short history
- ChatGPT: end of 2022.
- Tool use became reliable in mid-2023.
- The agent loop grew more advanced during 2023–2024.
- Code execution was dependable during 2024–2025.
- In 2025, the first agentic coding tools came out and combined all three in the terminal.
- Two years ago, AI coding tools might have disappointed you. They lacked one or two of the three conditions.
The agent is your RA
- You were the research assistant, and a professor gave you a task, and you went and did it.
- You are now on the other side and the agent is your RA.
- It is fast and takes instructions literally. A vague brief results in a vague result.
- Your job is the part the professor kept. You decide what to ask for and judge what comes back.
One warning for the week
- These models sound fluent, but fluent language can still be wrong.
- Fear the answer that is both confident and wrong.
- Check every result the agent gives you and do this every time.
- The rule for these five days: an unverified result is not a result.
Strengths and weaknesses
- A 2026 benchmark had AI agents run full social-science replications, and scored each step:
| Step | Score |
|---|---|
| Run the analysis | 96 |
| Read and interpret the result | 93 |
| Find the data it needs | 31 |
| Judge whether it replicates | 79% |
- Use it to write code and read results. Finding the data and the final judgment stay yours.
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 is the terminal?
- The terminal is a text interface for your computer. You type a command and it prints the result.
- On a Mac, use the app Terminal, and on Windows, use PowerShell.
- Agents run in the terminal, and this is where programs run.
- You need very little.
cd foldermoves into a folder andlslists what is there. - One command matters today:
cdinto your project folder before you start the agent. - The folder where you start the agent is the project it works in. Your files, its permissions, and its memory all stay there.
- Everything else you can ask the agent to type for you.
When something breaks
- Something will break today, and that is part of the course.
- The agent runs a command, and the command fails. It reads the error and fixes the error by itself, and you watch and steer.
- If you are stuck, tell the agent in plain words what happened.
- Error messages provide information and the agent reads them very well.
Daily essential commands
Escstops the agent while it is answering, and you can redirect it before it finishes.Esc Escgoes back to an earlier part of the chat and the agent forgets everything after that point./compactasks the agent to summarize the current conversation, and the agent then continues from that summary. Use this when a long session slows down./clearclears the chat and starts a new one in the same folder./exitcloses the agent.claude --resumereopens a past conversation and continues that conversation.- On Wednesday, we explain how these commands affect the agent's memory.
Your research project · do it on the right
Project Overview
- 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
- Create the figures. Write the results.
- Do all of these on your own project this week.
- Start today at the beginning, get your data in, and take a first look.
Full project setup by agent
- You can ask the agent to create folders, ask it to write the first scripts, or also ask it to run them.
- It sets up projects well, and this is one of its first strengths.
- Many people do not know this and set everything up by hand.
- You say what you want and check what it made.
One project, one folder
- All course materials are in one folder, and this folder is for your own project.
- Ask the agent for a clear layout so you and the agent always know where things are:
README.md | what this project is |
data/ | your data |
scripts/ | analysis code |
output/ | tables and figures |
notes/ | literature and writing (Thursday) |
- You have been adding to this one project all week.
Save points with git
- Git is the standard tool, and it keeps a history of a folder. Each save is a labeled point, which is called a commit, and you can go back to it.
- Ask the agent to commit before any big change and, if the change fails, ask it to return to the last commit.
- You do not need to memorize git commands, and the agent runs them, so only say commit, show the history, or go back.
- Today you must know these three things exist: save a point, list past points, and return to one.
- Tell the agent not to save your raw data in the history, which ensures the data stays in
data/.
Why researchers keep a history
- You can always return to a working version.
- The history shows how the analysis changed, and your methods section must describe this.
- A collaborator can see all changes between two versions.
- You need three words today:
- a repository is a folder with a tracked history
- a commit is one labeled save point
.gitignorelists the files the history must never include
- You do not type any of this. Ask the agent to set it up and explain any part you want to understand.
Wrap
What you have now
- Your tools are working and your project has its first script.
- Tomorrow you will run a full analysis in stages, and at each stage, you decide what to give the agent.
Your schedule for the rest of the week
- You do not write code but direct the agent, which writes and runs the code.
- You can give it every part of the work. It can find and collect data, clean data, build your measures, run the analysis, and draw the figures.
- You must decide what to ask for and also check what comes back.
Pick your project now
- Pick one project tonight and carry it through all five days.
- It could be a dataset for analysis, a question you delayed, or a messy file you did not have time to clean.
- Aim for something that looks good by Friday. This could be a clear figure, a short, readable report, or a small website that shows your result.
Exercise
- Work in pairs, three minutes each. Run your script on your own data while your neighbor watches, and cover three things:
- your question, in one plain sentence
- one mistake the agent made
- how you found it
- The whole class follows and two or three volunteers show their work. An interesting failure is worth more than a finished chart here.
- Prepare for three questions:
- What is your question, in simple words?
- What error did the agent make, and how did you find it?
- Where should this be by Friday?
- This is a rehearsal and Friday’s presentation asks the same questions. It also asks who did each part and if it was you or the agent.
Homework
- If your environment is still broken, pair up tomorrow. And get a fix slot with Bing before Session 2.
- Tonight, write one sentence and it should be the first analysis you want to run on your data.