Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Sampling weights with twoway line graph


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Sampling weights with twoway line graph
Date   Thu, 25 Sep 2008 10:49:17 -0500

To expand on Eva's point, it can take a while to realise that

(a) -graph bar-, -graph dot-, -graph pie-, etc.

(b) the -twoway- commands

are based on quite different approaches. Commands in (a) typically work out what numbers to show and then show them. Commands in (b) typically do no processing. You must have worked out the numbers to show upstream. Thus commands in (a) always look better, until they just don't offer what you want, when you turn to commands in (b).

Eva Poen


-help collapse- shows that pweights are allowed with -collapse-. Therefore,

collapse drugA drugB drugC [pweight=pwt], by(year)

followed by a -twoway line- ought to give you what you need.
Mike Schmitt

Using the Bar Chart, I can use sample weights and graph the mean of
each of my variables to get the plot of interest. I was wondering if
I could get a line graph showing same data (ie, lines instead of
bars). Using Stata 10.1, it seems that there is no way to enter in
sample weights for a basic twoway line graph, unless I'm over looking
something.

My current bar chart syntax is:
graph bar (mean) drugA (mean) drugB (mean) drugC [pweight = pwt], over(year)

And the bar chart is spot on, like it should be, however I'm dumb
founded of how to coerce stata into giving me the same graph only with
lines. Thanks to previous help from this listserv, I know that I can
collapse the data to get Stata to get a line graph of means, however
I'm unsure of how that can be done while maintaining the weighting
procedure and hence I'm a tad apprehensive to do that. If I could
just swap the bars I'd be happy.
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index