Statalist


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

RE: st: graph following svy command


From   "Daw, Christina M" <[email protected]>
To   "Austin Nichols" <[email protected]>, <[email protected]>
Subject   RE: st: graph following svy command
Date   Thu, 28 Jun 2007 12:07:57 -0500



Thank you very much for the suggestions on the graph and on the proportion issue.  Since svy commands do not support the glm model from Papke and Wooldridge for proportions as dependent variables,  I thought I was stuck as is.  

Chris Daw 




-----Original Message-----
From: Austin Nichols [mailto:[email protected]]
Sent: Wed 6/27/2007 7:56 PM
To: [email protected]
Subject: Re: st: graph following svy command
 
Christina M <[email protected]>:

A straightforward approach is to skip -svy- altogether, and
-summarize- using aweights, which will give you the same point
estimates as the -svy- estimator.  In your example, you might:

svyset
local w=r(wvar)
levelsof evyr, local(y)
g mpc=.
foreach v of local y {
 su pcoop if officemh==1 & evyr==`v' [aw=`w'], meanonly
 replace mpc=r(mean) if officemh==1 & evyr==`v'
}
bys evyr: replace mpc=. if _n>1
line mpc evyr, sort

A faster approach would use -collapse- and aweights, though again you
would only get point estimates, not SEs or CIs that way.

But you can also get any quantities you need to graph from the survey
estimator using a similar -foreach- loop. Try -eret li- and -mat li
e(b)- to see where the numbers are stored.

As for the variance estimates, note that -mean- is not intended for
working with percentages.  A confidence interval on a percentage
should in general not be symmetric--think about an point estimate of
0.5% with a SE of 1% where the CI should not include zero (the true
proportion cannot be zero when the observed proportion is positive).

You may want to look at -help svy_proportion- if the underlying data
is categorical, or -help svy_ratio- if it is a ratio, say of some part
of cost to total cost.

On 6/27/07, Daw, Christina M <[email protected]> wrote:
> How does one make a graph (other than in excel) following a -svy- command such as the following example, in this case a line graph with year on x-axis and mean OOP% (pcoop) on the y-axis?  Is there a source for such instructions, as well as making graphs following regressions from svy commands?  The -svy- commands  do not support -egen- for example.
>
> . svy, subpop(officemh): mean pcoop, over(evyr)
>
> Survey: Mean estimation
>   (excerpt)
> Number of strata =     125          Number of obs    = 1219285
>         --------------------------------------------------------------
>              |             Linearized
>         Over |       Mean   Std. Err.     [95% Conf. Interval]
> -------------+------------------------------------------------
> pcoop        |
>         1996 |   .5349664   .0351149      .4658117    .6041212
>         1997 |   .5258085   .0258162      .4749664    .5766505
>         1998 |   .4167822   .0344434      .3489499    .4846146
>         1999 |   .4005118   .0274386      .3464746     .454549
>         2000 |   .3795007   .0261307      .3280393    .4309621
>


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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