Learn how to communicate your data with Stata's powerful graphics
features. This course will introduce different kinds of graphs and
demonstrate how to use them for exploratory data analysis. Topics
include how to use graphs to check model assumptions; how to format,
save, and export your graphs for publication using the Graph Editor; how
to create custom graph schemes; how to create complex graphs by layering
and combining multiple graphs; how to use margins and marginsplot;
and more. Bonus material includes information on user-written graph
commands and useful data management tools.
Internet web browser, installed and working (course is platform independent)
Course content
Expand all sections
Lesson 1: Getting to know your data using graphs
Introduction
Why graphs are an important tool for exploratory data analysis
Data management tools for graphing data
The example dataset
How to create and edit basic graphs using Stata
How to create and edit graphs with dialog boxes
How to edit graphs with the Graph Editor
How to create and edit graphs with commands
Some basic graphs
Graphs for one continuous variable
Graphs for one categorical variable
Graphs for two continuous variables
Graphs for two categorical variables
Graphs for one continuous and one categorical variable
Graphs for many variables
Storing, saving, and exporting graphs
Storing graphs in memory
Saving graphs to disk
Exporting graphs in .png format
Automating the process: Looping and saving
Lesson 2: Understanding your results using graphs
Introduction
Model checking using graphs
Using the predict command
Checking model assumptions
Checking the normality assumption
Checking the linearity assumption
Checking the homoskedasticity assumption
Identifying outliers and influential observations
Visualizing the results of your models
Using the margins and marginsplot commands
A brief review of factor variables
Categorical independent variables
Multiple categorical independent variables
Continuous independent variables
Continuous and categorical independent variables
Average response versus response at average: The atmeans option
Contrasts of margins
Marginal effects: Margins of derivatives of responses
Using contour plots to visualize continuous-by-continuous interactions
Lesson 3: Formatting graphs for publication
Introduction
Formatting titles, legends, and text boxes
Formatting titles
Formatting legends
Adding text boxes
Using italics, bold, superscripts, and subscripts
Using specialty characters
Using different fonts
Formatting numbers
Formatting axes, axis labels, ticks, gridlines, graph, and plot regions
Formatting categorical axis labels
Formatting the x and y axes
Formatting the x- and y-axis labels
Formatting major and minor ticks and gridlines
Adding reference lines
Formatting the graph and plot regions
Controlling the aspect ratio and size of graphs
Using schemes to change the overall look of graphs
Using built-in schemes
Defining your own schemes
Recording and saving edits in the Graph Editor
Lesson 4: Advanced graphs: How to layer and combine multiple graphs
Introduction
Layering multiple graphs with the graph twoway command
Basic layered graphs with one y axis
Advanced layered graphs with one y axis
Basic layered graphs with two y axes
Advanced layered graphs with two y axes
Layering multiple graphs with the addplot() option
Basic
Advanced
Creating multiple graphs with the by() option
Combining different graphs with the graph combine command
Basics: Making a table of separate graphs
Advanced: Making a single complex graph from separate graphs
Exporting graphs for publication
Exporting graphs in pixel-based formats
Exporting graphs in vector-based formats
Bonus material
Note:
The previous four lessons constitute the core material of the course. The following material is optional and introduces community-contributed graphic commands and useful data management tools.
Introduction
Community-contributed graph commands
The Statistical Software Components (SSC) archive
The coefplot package by Ben Jann
How to write a simple graphics wrapper command
How to create animated graphs
Some fun graphs
How to create normal curves with shaded tails
How to show scatterplots with regression lines and residuals
How to add normal curves to regression lines
How to graph a histogram with a box plot
Appendix: Data management tools useful for graphing data
The destring and encode commands
The recode command
The tabulate command with the generate() option
The egen command
The contract and collapse commands
The statsby command
The snapshot command
The reshape command
Macros and loops
Extracting value labels to local macros
×
We use cookies
We use cookies to ensure that we give you the best experience on our website—to enhance site navigation, to analyze usage, and to assist in our marketing efforts. By continuing to use our site, you consent to the storing of cookies on your device and agree to delivery of content, including web fonts and JavaScript, from third party web services.
Cookie Settings
Privacy policy
Last updated: 16 November 2022
StataCorp LLC (StataCorp) strives to provide our users with exceptional products and services. To do so, we must collect personal information from you. This information is necessary to conduct business with our existing and potential customers. We collect and use this information only where we may legally do so. This policy explains what personal information we collect, how we use it, and what rights you have to that information.
These cookies are essential for our website to function and do not store any personally identifiable information. These cookies cannot be disabled.
Advertising and performance cookies
This website uses cookies to provide you with a better user experience. A cookie is a small piece of data our website stores on a site visitor's hard drive and accesses each time you visit so we can improve your access to our site, better understand how you use our site, and serve you content that may be of interest to you. For instance, we store a cookie when you log in to our shopping cart so that we can maintain your shopping cart should you not complete checkout. These cookies do not directly store your personal information, but they do support the ability to uniquely identify your internet browser and device.
Please note: Clearing your browser cookies at any time will undo preferences saved here. The option selected here will apply only to the device you are currently using.