--- In statalist, Andreas Stiehler wrote:
> do you know a way to save Std.Error and Conf.interval of a "svymean"
> operation (see below) as matrices or scalars?
-svymean- is an estimation command, so it leaves a bunch of stuff in
the -ereturn- values. This is my weird example with auto data (I was
asking for a "standard" toy data set with complex enough sampling
design, but don't remember if any such data set in public use actually
arose then):
. sysuse auto
(1978 Automobile Data)
. svyset [pw=turn] , psu(rep)
pweight is turn
psu is rep78
. svymean pri
Survey mean estimation
pweight: turn Number of obs = 69
Strata: <one> Number of strata = 1
PSU: rep78 Number of PSUs = 5
Population size = 2746
------------------------------------------------------------------------------
Mean | Estimate Std. Err. [95% Conf. Interval] Deff
---------+--------------------------------------------------------------------
price | 6251.806 204.7158 5683.423 6820.188 .3211447
------------------------------------------------------------------------------
. eret li
scalars:
e(df_r) = 4
e(N) = 69
e(N_strata) = 1
e(N_psu) = 5
e(N_pop) = 2746
macros:
e(cmd) : "svymean"
e(predict) : "svy_x_p"
e(varlist) : "price"
e(complete) : "complete"
e(depvar) : "Mean"
e(psu) : "rep78"
e(wexp) : "= turn"
e(wtype) : "pweight"
matrices:
e(b) : 1 x 1
e(V) : 1 x 1
e(V_db) : 1 x 1
e(est) : 1 x 1
e(error) : 1 x 1
e(_N) : 1 x 1
e(_N_subp) : 1 x 1
e(V_msp) : 1 x 1
e(V_srs) : 1 x 1
e(meft) : 1 x 1
e(deft) : 1 x 1
e(deff) : 1 x 1
functions:
e(sample)
. di _b[price]
6251.8055
. di _se[price]
204.71576
. mat li e(b)
symmetric e(b)[1,1]
price
y1 6251.8055
. mat li e(V)
symmetric e(V)[1,1]
price
price 41908.543
. mat li e(deff)
symmetric e(deff)[1,1]
price
r1 .32114473
So you can save them for later use as
scalar mean = _b[price]
scalar semean = _se[price]
etc. More advanced methods of dealing with estimation results are due
to Roger Newson and his idea of estimation sets. -findit parmest- to
find more.
--
Stas Kolenikov
http://stas.kolenikov.name
*
* 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/