Archive

Archive for October 2026

Training or testing? Which dataset should you use to explain your model?

The h2oml suite of commands in Stata provides several postestimation commands for explaining machine learning models. You often have a choice of which dataset to use for the explanation, and that choice can affect your results. In this post, we use a simulated example to examine that choice and provide recommendations for practitioners. Read more…

What is wrong with my loop? Tips for solving errors in your loops


Introduction

When your analysis involves a repetitive task, you can write a loop in Stata to more efficiently perform this task. For example, you may want to fit a regression model separately for different industries or regions. In Stata, you can loop over values and items in a list to efficiently perform these types of tasks. However, if you come across an error when working with a loop, it may seem tricky to find the source of the error. Below, I show you some essential tools to help you solve errors in your loops: set trace, capture, noisily, and the if command. Read more…