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

Re: st: how to compare weight and unweighted statistics


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: how to compare weight and unweighted statistics
Date   Mon, 23 Sep 2002 09:06:09 +0000

Yap Keng Loong  wrote
> i like to know what commands to use if i want to
> compare weight and unweighted statistics in the
> dataset.

It depends a bit on the number and nature of the statistics you want to 
compare. A general way may be to calculate weighted and unweighted statistics 
and store the results in a postfile. Use the following as a starting point 
and take a look at -help post- for more informations.


--------------------------------------------------
postfile stats weight uweight using myfile, replace  

foreach var of varlist myvars {
     summarize `var' [weight=wvar]    /* Or whatever statistic you like */
     local weight = r(mean)
     summarize `var'
     local uweight = r(mean)
     post stats (`weight') (`uweight')
}

postclose stats

use myfile, clear
gen diff = uweight - weight
list uweight weight diff
-----------------------------------------------------

regards 
uli




-- 
[email protected]
http://www.sowi.uni-mannheim.de/lesas

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