Using Stata for Survey Data Analysis
Minot
Page 45
SECTION 9: PRESENTING DATA WITH GRAPHS
This section provides a brief introduction to creating graphs. In Stata, graphs are primarily made with
the graph command, followed by numerous subcommands for controlling the type and format of
graph. In addition to graph, there are many other commands that draw graphs. In this section, we
focus on four types of graph and a few options. These are the commands and subcommands covered
in this section:
graph
twoway
bar
pie
matrix
connect( )
msymbol( )
histogram
scatter
graph
This command generates numerous types of graphs and diagrams. The syntax is:
graph graphtype [varlist] [if exp] [in range] [, options]
where
graphtype
is the type of graph
varlist
is the list of variables to graph
if
is used to limit observations that are included based on the exp condition
in
is used to limit observations that are included based on the case number
options
are commands to control the look of the graph
The main graph types drawn with the graph command are:
twoway
Two-way graphs with two variables
matrix
Matrix of two-way scatter-plot graphs
box
Box-and-whisker plot
dot
Dot chart
bar
Bar chart of means or sums
pie
Pie chart
Other graphs
Two commonly used graph types work as separate commands:
histogram
Bar chart based on frequency
scatter
Scatter plots based on two variables
histogram
This command generates a histogram, a bar chart showing the distribution of values of one variable.
The syntax is:
Do'stlaringiz bilan baham: |