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 on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: RE: Using the predictnl command following a model containing restricted cubic splines and time-dependent effects


From   "Turnbull, Alison E." <aturnbul@jhsph.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Using the predictnl command following a model containing restricted cubic splines and time-dependent effects
Date   Fri, 5 Oct 2012 17:22:53 -0400

Thank you!   That is even easier than I expected.
You have made my weekend.

-alison

Date: Thu, 4 Oct 2012 09:54:18 +0100
From: "Lambert, Paul C. (Dr.)" <pl4@leicester.ac.uk>
Subject: st: RE: Using the predictnl command following a model containing restricted cubic splines and time-dependent effects

Alison,

You can make use of the hrnumerator() and hrdenominator() options of stpm2's predict command. 

Below is an example for a model with a dichotomous and continuous covariate.

One think to note is that stpm2 models on the log cumulative hazard scale. The time-dependent hazard ratio for one of the covariates will depend on the value of other time-dependent covariates. This would not happen with models on the log hazard scale (unless of course you fitted an interaction). The differences are usually small, but it is something you should be aware of. I demonstrate this by obtaining predictions for the effect of  the dichotomous covariate (hormon) at different levels of the continuous covariate (age) and similarly for the hazard ratio for age.  

Paul


webuse brcancer, clear
stset rectime, f(censrec==1) scale(365.25)
rename x1 age
stpm2 hormon age, scale(hazard) df(4) tvc(hormon age) dftvc(2)

/* hazard ratio for hormon at age 40 and 60 */
predict hr1, hrnum(hormon 1 age 40) hrdenom(hormon 0 age 40) ci
predict hr2, hrnum(hormon 1 age 70) hrdenom(hormon 0 age 70) ci

line hr1* hr2* _t ,sort yscale(log)

/* hazard ratio for age at time 1*/
/* age 50 is set as the reference age */
gen t1=1
predict hr3, hrnum(hormon 0 age .) hrdenom(hormon 0 age 50) timevar(t1) ci
predict hr4, hrnum(hormon 1 age .) hrdenom(hormon 1 age 50) timevar(t1) ci
line hr3 hr4 age, sort yscale(log)

Dr Paul C Lambert
Reader in Medical Statistics
Centre for Biostatistics & Genetic Epidemiology
Department of Health Sciences 
University of Leicester
2nd Floor, Adrian Building
University Road 
Leicester LE1 7RH
Tel: +44 (0)116 229 7265, Fax: +44 (0)116 229 7250
e-mail: paul.lambert@le.ac.uk
Homepage: http://www2.le.ac.uk/Members/pl4/





*
*   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