Dear reader, first of all, thanks for stopping by, and showing interest in the Stata Guide! The Guide would not have been possible without the support and encouragement from the community. I have received countless messages, comments, suggestions, and feedback on various articles, all of which have tremendously helped in improving the content. I wanted to write this small article to explain the motivation behind all of this.

Why Stata?

In the field of micro econometrics, and economics in general, Stata is the go-to language. Having being involved in a dozens of projects in institutions like LUMS, the World Bank, DFID, USAID…


In this guide we will learn to create Rose or Coxcomb plots in Stata.

Here we will also learn how to replicate Florence Nightingale’s famous sanitation and mortality figure shown below which is now part of the dataviz hall of fame. Florence Nightingale was one of the early pioneers in data visualization and the first person to create rose plots. Countless tributes have been written about them, and like other pie-shaped figures, they have also seen their fair share of criticism.


In this guide, we will cover the basics of Maximum Likelihood Estimation (MLE) and learn how to program it in Stata.

If you here, then you are most likely a graduate student dealing with this topic in a course or programming some estimation command in Stata. But MLEs also have another purpose. They also form the backbone of Machine Learning techniques. In their core essence, MLEs are parametric estimations, where, given some data, and some assumption about the functional form of the data, we need to find the optimal values of a parameter set. These parameters give us a distribution…


In this article we will shed some light on Stata’s secret weapon: Mata. While most people have heard of it, and some might have even dabbled with Mata commands, very few have ventured deep inside its territory to explore what really lies beyond the obvious applications of some matrix algebra.

In fact, Mata is a very separate world from Stata, functioning with its own set of rules and procedures. To date, only two books have been written on this language. One by William Gould, the president of StataCorp, and the second one by senior developer, Christopher (Kit) Baum, who is…


While programming in Stata or even in other languages, it is often easy to forget about structuring your files and folders. Most of the time this is left as a last step, usually when finalizing a thesis or some paper for submission. I have also heard researchers often say that once they get some revisions, then we will eventually organize the stuff in the next round. Workflow management is extremely important and organization should be done as a first step otherwise a lot of time is lost later figuring out what you actually did, where the files actually are, and…


In this guide learn how to use syntax-based synchronization to GitHub directly from Stata using Git.

Why is this necessary? More and more projects are moving online and data sharing is now commonplace. In economics and other fields, having some online repository with data and code for replication is also becoming a norm. While some websites and journals provide their own platforms for data sharing, GitHub is now also slowly gaining traction as a hosting service. Furthermore, GitHub excels are two services that other online data sharing platforms lack: version control and the seamless ability to collaborate with code writing.


In this guide, we will learn how to import OpenStreetMap (OSM) data in Stata via QGIS. This allows us to make detailed choropleth maps from several spatial layers:


In this guide learn how to create your own Stata graph schemes. Additionally, this guide also releases a host of new schemes for your day-to-day Stata use:

The Stata Guide schemes: https://github.com/asjadnaqvi/Stata-schemes

Stata schemes are templates that define how graph are drawn. The scheme files are basically text files with a .scheme extension that can be modified and saved in your local directory for use. These text files are fairly extensive with well over 1700 options for fine tuning various graph elements including colors, backgrounds, sizes, legends, text etc.

Despite the flexibility of generating schemes, surprisingly little has been produced over the years. Some of…


This guide will present a series of graph replications for the Du Bois challenge in Stata. W. E. Du Bois was an American sociologist who played a pivotal role both in his research work on the black community in the USA, and creating unique visualizations during the early 1900s. At that point, there were no computers or reference guides, so the images were drawn using pens, rulers, compasses, and threads.

When the challenge was posted online, most people were replicating the figures in R or Tableau, or other dataviz-centered languages. My interest was to replicate the graphs in Stata. Du…

Asjad Naqvi

Here you will find information on Stata, COVID-19, and data visualizations.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store