Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Feature of -svymean-


From   Roger Newson <roger.newson@kcl.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Feature of -svymean-
Date   Fri, 16 Aug 2002 17:47:15 +0100

Dear All

I have been informed (by Dan Blanchette of the University of North Carolina) that the -svymean- command has the feature that the estimation results -e(b)- and -e(V)- do not always contain the estimates and the covariance matrix of the estimates, respectively. This worries me, because, in writing my -parmest- package, I have assumed that -e(b)- always contains the estimates, and that -e(V)- always contains the covariance estimates. If this assumption is false, then -parmest- will either crash or give the wrong results.

An example of this feature was found by Dan Blanchette in the -auto- data, in which both -e(b)- and -e(V)- can be 1x1 matrices of zeros in the presence of user-inserted missing values in the data. I have reproduced this example below. As it happens, the feature can be fixed by including the -complete- option of -svymean-, and I have also reproduced this below. However, it is surprising that there are any -eclass- commands at all for which -e(b)- and -e(V)- are not the estimates and their covariance, respectively. Is this feature of -svymean- supposed to be there? And, if so, what is Stata's true policy on estimation results, so I can think of a way for -parmest- to work around it (or warn users in the .hlp file)?

Thanks in advance

Roger

. **** Without -complete- ****
. use c:\stata\auto,clear
(1978 Automobile Data)

. replace mpg=. if rep78==1
(2 real changes made, 2 to missing)

. svymean mpg weight,by(foreign)

Survey mean estimation

pweight: <none> Number of obs(*) = 74
Strata: <one> Number of strata = 1
PSU: <observations> Number of PSUs = 74
Population size = 74

------------------------------------------------------------------------------
Mean Subpop. | Estimate Std. Err. [95% Conf. Interval] Deff
---------------+--------------------------------------------------------------
mpg |
Domestic | 19.78 .6760022 18.43209 21.12791 1
Foreign | 24.77273 1.386767 22.00759 27.53786 1
---------------+--------------------------------------------------------------
weight |
Domestic | 3317.115 96.14976 3125.489 3508.742 1
Foreign | 2315.909 90.80981 2134.925 2496.893 1
------------------------------------------------------------------------------
(*) Some variables contain missing values.

. esti list

scalars:
e(N) = 74
e(N_strata) = 1
e(N_psu) = 74
e(N_pop) = 74
e(n_by) = 2

macros:
e(cmd) : "svymean"
e(list) : "mpg weight"
e(missing) : "missing"
e(complete) : "available"
e(depvar) : "Mean"
e(label) : "label"
e(by) : "foreign"

matrices:
e(b) : 1 x 1
e(V) : 1 x 1
e(meft) : 1 x 4
e(deft) : 1 x 4
e(deff) : 1 x 4
e(V_msp) : 1 x 4
e(error) : 1 x 4
e(_N_psu) : 1 x 4
e(_N_str) : 1 x 4
e(_N_subp) : 1 x 4
e(_N) : 1 x 4
e(V_srs) : 1 x 4
e(V_db) : 1 x 4
e(est) : 1 x 4

functions:
e(sample)

. mat list e(b)

symmetric e(b)[1,1]
dummy
y1 0

. mat list e(V)

symmetric e(V)[1,1]
dummy
dummy 0

. **** With -complete- ****
. use c:\stata\auto,clear
(1978 Automobile Data)

. replace mpg=. if rep78==1
(2 real changes made, 2 to missing)

. svymean mpg weight,by(foreign) complete

Survey mean estimation

pweight: <none> Number of obs = 72
Strata: <one> Number of strata = 1
PSU: <observations> Number of PSUs = 72
Population size = 72

------------------------------------------------------------------------------
Mean Subpop. | Estimate Std. Err. [95% Conf. Interval] Deff
---------------+--------------------------------------------------------------
mpg |
Domestic | 19.78 .6760022 18.43209 21.12791 1
Foreign | 24.77273 1.386767 22.00759 27.53786 1
---------------+--------------------------------------------------------------
weight |
Domestic | 3325.8 99.25786 3127.885 3523.715 1
Foreign | 2315.909 90.82709 2134.805 2497.013 1
------------------------------------------------------------------------------

. esti list

scalars:
e(df_r) = 71
e(N) = 72
e(N_strata) = 1
e(N_psu) = 72
e(N_pop) = 72
e(n_by) = 2

macros:
e(cmd) : "svymean"
e(list) : "mpg weight"
e(complete) : "complete"
e(depvar) : "Mean"
e(label) : "label"
e(by) : "foreign"

matrices:
e(b) : 1 x 4
e(V) : 4 x 4
e(V_db) : 4 x 4
e(est) : 1 x 4
e(meft) : 1 x 4
e(deft) : 1 x 4
e(deff) : 1 x 4
e(V_msp) : 4 x 4
e(error) : 1 x 4
e(_N_subp) : 1 x 4
e(_N) : 1 x 4
e(V_srs) : 4 x 4

functions:
e(sample)

. mat list e(b)

e(b)[1,4]
mpg: mpg: weight: weight:
Domestic Foreign Domestic Foreign
y1 19.78 24.772727 3325.8 2315.9091

. mat list e(V)

symmetric e(V)[4,4]
mpg: mpg: weight: weight:
Domestic Foreign Domestic Foreign
mpg:Domestic .45697893
mpg:Foreign 0 1.9231225
weight:Domestic -58.653106 0 9852.1222
weight:Foreign 0 -86.009566 0 8249.5603

.


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: roger.newson@kcl.ac.uk

Opinions expressed are those of the author, not the institution.

*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index