Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Advanced Stata: Causal Inference, Machine Learning & Python
Hot & New
New
Rating: 5.0 out of 5(1 rating)
17 students

Advanced Stata: Causal Inference, Machine Learning & Python

Go beyond regression: treatment effects, difference-in-differences, lasso, random forests, Python and AI in Stata 19
Created byF. Buscha
Last updated 11/2026
English
English

What you'll learn

  • Estimate causal effects with regression adjustment, weighting, matching and doubly robust estimators, and know which assumption each one rests on
  • Run modern difference-in-differences and event studies for staggered roll-outs, and get the standard errors right when clusters are few
  • Use regression discontinuity, instrumental variables, extended regression models, mediation analysis and heterogeneous treatment effects
  • Build publication-ready tables, graphs and automated Word, Excel and HTML reports with dtable, etable, collect, putdocx and dyndoc
  • Report categorical models as probabilities with margins, and fit ordered, multinomial, conditional and nested logit models
  • Fit multilevel models with random intercepts and slopes, and use the intraclass correlation to see how much the groups matter
  • Predict with lasso, random forests and gradient boosting, and explain the models with variable importance, partial dependence and Shapley values
  • Run Python inside Stata, pass data between the two, and use pandas and scikit-learn in a Stata workflow
  • Use AI assistants to write, debug, document and translate Stata code, and check their output before you trust it
  • Organise a reproducible project with frames, survey weights and multiple imputation for missing data

Course content

10 sections • 55 lectures • 6h 50m total length
  • Welcome to Advanced Stata2:08
  • What you should know and how to use the course files2:57
  • Setting up Stata, add-on commands and Python4:54

Requirements

  • Stata 19 or StataNow. Most of the course runs in Stata 18, but a few commands, such as cate and the h2oml machine-learning suite, need version 19
  • A working knowledge of Stata: loading data, do-files, regress and logit, and reading a regression table
  • Basic statistics up to multiple regression. No knowledge of Python or machine learning is assumed
  • For the Python section, a free Python installation. For the AI section, access to an AI assistant; a free tier is enough to follow along

Description

You know how to run a regression in Stata. This course is about what comes after that.

Most real questions are causal: did the policy work, does the treatment help, what would have happened otherwise? A regression coefficient doesn't answer them by itself. In this course you'll learn the methods that do, when to use each one, and how to check whether the answer holds up. Then we'll add the tools that have changed how analysts work in the last few years: machine learning, Python and AI assistants, all from inside Stata.

Every video follows the same pattern. A few slides explain the idea in plain language, then we go into Stata and work through a real example, command by command, and I show you how to read the output. The emphasis is on interpretation: what does this number mean, and what would you write in your report?

What's in the course

  • A modern Stata workflow. Reproducible projects, frames, survey data, missing data and multiple imputation.

  • Publication-ready tables, graphs and reports. Table 1 with dtable, regression tables with etable, custom tables with collect, Word and Excel output with putdocx and putexcel, automated reports with dyndoc, and graphs that are ready for a journal.

  • Advanced categorical models. Marginal effects in depth, interactions in non-linear models, ordered and multinomial outcomes, and choice models with conditional and nested logit.

  • The causal inference toolkit. Potential outcomes, regression adjustment, inverse probability weighting, doubly robust estimators, matching, regression discontinuity, instrumental variables, extended regression models, event studies, staggered difference-in-differences, the wild bootstrap, mediation, heterogeneous treatment effects and sensitivity checks.

  • Multilevel models. Nested data, the intraclass correlation, random intercepts and slopes, three-level models and multilevel logit.

  • Machine learning in Stata. Prediction versus inference, lasso and elastic net, lasso for inference, classification, random forests and gradient boosting, and how to explain what a model has learned.

  • Python inside Stata. Running Python from a do-file, moving data both ways, pandas, scikit-learn and Jupyter.

  • AI-assisted analysis. What AI can and can't do for a Stata user, prompting, debugging, validating results, documenting and translating code, and AI agents.

What you get

  • 55 focused videos, about seven hours in total

  • A do-file for every demonstration, so you can run everything yourself

  • A one-page cheat sheet for each section

  • A practice exercise for each section, on a different dataset from the videos, with a full solution

  • A quiz at the end of each section

All examples use datasets that ship with Stata or are free to download, so there's nothing to buy beyond Stata itself.

By the end, you'll be able to pick the right method for a causal question, defend it, present the results in a form a journal or a client will accept, and use machine learning, Python and AI where they help.

Who this course is for:

  • Researchers, analysts and graduate students who use Stata and want to move from "running regressions" to credible causal claims
  • Stata users who need journal-quality tables and reports without copying and pasting numbers
  • People who hear about machine learning and AI and want to know what they add to a Stata workflow, and what they don't
  • Anyone who has finished an introductory Stata course and is asking what comes next