Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Aggregated Weighted Summary Statistics Using Probability Weights
From 
 
Lindsay Newman <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: Aggregated Weighted Summary Statistics Using Probability Weights 
Date 
 
Tue, 13 Jul 2010 11:17:09 -0400 
I am using survey data with probability weights.  I want to compute
various summary statistics, including the mean and standard deviation,
of the data at an aggregated level.  In particular, I want to use
individual responses to certain questions to calculate the country
year weighted mean and standard deviation of the response.  For
instance, if 200 individuals responded to a particular question, what
is the weighted average response for that country year?  What is the
weighted standard deviation of the responses for that country year?
When I sort by country year and use the following code:
(1) by countryyear: summarize (response variable) [aw=weight variable]
I get different results for the standard deviations than when I either run:
(2) summarize (response variable) if countryyear ==x [aw=weight variable]
or when I calculate the standard deviation manually using:
(3)  di sqrt(e(N) * el(e(V_srs),1,1))
When I analyze the responses for just one country year (i.e. deleting
all but responses from a single country year) using:
(4) svy: mean (response variable) estat sd,
the standard deviations match 2 and 3 but not 1.  Why is this?
Thank you.
*
*   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/