Bookmark and Share

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: How to standardize (and save) a variable with SVY


From   Federico Biagi <[email protected]>
To   statalist <[email protected]>
Subject   st: How to standardize (and save) a variable with SVY
Date   Mon, 6 Feb 2012 15:10:07 +0100 (CET)

Dear Statalist
I am using a complex dataset that requires the use of the svy command (because we have two levels of sampling). In fact I have to use use a replication method (use the brr option). My data also come with sample weights (inverse of probability of being sampled). I have a variable, say X, that I want to standardize. i.e. rescale so that it has mean zero and a standard deviation of 1. If I did not have to use svy the solution would be very simple: compute the sample mean, subtract the mean from every observation and then divide by the standard deviation. With svy things are more complex since:
1) when I compute the mean I do not know how to save it, so I have to copy its value and use it in the subsequent steps (which is cumbersome per se and reduces the exactness of the results) 
2) I do not get an estimate of the standard deviation but only an estimate of the standard error of the mean  (m.s.e) which is related to the sample standard deviation (s.d.) by the relationship 
m.s.e.= s.d. /square root (n)
where n is the number of observations. Again, I do not know how to save the m.s.e. so that I have to manually copy its value in the do file. Then , using the previous formula I have perfomed the necessary steps and I have obtained a variables that looks close to being standardized, but it is not fully so, probably because of rounding errors. 
Do you have any suggestions on how to get to the standardized value using svy in a more precise and less cumbersome way? Please note that zscore does not work with sample weights.

Thank you for your help. 
federico

-- 
Federico Biagi

Prof. Associato in Scienza delle Finanze
Dipartimento di Scienze Economiche "M. Fanno"
Università di Padova
Via del Santo 33
Padova 35123, Italia
Tel: 049-8274203
Fax: 049-8274211
Skype: federico.biagi

Associate Prof. in Public Economics
Department of Economics "M Fanno"
University of Padua
Via del Santo 33
Padova 35123, Italy
Ph: 0039-049-8274203
Fax: 0039-049-8274211
Skype: federico.biagi

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index