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

st: Re: Re: t-tests for differences in means using pweights

From   "Scott Merryman" <>
To   <>
Subject   st: Re: Re: t-tests for differences in means using pweights
Date   Thu, 26 Jun 2003 20:22:33 -0500

----- Original Message ----- 
From: <>
To: <>
Sent: Thursday, June 26, 2003 10:33 AM
Subject: st: Re: t-tests for differences in means using pweights

> I don't think my original posting was clear enough.  What I have are two
> samples, one from the first wave of a survey and the other from the next
> In each wave respondents were asked the same question, and I'm looking at
> aggregate means on this question for each wave of the survey.  I'm trying
> determine whether the difference in the mean value of the variable among
> respondents in the first wave is significantly different from the mean
> respondents in the second wave (after weighting the responses with
> The problem is that the samples are unique, so I can't use the "svymean"
> or "svylc" commands, but I also can't use the "ttest" command b/c it does
> accept pweights.  I hope this is clearer than the first post below, and
again I
> would appreciate any thoughts.  Thanks in advance.
> Pat Sharkey
> Doctoral student in Sociology and Social Policy
> Harvard University

How about using a dummy variable and svyreg.  Using the auto dataset,
suppose sample 1 is the price of car domestic cars and sample 2 is the price
of foreign cars and the sampling weight is the weight variable.

. use "C:\Stata8\auto.dta", clear
(1978 Automobile Data)

. svyset [w=weight]
(sampling weights assumed)
pweight is weight

. svyreg price for

Survey linear regression

pweight:  weight                                  Number of obs    =
Strata:   <one>                                   Number of strata =
PSU:      <observations>                          Number of PSUs   =
                                                  Population size  =
                                                  F(   1,     73)  =
                                                  Prob > F         =    0.72
                                                  R-squared        =

       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
     foreign |   298.4742   833.3626     0.36   0.721    -1362.415
       _cons |   6500.577   503.7304    12.90   0.000     5496.644

The t-stat on the dummy variable tests if the mean price of foreign cars is
equal to the mean price of domestic cars.
So, the null hypothesis of Ho: mean(Domestic) - mean(Foreign) = 0 can be
rejected at usual significance levels.


*   For searches and help try:

© Copyright 1996–2019 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index