|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: R: Estimating the probability of censoring
Works perfectly; thanks Nick!
The UCLA example is using old-style -graph syntax- for Stata <8.
You need something more like
twoway line surv1 surv2, c(J ..) sort <etc.>
Nick
[email protected]
Michael McCulloch wrote:
Antoine, thank you also for pointing out that example web page.
I attempt to re-create their graph using
graph surv1 surv2, s(..) c(JJ) sort ylab(0 .1 to 1) xlab(0 200 to 1200)
but receive the error message:
"surv1graph_g.new surv2, s(..) c(JJ) sort ylab(0 .1 to 1) xlab(0
200 to 1200): class member
function not found"
I'm using v9.2. Might that be the problem?
Michael
using predicted baseline survival function sounds like a better
idea (from
http://www.ats.ucla.edu/stat/stata/seminars/stata_survival/default.htm#graphs)
:
stcox drug age, nohr bases(surv0)
gen cens_adj2=surv0^(exp(coeff_cens))
list id drug age died cens p_cens cens_adj2 in 40/48, clean noobs
id drug age died cens p_cens cens_a~2
40 3 50 0 .58476475 .8601028 .6717925
41 3 55 1 .58476475 .9429854 .6465274
42 3 57 1 .51166915 .9783332 .5577559
43 3 48 0 .51166915 .8290267 .6097336
44 3 56 0 .34111277 .9604967 .3796235
45 3 60 1 .34111277 1.033855 .3525544
46 3 62 0 .22740851 1.072609 .2088839
47 3 48 0 .11370426 .8290267 .1545282
48 3 52 0 0 .8923438 0
Antoine Terracol wrote:
I might be missing something, but isn't the correct way to do
this more like (the part where I generate cens_adj):
sysuse cancer.dta, clear
gen id = _n // generate individual IDs
stset studytime, failure(died==0) // note that total
person-time is 744
*estimate the unadjusted probability of censoring
sts gen cens = s
*estimate the adjusted probability of censoring
stcox drug age, nohr basec(cum)
predict coeff_cens, xb // predicts linear coefficients
of censoring
gen p_cens = exp(coeff_cens) // adjusted probability of
time-to-censoring
gen cens_adj=exp(-cum*exp(coeff_cens))
*lists the results
list id drug age died cens p_cens cens_adj in 40/48, clean noobs
id drug age died cens p_cens cens_adj
40 3 50 0 .58476475 .8601028 .6811302
41 3 55 1 .58476475 .9429854 .6563864
42 3 57 1 .51166915 .9783332 .5705886
43 3 48 0 .51166915 .8290267 .6216006
44 3 56 0 .34111277 .9604967 .4199265
45 3 60 1 .34111277 1.033855 .3930005
46 3 62 0 .22740851 1.072609 .2585016
47 3 48 0 .11370426 .8290267 .2171345
48 3 52 0 0 .8923438 .0710848
*
* 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/
*
* 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/