Statalist


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

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


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 16:24:10 +0100

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/



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