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

From |
Richard Palmer-Jones <richard.palmerjones@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: RE: Useing e(over_labels) |

Date |
Fri, 10 Jul 2009 17:52:23 +0100 |

I should add that I want graphs for depvar on xvar for each region with CIs (in this hypothetical case) - and the actual design has many more values of X (50 or more) and 9 or thereabouts "regions". On Fri, Jul 10, 2009 at 5:41 PM, Richard Palmer-Jones<richard.palmerjones@gmail.com> wrote: > I see I should have looked at the decimal places.I can get the right > labels by doing the approriate substr(). Obviously I need a more > appriate formula for the CIs! > > On this occasion I want to draw CI graphs with the survey adjusted > CIs., without having to go manual. > > RIchard > > > On Fri, Jul 10, 2009 at 5:18 PM, Austin Nichols<austinnichols@gmail.com> wrote: >> Richard Palmer-Jones<richard.palmerjones@gmail.com>: >> There are a variety of ways to loop over categories and collect >> results, but note that the approach you give does not agree with the >> results of -svy:mean- (check your CIs), and does not collect the >> values of categorical variables (e.g. NE and E both become E). My >> question stands--what do you want this for? The goal dictates the >> preferred method. For example, if you wanted to write out a formatted >> table, an easy way to go is to use -estout- e.g. >> >> use nhanes2, clear >> la def smsa 1 "City" 2 "Noncity SMSA" 4 "NonSMSA" >> la val smsa smsa >> egen subpop=group(smsa region), label >> svy: mean bpsystol, over(subpop) nohe noleg >> qui ta subpop, gen(i_) label >> qui svy: reg bpsystol i_*, nocons >> eststo smsa >> esttab smsa, nogap varw(25) la b(%9.4f) ci(%9.4f) nostar >> >> or to an MSWord file: >> >> esttab smsa using t.doc, rtf nogap varw(25) la b(%9.4f) ci(%9.4f) nostar >> >> On Fri, Jul 10, 2009 at 11:24 AM, Richard >> Palmer-Jones<richard.palmerjones@gmail.com> wrote: >>> Sorry, I was taking a short cut - yes I want the ses - my problem >>> was/is to access the e(over_labels) which consist of two comonents >>> separated by a space. >>> >>> So to add ses I can >>> >>> ..... >>> mat ev = vecdiag(e(V))' >>> mat eb = e(b)' >>> mat en = e(_N)' >>> mat evn = eb,ev,en >>> >>> drop _all >>> svmat evn >>> gen row = "" >>> forval o = 1/`c(N)' { >>> local r : label g `o' >>> replace row = "`r'" in `o' >>> } >>> gen var1 = substr(row, 1, 2) >>> gen var2 = substr(row, -1, 1) >>> gen lb = evn1 - invttail(evn3-1,0.025) * (evn2^0.5 * sqrt(evn3) / sqrt(evn3)) >>> gen ub = evn1 + invttail(evn3-1,0.025) * (evn2^0.5 * sqrt(evn3) / sqrt(evn3)) >>> >>> gives me the ses >>> >>> But I am disappointed I cannot captuer the over_labels in am ore >>> elegant way, and was just thinking there must be a way to parse the >>> e(over_labels) macro in a better way. but the spaces between "NE and >>> "1`" were defeating me until I came upon the "local r : label >>> labelname # " wheeze. >>> >>> So, expecting enlightenment >>> On Fri, Jul 10, 2009 at 3:02 PM, Austin Nichols<austinnichols@gmail.com> wrote: >>>> Richard Palmer-Jones<richard.palmerjones@gmail.com>: >>>> >>>> I don't understand--if indeed you only want the weighted means and not >>>> the SEs, then use -collapse- and get there in one line, and note that >>>> pweights and aweights are equivalent if you do not need SEs. What do >>>> you need this dataset of summary stats for, anyway? The goal dictates >>>> the preferred method, in general. My point was just that the labels >>>> (both numeric and string) for the -over- variable are easy to access. >>>> >>>> Also, it looks like in your original post you said "I want to compuile >>>> the ereturned e(b) and e(v) results of a -mean var1, over(var2 var3, >>>> nolabel)- into a usable form, such as rows in new variables or a >>>> matrix, together with the relevatn values of var2 & var3" so a matrix >>>> is what you asked for... >>>> >>>> On Fri, Jul 10, 2009 at 9:35 AM, Richard >>>> Palmer-Jones<richard.palmerjones@gmail.com> wrote: >>>>> and then extracting the two values gives me the result I wan - a file >>>>> with the resulsts of svy: mean .. , over() >>>>> >>>>> | v1 row var1 var2 | >>>>> |-------------------------------| >>>>> 1. | 125.7034 NE 1 NE 1 | >>>>> 2. | 127.8939 NE 2 NE 2 | >>>>> 3. | 129.4605 NE 4 NE 4 | >>>>> 4. | 126.8856 MW 1 MW 1 | >>>>> 5. | 126.381 MW 2 MW 2 | >>>>> +-------------------------------+ >>>>> >>>>> >>>>> I am sure there are more elegant ways to do this, but I cannot get the >>>>> more obvious ones to work for reasons I am sure are obvious to adpets. >> >> * >> * 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/

**Follow-Ups**:**st: Insheet with dictionary***From:*Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>

**Re: st: RE: RE: Useing e(over_labels)***From:*Austin Nichols <austinnichols@gmail.com>

**References**:**st: Useing e(over_labels)***From:*Richard Palmer-Jones <richard.palmerjones@gmail.com>

**Re: st: RE: RE: Useing e(over_labels)***From:*Richard Palmer-Jones <richard.palmerjones@gmail.com>

**RE: st: RE: RE: Useing e(over_labels)***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: RE: Useing e(over_labels)***From:*Austin Nichols <austinnichols@gmail.com>

**RE: st: RE: RE: Useing e(over_labels)***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: RE: Useing e(over_labels)***From:*Richard Palmer-Jones <richard.palmerjones@gmail.com>

**Re: st: RE: RE: Useing e(over_labels)***From:*Austin Nichols <austinnichols@gmail.com>

**Re: st: RE: RE: Useing e(over_labels)***From:*Richard Palmer-Jones <richard.palmerjones@gmail.com>

**Re: st: RE: RE: Useing e(over_labels)***From:*Austin Nichols <austinnichols@gmail.com>

**Re: st: RE: RE: Useing e(over_labels)***From:*Richard Palmer-Jones <richard.palmerjones@gmail.com>

- Prev by Date:
**Re: st: RE: RE: Useing e(over_labels)** - Next by Date:
**Re: st: RE: RE: Useing e(over_labels)** - Previous by thread:
**Re: st: RE: RE: Useing e(over_labels)** - Next by thread:
**Re: st: RE: RE: Useing e(over_labels)** - Index(es):

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