Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Scalling scatter plots together with by-option


From   "Jonathan Schulz" <Jonathan.Schulz@econ.ku.dk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Scalling scatter plots together with by-option
Date   Fri, 12 Feb 2010 14:00:42 +0100

Thanks a lot for your advice - I combined overlaid scatter plots
(scaling with msize)  and within these overlaid scatter I let stata do
the scaling. ( I had frequencies ranging from one (in all by()) to
various maxima (up to 240) - with the maxima being outlayers). 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Austin
Nichols
Sent: Wednesday, February 10, 2010 4:28 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Scalling scatter plots together with by-option

Jonathan Schulz <Jonathan.Schulz@econ.ku.dk>:
You can certainly generate a variable that captures the min and max
frequencies, and you can also make your own kind of graph, where the
markers are sized in a way that is actually informative about relative
frequencies, e.g.

sysuse auto, clear
egen f=count(rep78), by(turn foreign)
sc turn rep78 [fw=f], by(foreign) name(f)
su f, mean
loc max=r(max)
g x=rep78
bys foreign turn rep78: replace x=x+(_n-1)/(`max'+1)/2
sc turn x, by(foreign) ms(S)

though the above approach requires an -expand- to sum of fweights or
something similar.  Without expanding, you could cycle over groups of
levels of fweights and make a bunch of separate overlaid scatterplots
with marker sizes set appropriately (with no fweight specified).  What
is the distribution of fweights like in your data, by group?

On Tue, Feb 9, 2010 at 1:31 PM, Jonathan Schulz
<Jonathan.Schulz@econ.ku.dk> wrote:
> Hello,
>
> I want to create a scatter plot with the by-option and frequency
> weights. Is there a way to calibrate the size of the markers between
the
> different graphs (so that the size of a marker with a specific weight
is
> the same in all graphs)? For now the relative frequencies are only
> correct within a graph.
>
> Knowing how the min & max of the mark sizes are determined (within one
> graph) would allow me to adjust the weights accordingly (together with
> the msize option). Thanks a lot in advance!
>
> Jonathan
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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