Statalist


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

Re: st: comparing the means of two variables(not groups) for suvey data


From   "Joao Ricardo F. Lima" <jricardofl@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: comparing the means of two variables(not groups) for suvey data
Date   Wed, 19 Aug 2009 10:39:42 -0300

Mandy,

just do this

*******
use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear
svyset [pw=socst], strata(ses)
svy:mean read write
lincom read-write
********

. svy:mean read write
(running mean on estimation sample)

Survey: Mean estimation

Number of strata =       3          Number of obs    =     200
Number of PSUs   =     200          Population size  =   10481
                                    Design df        =     197

--------------------------------------------------------------
             |             Linearized
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
        read |   53.52886   .7118855      52.12497    54.93276
       write |   53.94352   .6205423      52.71976    55.16728
--------------------------------------------------------------

. lincom read-write

 ( 1)  read - write = 0

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.4146551   .6194956    -0.67   0.504    -1.636349    .8070392
------------------------------------------------------------------------------

HTH,

Joao Lima

2009/8/18 Mandy fu <mandy.fu1@gmail.com>:
> Hi all,
>
> Previous discussion of comparing means in survey data are focus on two
> groups. I am interested in comparing means of two variables in survey
> data.
>
> For example, in the following data set for students test scores, I'd
> like  to compare the population means of "read" and "write". I was
> wondering , since the probability weight for each student is constant,
> if  it is fine that  I just use t test? If I need to use probability
> weight, how to do that after the survey mean estimation?
>
> I tried --svy:mean-- and then use--lincom--. But since there seems
> always some errors message.
> ---------------------------------------------
> use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear
> svyset [pw=socst], strata(ses)
>      *** t test
> ttest read=write
>     ***svy and lincom
> svy:mean read
> matrix B=e(b)
> svmat B
> svy:mean write
> matrix C=e(b)
> svmat C
> lincom B C
> **regressor B1 not found
> **r(111);
> ------------------------------------
> Thanks for your help!
>
> Mandy
> *
> *   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/
>



-- 
----------------------------------------
Joao Ricardo Lima, D.Sc.
Professor
UFPB-CCA-DCFS
Fone: +5538387264913
Skype: joao_ricardo_lima
----------------------------------------

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