Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Graphing limitations / questions

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Graphing limitations / questions
Date   Fri, 12 Nov 2004 18:22:44 -0000

Fredrik Wallenberg
> I have a few graphs that I cannot seem to create using Stata 8.
> Perhaps someone could point me in the right direction (or confirm that
> it can't be done ... without creating a new dataset).
> I have two multiple choice survey questions. I would like to visualize
> the combinations of the answers in one out of three ways.
> A) Use a scatterplot but use the area of each coordinate dot to
> illustrate how many observations there are for that combination. The
> best I've done to date is using matrix and scatter, but that doesn't
> quite do it.
> graph matrix q3_3_4 q3_3_3, half jitter(3) msize(tiny)

> ... I can see how I could do A by creating a variable that had,
> as the weight, the total count for each combination and then us that
> as the aweight. Is there a nicer way?

As you say you could -- and should -- create a weight. 

bysort q3_3_4 q_3_3 : gen N = _N 
egen tag =tag(q_3_3_4 q_3_3) 
scatter q_3_4 q_3_3 [w = N] if tag 

> B) Use a 3 dimensional histogram (with the two variables and the x and
> z axis and the join distribution on the y axis). This can easily be
> done in Excel, why not in Stata?

Why not? Partly because most people who want to do this can do it easily 
in Excel, I imagine... But it's clearly a reasonable thing to want. 
> C) use -histogram, by-, BUT get ONE graph, treating the -by- options
> as separate variables in the same graph. Once again this seems like a
> reasonable thing to do but Stata doesn't have any support for it (that
> I can tell).

You mean you want them superimposed? 

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index