Stata Resources

by on January 21, 2011 at 6:25 am in Books, Data Source, Economics, Science | Permalink

Here are some Stata resources that I have found useful. Statistics with Stata by Hamilton is good for beginners although it is overpriced. For the basics I like German Rodriguez’s free Stata tutorial best, good material can also be found at UCLA’s Stata starter kit and UNC’s Stata Tutorial; two page Stata is good for getting started quickly.

Christopher Baum’s book An Introduction to Modern Econometrics using Stata is excellent and worth the price. The world is indebted to Baum for a number of Stata programs such as NBERCycles which shades in NBER recession dates on time series graphs–this was a big help in producing graphs for our textbooks!–so buy Baum’s book and support a public good.

I have found it hugely useful to peruse the proceedings of Stata meetings where you can find professional guides to using Stata to do advanced econometrics. For example, here is Austin Nichols on Regression Discontinuity and related methods, Robert Guitierrez on Recent Developments in Multilevel Modeling, Colin Cameron on Panel Data Methods and David Drukker on Dynamic Panel Models.

I found A Visual Guide to Stata Graphics very useful and then I lent it to someone who never returned it. I suppose they found it very useful as well. I haven’t bought another copy, since it is fairly easy to edit graphs in the newer versions of Stata. You can probably get by with this online guide.

German Rodriguez, mentioned earlier, has an attractively presented class on generalized linear models with lots of material. The LSE has a PhD class on Stata, here are the class notes: Introduction to Stata and Advanced Stata Topics.

Creating a map in Stata is painful since there are a host of incompatible file formats that have to be converted (I spent several hours yesterday working to convert a dBase IV to dBase III file just so I could convert the latter to dta). Still, when it works, it works well. Friedrich Huebler has some of the details.

The reshape command is often critical but difficult, here is a good guide.

Here are many more sources of links: Stata resources, Stata Links, Resources for Learning Stata, and Gabriel Rossman’s blog Code and Culture.

Rahul January 21, 2011 at 2:52 am

At the steep prices Stata sells at is it much better than a free option like R? Just curious.

kalevala January 21, 2011 at 3:46 am

Could somebody link to a "resources for R" post? Or write one?
That being said, I like stata and find it more user-friendly than R. So thank you very much, Alex; I have sent the post out to all my colleague graduate students.

Alex Tabarrok January 21, 2011 at 4:02 am

Stata is to R as Windows is to Linux.

Adam Ozimek January 21, 2011 at 4:06 am

The Statalist archives are very useful as well because most questions you would want to ask have been asked before and many have ben answered. http://www.stata.com/statalist/archive

To those asking about R and Stata, the advantages I've found with R are a cool 3D scatterplot, object oriented programming makes it easier to grab and use stuff like your covariance matrix after regression, and I'm told that unlike Stata the mapping functions are very useful. The advantages of Stata are everything else. This is just for me though, statisticians I find prefer R and economists prefer Stata.

Jameson Burt January 21, 2011 at 5:12 am

R works like a Maserati, extremely flexible, cutting-edge.
Stata and the old statistical industry standard SAS work like a Ford,
straight forward, easier than R because they lack flexibility.

Unfortunately, the statistics professors at George Mason University stopped teaching R/Splus a decade ago, but they still use R for their profession,
because their students enter jobs with only SAS or some other basic statistical programming language.
Managers largely choose something like SAS because they cannot use cutting-edge R; because actually spending money on software lets them get answers for money and assign blame; and because they do not conceive the greater variety of statistical problems/solutions and quicker/more-difficult computing solutions.

Rahul January 21, 2011 at 6:15 am

Gnuplot needs a mention for plotting. Very versatile. Does maps and 3D plots too.

@Adam Ozimek:

Do you find use for 3D scatter plots? Whenever I tried it becomes a mess of data hard to read. Of course, it does have a high coolness-index.

@Curt:

I love mathematica for symbolic stuff. But for number crunching I rather prefer matlab (or its free clone; Octave)

MD January 21, 2011 at 6:29 am

Alex – YES.

Learn R. It'll be hard, but then you can do anything.

Sergey Kurdakov January 21, 2011 at 6:47 am

BTW last time, you was about to have a new computer for Stata R was not available in 64 bit on windows, now it is, so large sets are OK with R for windows.

BTW
http://www.rforge.net/JGR/ GUI for R

Gabriel Rossman January 21, 2011 at 7:31 am

To all the people saying that Alex should be talking about R rather than Stata, I think you all know that R is a very powerful and flexible program but it's almost deliberately opaque. As with lots of free software, there's an issue that your time is worth something. In this respect, if R is Linux (not a bad analogy actually) then Stata isn't Windows, but OS X. That is, it's a similar product that's more expensive and slightly less flexible but much easier to use. And I should add that a) Stata isn't that expensive and b) it is extensible through a large library of user-written scripts in much the same ways as is R.

The issue is not a GUI versus a command-line — almost all Stata users run the program through scripting — but about having a command-line that is intuitive. Nobody has ever run a regression in Stata and wondered what happened to the results because Stata assumes that when you run a regression, you're actually interested in the output, whereas R assumes that you want it to disappear into the ether unless you specify that you want to capture it in an object or wrap it in a summary() function. Note that R Commander behaves more like Stata as it wraps everything in summary().

For example, loading a dataset, running an OLS, and getting the most common output in R looks like this:
<pre>dataset <- read.table(data.txt)
attach(dataset)
myregression <- lm(y~x)
summary(myregression)
</pre>

In contrast, doing the same thing in Stata looks like this:
<pre>use data.dta, clear
reg y x</pre>

There are also subtler issues, such as that R sample code almost always uses random data whereas Stata sample code almost always uses real data. Since ordinary users are mostly interested in using real data and there's a pretty substantial learning curve to R's object-oriented approach to data, using "rnorm()" instead of "read.table()" and "attach()" in tutorials is just another subtle way that R throws up needless stumbling blocks on the learning curve.

Recommending R to people who don't need its flexibility and would be intimidated by all the parentheses and arrows (and inscrutable assumption that output should be suppressed) is snobbishness, the geek equivalent of lecturing people who don't eat vegetables at all and are considering the Birdseye aisle at the supermarket that they really should be buying all their food from organic farmer's markets.

Moby Hick January 21, 2011 at 8:32 am

and inscrutable assumption that output should be suppressed

If you see the output, you'll find it hard to resist putting it into a paper. If something appears in a paper, it will be mis-reported by a journalist.

Anon. January 21, 2011 at 9:42 am

I have had the same experience with stata as most of the people above: when you're presented with ready datasets and you need to perform simple tasks (i.e. when you're an undergrad) stata is heaven.

But the data handling is horrific, the syntax is abysmal, and doing anything at all that isn't built-in (or readily available on the net) is hell. My go-to stats programs are R and MATLAB, usually preferring MATLAB for its more intuitive syntax and more extensive documentation.

Moby Hick January 21, 2011 at 10:22 am

Stata has its weaknesses, but if you consider its syntax abysmal, you're just wrong or have a really weird basis of comparison.

Office 2007 January 21, 2011 at 6:58 pm

HOW DO YOU DO ?

Fr. January 27, 2011 at 2:17 am

I am currently teaching Stata to social science students with no experience of either stats or programming whatsoever, and it is going pretty well. I understand why a researcher would have both Stata and R installed on his/her machine (I use both), but as far as teaching goes, I feel that Stata is really on top of its competitors.

bargain true religio March 7, 2011 at 3:38 pm

Many people just have bad eating habits. That's usually why the people in those ads lose so much weight. They start to eat right.

Comments on this entry are closed.

Previous post:

Next post: