Germán Rodríguez
Generalized Linear Models Princeton University

Stata Logs

The "Stata Logs" collect the transcripts of six sessions using the statistical package Stata. Each session reproduces the results of (practically) all the analyses in one of the Chapters of my lecture notes on Generalized Linear Models.

The material is organized by Chapters and Sections using exactly the same numbering system as the notes, so section 2.8 of the logs deals with the analysis of covariance models described in section 2.8 of the notes.

The transcripts are formatted versions of actual Stata logs run using version 14. The text boxes set in a typewriter font contain commands or instructions to Stata, followed by the resulting output. You can tell the commands apart because they appear on lines beginning with a dot, or on continuation lines beginning with a greater than sign.

The rest of the text set in the standard font represents comments or annotations, except for references to Stata commands which are also set in a typewriter-style font. The overall format is similar to that used in the Stata manuals themselves.

The best way to use these transcripts is sitting by a computer, trying the different commands as you read along, probably with a printed copy of the notes by the side. I also recommend that you try to answer the few questions and exercises posed along the way.

If you follow this procedure you will notice that sometimes I use the continuation comment /// to indicate that a command continues on another line. If you are using Stata interactively, just keep typing on the same line.

While interactive use is probably good for learning, for more serious work I recommend that you prepare your commands in a "do file" and then ask Stata to run it. If nothing else, this will help document your work and ensure that you can reproduce your results. These logs were all produced using do files.

Stata 8 introduced a graphical interface that lets you use menus and dialogs to specify your analyses. This feature can help beginners learn the commands, but I recommend that you get used to typing your commands from the outset, so you make an easy transition to do files.

On the same vein, Stata 10 introduced a Graphics Editor that lets you modify a graph using a point-and-click interface. While this is convenient, once you have edited a graph interactively you can't easily reproduce it.

Stata 11 moved further along these lines by introducing a Variables Manager that lets you modify variable and value labels and other properties of your variables using a dialog. For serious research, however I recommend that you do all work using commands stored in a do file.

The purpose of these notes is to illustrate the use of Stata in statistical analysis, not to provide a primer or tutorial. I have, however, written a short tutorial that you can find at Please consult the Stata online help and manuals for more details.

The "Stata Logs" were first published in January 1993 and targeted version 3. Revisions were completed to target newer releases roughly every couple of years. The current edition targets version 14.

P.S. The Anscombe datasets are here.