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

Re: st:


From   [email protected] (Jeff Pitblado, Stata Corp.)
To   [email protected]
Subject   Re: st:
Date   Tue, 21 Jan 2003 11:00:16 -0600

Arnold <[email protected]> asks about comparing a subpopulation mean
to the population mean:

> I would like to estimate a population mean and subpopulation means
> simultaneously, using -svymean- , in order to -svytest- selected subpop
> means against the population mean. Is there a straightforward way to do
> this? Alternatively, can results from one -svymean- estimation be preserved
> for -svytest- while running a second -svymean- estimation?

David <[email protected]> then makes the following suggestion:

> I have a more conceptual comment and suggestion rather than any Stata
> commands.

> I'm assuming that even the whole is a sample.

> It is hard for me (and probably for software) to figure out the right error
> term when comparing a part to the whole.  However, I believe the answer to
> the question "Is the mean of this part different from the mean of the whole"
> is the same as the answer to the question "Is the mean of this part
> different from the mean of the rest of the whole?"  That second question is
> easy to test.  That's how I've done it and suggest doing it.

I can think of two ways that the above can be done:

	1.  -svymean, by()- followed by -test-
	2.  -svyregress-

Here is a short example of each in Stata 8 [mis]using the auto data; -price-
is the variable of interest, and -foreign- is the subpopulation indicator
variable:

***** BEGIN
. sysuse auto, clear
(1978 Automobile Data)

. svyset [pw=weight], psu(rep78)
pweight is weight
psu is rep78

. svyregress price for

Survey linear regression

pweight:  weight                                  Number of obs    =        69
Strata:   <one>                                   Number of strata =         1
PSU:      rep78                                   Number of PSUs   =         5
                                                  Population size  =    209210
                                                  F(   1,      4)  =      0.18
                                                  Prob > F         =    0.6957
                                                  R-squared        =    0.0012

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     foreign |     -263.5   626.6204    -0.42   0.696    -2003.277    1476.277
       _cons |   6617.084   379.1009    17.45   0.000     5564.531    7669.637
------------------------------------------------------------------------------

. svymean price, by(for)

Survey mean estimation

pweight:  weight                                  Number of obs    =        69
Strata:   <one>                                   Number of strata =         1
PSU:      rep78                                   Number of PSUs   =         5
                                                  Population size  =    209210

------------------------------------------------------------------------------
Mean   Subpop. |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------------+--------------------------------------------------------------
price          |
      Domestic |   6617.084    379.1009    5564.531    7669.637     .661794
       Foreign |   6353.584    270.4661     5602.65    7104.519    .2080977
------------------------------------------------------------------------------

. test _b[Domestic] = _b[Foreign]

Adjusted Wald test

 ( 1)  [price]Domestic - [price]Foreign = 0

       F(  1,     4) =    0.18
            Prob > F =    0.6957
***** END


--Jeff
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index