Stata to R cheatsheet for Econometrics

October 10, 2019
By

[This article was first published on R Bloggers on , and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Within the field, Stata is the dominant software package for economists. I suspect a large portion of universities, like mine, still do alot of their teaching using it, and given its outsized influence, it’s probably still important to know how to use it if you plan to continue studying or working in the field.

Outside of Economics, however, R is more widely used, more versatile, and just as importantly, free. It’s also true that R is far less user friendly than Stata and can be confusing given the wide range of different approaches, packages and even syntax that are all used to do the same things that seem so effortless in Stata.

With that said, inspired by the great cheatsheets on the Rstudio site, I tried to capture some of the more common Stata commands used in an applied econometrics and their equivalent expressions in R in this Stata to R cheatsheet.

This cheatsheet assumes a basic familiarity with R: how to read-in files, install and load packages, and work with dataframes.

I went back and forth on whether to use or include Tidyverse commands, but based on what I’ve seen within the Economics department at my own university, I’ve opted to keep everything in base R and tried to minimize the use of packages in order to make this cheatsheet as useful to the broadest range of R beginners. When there really was no simple way to do things (e.g. calculating robust standard errors), I just picked the package that I knew of that best replicated the simplicity of the Stata solution.

Lastly, it should be noted that it’s impossible to cover everything in two pages, so this meant to be a “survival” level cheat sheet–a handy reference for the core commands you would need to replicate while doing a basic econometric analysis in Stata.

The content is biased towards my own experience, but if this cheat sheet is at all helpful to others, I would love to hear your feedback, which will help tremendously with future updates.

All comments and suggestions are welcome!

To leave a comment for the author, please follow the link and comment on their blog: R Bloggers on .

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)