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]

RE: st: How to find weighted median_st-svyself-problem_solved


From   "Reda, Ayalu (Alumni)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: How to find weighted median_st-svyself-problem_solved
Date   Tue, 5 Feb 2013 05:27:25 +0100

Dear Steve,
Thank you so much for your quick response!
I just figured out the problem.
Best,


********************************************
________________________________________
From: [email protected] [[email protected]] On Behalf Of Steve Samuels [[email protected]]
Sent: Tuesday, February 05, 2013 7:11 AM
To: [email protected]
Subject: Re: st: How to find weighted median_st-svy

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/

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