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: Checking goodness of fit of stcox when using the tvc() option
From
[email protected]
To
Statalist <[email protected]>
Subject
st: Checking goodness of fit of stcox when using the tvc() option
Date
Fri, 19 Jul 2013 15:52:45 +0800
Hello Nicole,
Ah, it looks like -stcurve- isn't compatible with -tvc-....
So, I'd be tempted to do -stsplit- and a Poisson model, the IRRs
should be essentially identical to your HRs.
http://biostat.mc.vanderbilt.edu/wiki/pub/Main/LisaKaltenbach/poissonregtalk.pdfest
then a GOF test for that (see also Dupont 'Statistical Modeling for
Biomedical Res').
Another option using -stpm2- :
************ Begin example ************
use http://www.stata-press.com/data/r13/drugtr, clear
stcox drug age, tvc(age)
* generate KM survival for each level
sts gen km1 = s if (drug == 0)
sts gen km2 = s if (drug == 1)
* Flex parametric model
stpm2 drug age, eform scale(haz) df(1) tvc(age) dftvc(1)
estat ic
* predict at mean population levels
* see "Flexible Parametric Survival Analysis Using Stata: Beyond the
Cox Model", chap 6-7
* Note: need to generate explicit dummy vars for each categorical var
sum age,, if drug
sum age,, if ! drug
predict double surv1, surv at(age 56.05 drug 0)
predict double surv2, surv at(age 55.75 drug 1)
twoway (line surv1 _t, sort lpattern(solid) lcolor(maroon)) ///
(line km1 _t, sort c(J) lpattern(longdash) lcolor(maroon)) ///
(line surv2 _t, sort lpattern(solid) lcolor(navy)) ///
(line km2 _t, sort c(J) lpattern(longdash) lcolor(navy)), ///
legend(label (1 "No drug") label (3 "Drug")) legend(order(1 3)) ///
note("Solid = Flex para. models; Dash= Kaplan-Meier", size(medlarge))
************ End example ************
cheers-
Andrew Lover
___________________________________________________________
Epidemiologist
Centre for Infectious Disease Epidemiology Research (CIDER)
Saw Swee Hock School of Public Health
National University of Singapore
*
* 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/