Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: discrete time-varying covariate in cox models


From   "E. Paul Wileyto" <epw@mail.med.upenn.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: discrete time-varying covariate in cox models
Date   Wed, 21 Nov 2007 19:37:05 -0500

Suppose you had 20 event times, and you stsplit your data using a variable called timept. Timept would take on values from 0 to 19. If you also had a variable for the time at which the screening took place (screentime, also =0..19), then you would simply say:

gen screenstatus=screentime>timepoint.

That should do it.

Paul

Daniel O. Koralek wrote:

Maybe I'm still confused. I can split the data easily using stsplit (splitting at failure time). But I guess the problem I then have, is what do I put in the model (i.e. I don't want to put screen0 - screen3 in the model, i just want one variable called screen...). I guess I could split the data by hand, but it seems a bit of a pain (giving entry and exit times at age at each visit and throwing the appropriate screen(n) variable into the new variable "screen"...

Thanks,

Dan



From
"E. Paul Wileyto" <epw@mail.med.upenn.edu>
To
statalist@hsphsun2.harvard.edu
Subject
Re: st: discrete time-varying covariate in cox models
Date
Wed, 21 Nov 2007 12:07:44 -0500
Correct me if I'm wrong, but you can use stsplit to manage the data, even with covariate values that do not change all at the same time. You can create a split at each analysis timepoint without harm (day1, day2, day3...). It may make your survival dataset bulky, but it will manage the risk-set in the appropriate way.
Paul

Daniel O. Koralek wrote:

Hi Maarten,

Thanks for your note. I'm still somewhat confused on the appropriate syntax. My covariate doesn't necessarily change at each time point (i.e. you could have come to a visit but not actually had a screen). I'm going to show some hypothetical data here (the actual data is confidential). the screenage variables contain the age at the corresponding study visit date, and the screen variables contain the number of screens undergone up to and including that same study visit. So, I would like my screening covariate to be equal to the number of screens up to the given analysis time point.

pid iscase entryage exitage screenage0 screenage1 screenage2 screenage3 screen0 screen1 screen2 screen3
1 0 52.0 57.2 52.0 53.1 54.0 55.3 1 2 2 3 2 1 52.5 56.1 52.5 53.7 55.0 55.8 1 2 3 4 3 0 52.4 57.6 52.4 53.4 54.5 56.1 1 2 3 3
....

if i then used this stset command:
stset exitage, failure(iscase==1) enter(time entryage) exit(time exitage) scale(1) id(pid)

the following stsplit, isn't going to do it...
stsplit, at(failure)

i'm totally lost now. would i need to manually split the data into multiple records by pid, with entry and exitages corresponding to the screenage variables and screen variable being the appropriate screen(n)?

Thanks,

Dan





From
Maarten buis <maartenbuis@yahoo.co.uk>
To
statalist@hsphsun2.harvard.edu
Subject
Re: st: discrete time-varying covariate in cox models
Date
Tue, 13 Nov 2007 10:26:44 +0000 (GMT)
--- "Daniel O. Koralek" <dkoralek@unc.edu> wrote:
> Now, what I would like to do is simply control for a single screen
> variable that equals the number of screens that occurred up to the
> analysis time. THe examples that I have seen using stsplit seem to
> only use a single change (in this scenario, up to a certain point
> screen =0 and after screen = 1), not where multiple changes can
> occur.

If a single change occurs than you create a dummy after -stsplit-, if
you have multiple changes you add multiple dummies, or if you
hypothesis a linear effect, a single continuous variable. In all these
cases -stsplit- doesn't know or cares which scenario applies, it works
in exactly the same way.

-- Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Goodhttp://uk.promotions.yahoo.com/forgood/environment.html
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/



Daniel O. Koralek
Department of Epidemiology/Lineberger Comprehensive Cancer Center
The University of North Carolina at Chapel Hill
Chapel Hill, NC 27599-7435
http://www.unc.edu/~dkoralek/
dkoralek@unc.edu




*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

--
E. Paul Wileyto, Ph.D.
Assistant Professor of Biostatistics
Tobacco Use Research Center
School of Medicine, U. of Pennsylvania
3535 Market Street, Suite 4100
Philadelphia, PA 19104-3309

215-746-7147
Fax: 215-746-7140
epw@mail.med.upenn.edu
http://mail.med.upenn.edu/~epw/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/


Daniel O. Koralek
Department of Epidemiology/Lineberger Comprehensive Cancer Center
The University of North Carolina at Chapel Hill
Chapel Hill, NC 27599-7435
http://www.unc.edu/~dkoralek/
dkoralek@unc.edu





*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

--
E. Paul Wileyto, Ph.D.
Assistant Professor of Biostatistics
Tobacco Use Research Center
School of Medicine, U. of Pennsylvania
3535 Market Street, Suite 4100
Philadelphia, PA 19104-3309

215-746-7147
Fax: 215-746-7140
epw@mail.med.upenn.edu
http://mail.med.upenn.edu/~epw/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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