Statalist


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

st: AW: Mean with confidence intervals for a collapsed data set


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: Mean with confidence intervals for a collapsed data set
Date   Fri, 24 Jul 2009 16:57:39 +0200

<> 

-ssc d parmest- by Roger Newson and -mean- (which does take -iweights-)
could be combined to achieve this, I think


*************
use http://www.stata-press.com/data/r11/psidextract.dta, clear
keep if id<50
//just a dopey xmpl weight
bys id: gen imweights=_n
mean lwage [iweight = imweights], over( id, nolabel)

capt ssc inst parmest
parmest, saving(myfile, replace)

u myfile, clear
keep parm estimate stderr min95 max95
l, noo sep(0)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Johan Hellstrom
Gesendet: Freitag, 24. Juli 2009 16:42
An: statalist@hsphsun2.harvard.edu
Betreff: st: Mean with confidence intervals for a collapsed data set

Dear Statalisters,

For graphing purposes I want to aggregate a panel data set, from unit to
group level, to get a mean value for each group, each year. Nonetheless, I
would also like to have 95 %-confidence intervals (CI) around the calculated
mean. What is making things a bit complicated is that I need to use
(importance) weights when aggregating the data set.

One way of doing this is by using the 'statsby'-program together with the
'ci'-program, but this does not allows importance weights.

statsby mean=r(mean) upper=r(ub) lower=r(lb), saving("C:\....", replace)
by(group year): ci var

Can anyone suggest a solution to get mean values with confidence intervals
using importance weights in this particular case?

Best,
Johan Hellström



*
*   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