Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: How to find weighted median_st-svy


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to find weighted median_st-svy
Date   Mon, 4 Feb 2013 23:11:08 -0500

The FAQ ask that you demonstrate a claimed problem (show the results), preferably with an accessible data set. With the "page2" data,  I've found no differences in the weighted medians estimated by  -stsum-,  -stdes-, and  -sts graph- .

*************CODE BEGINS*************
webuse page2,clear
set seed 46392
gen pwt = runiform()*100
stset  time [pw =pwt], fail(dead)
stsum
stdes, weight
sts graph, yline(50) xline(233)
**************CODE ENDS**************


Steve

Steven J. Samuels
Consulting Statistician
18 Cantine's Island
Saugerties NY 12477 USA
Voice: 845-246-0774

On Feb 4, 2013, at 9:44 PM, Reda, Ayalu (Alumni) wrote:

Greetings!

I was analyzing the three DHS survey (2000, 2005, and 2011) data on Ethiopia.

The problem I am experiencing is that Stata wouldn't provide me the weighted medians in stsum. I have also tried the stdescribe command but to no avail. I know that there is a problem in these estimates since the values I am getting from the survival curves and the stsum command are different. Given the data, I also expect that the weighted survival times will be numbers with decimals as opposed to the whole numbers that stdescribe and stsum keep providing me.

I think that the the values in the Kaplan-Meier graph are somehow correctly weighted, where as those of the stdescribe and stsum are not.

Is there anyway other way that I could estimate the weighted medians? If this is not possible is there a wisdom in taking the median values of the K-M curve? If yes, how do I precisely do that? 

Many thanks in advance,

P.S:

Here are the commands I applied:

/*...graph and calculate time to first marriage among women who had premarital sex.*/

svyset psuXyear [pweight=weight], strata(waveXstrata)
stset premsexmar2 [pweight=weight], failure(evermarrie)
stsum, by(source)
sort source
by source: stdescribe
sts graph, by(source) xlabel (1(1)6) tmin(0) tmax(7) xline( 3 6, lpattern(shortdash)) xtitle("risk period") title("Kaplan-Meier survival curves of time to first marriage among women who had premarital sex")

********************************************
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index