Graphics Reference
In-Depth Information
4.8
Graphing by groups
This section discusses the use of the by() option in combination with graph bar .Nor-
mally, you would use the over() option instead of the by() option, but there are cases
where the by() option is either necessary or more advantageous. For example, a by() op-
tion is useful if you exceed the maximum number of over() options (three if you have a
single
-variables). In such cases, the by() option
allows you to break your data down by additional categorical variables. Also, by() gives
you more flexibility in the placement of the separate panels. For more information about
the by() option, see Options : By (272); for more information about the over() option, see
Bar : Over (111). These examples are shown using the vg s1c scheme.
y
-variable or two if you have multiple
y
graph bar wage, over(urban2) over(married) over(union)
Consider this bar graph that breaks
wages down by three categorical
variables. If we wanted to further break
this down by another categorical
variable, we could not use another
over() option since we can have a
maximum of three over() options with
a single
y
-variable.
Uses nlsw.dta & scheme vg s1c
single
married
single
married
nonunion
union
Rural
Metro
graph bar wage, over(urban2) over(married) over(union) by(collgrad)
If we want to show the previous graph
separately by collgrad , we can use the
by() option. This gives us two graphs
side by side: one for those who are not
college graduates and one for college
graduates.
Uses nlsw.dta & scheme vg s1c
not college grad
college grad
single
married
single
married
single
married
single
married
nonunion
union
nonunion
union
Rural
Metro
Graphs by college graduate
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.
Search WWH ::




Custom Search