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]

From |
Austin Nichols <austinnichols@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: stcompet cumulative incidence graphs with wrong time units |

Date |
Mon, 14 Apr 2014 05:37:54 -0400 |

Roxanne <roxanne.beauclair@gmail.com> _t is measuring time at risk, but when you subtract off the entry date, you are no longer measuring time at risk but time observed in your study before failure or censoring, which is not the same thing at all. Perhaps you need to change the -format- of your time variable (though I can't see how it got a date format): set scheme s2mono stset spellend, failure(breakconcur==1) enter(time relbegin) keep if race==1 & gender==1 stcompet ciBF=ci, compet1(2) sort _t format _t %2.1g line ciCM _t if breakconcur==1||line ciCM _t if breakconcur==2 On Mon, Apr 14, 2014 at 4:08 AM, ROXANNE BEAUCLAIR <roxanne.beauclair@gmail.com> wrote: > Hi Austin, > > Thank you for your reply. Unfortunately, when I use the publicly > available data, I do not have the same problems that I have with my > own. But perhaps I can give you a better description for my data. > > I'm trying to look at the probability of a monogamous relationship > becoming concurrent with another relationship (the person acquires > another simultaneous sexual relationship). I have data on > relationships that occurred in the previous year, but not before that. > So a monogamous relationship can: 1)Stay monogamous for the entire > year, or period of observation (censored) or 2) break up during the > year of observation (competing event) or 3) Become concurrent (event > of interest). I have the date the event occurred (spellend) and the > variable that indicates the events (breakconcur). Because we do not > have information on the concurrency status of relationships before the > period of observation, there is left truncated data for the > relationships that began before our period of observation. I'm trying > to get graphs of the cumulative incidence of the event of interest and > the competing event in one plot. Furthermore, I want these plots for > different demographics (e.g. 1 plot for black women, 1 plot for black > men, etc). Here is my code: > > stset spellend, failure(breakconcur==1) enter(time relbegin) > keep if race==1 & gender==1 /*I want to do a graph of only black women */ > stcompet ciBF=ci, compet1(2) > twoway (line ciCM _t if breakconcur==1, sort lcolor(black) > lpattern(solid))(line ciCM _t if breakconcur==2, sort lcolor(black) > lpattern(dash)) > > When I do this, I seem to get a nice looking graph. However, the > x-axis has dates rather than the time to event, which is what I want. > Currently the '_t' variable Stata produces is in a date format. Is > there any easy way to re-format this as time-to-event? If i plot my > lines with my own generated time-to-event variable [gen tte=(_t - > _t0)], then the x-axis looks fine but my lines zig-zag up and down and > I do not get a nice curve that increases. > > Any further words of advice? > > Thanks for your help. > > On Fri, Apr 11, 2014 at 3:14 PM, Austin Nichols <austinnichols@gmail.com> wrote: >> ROXANNE BEAUCLAIR <roxanne.beauclair@gmail.com>: >> >> You should clarify what you mean by left truncation. I assume you >> mean that people enter the study after having been at risk for some >> time, but in that case you should not be specifying the enter and >> origin dates using the same variable, right? >> >> Dates on the x-axis are presumably a function of the format of your >> x-axis variable; show us the results of the -describe- command applied >> to your data. >> >> Can you show an example of your problem using public data e.g. >> >> webuse hypoxia, clear >> set seed 1 >> g fakentry=dftime*uniform() >> stset dftime, failure(failtype==1) enter(time fakentry) >> stcrreg ifp tumsize pelnode, compete(failtype==2) >> stcurve, cumhaz >> stset dftime, failure(failtype==1) enter(time fakentry) >> cap ssc inst stcompet >> stcompet ci=ci, compet1(2) >> sort _t >> line ci _t if failtype==1, name(s1, replace) >> stset dftime, failure(failtype==1) enter(time fakentry) origin(time fakentry) >> stcompet ci=ci, compet1(2) >> sort _t >> line ci _t if failtype==1, name(s2, replace) >> >> (in this data origin should be zero, and I made up data on observed entry). >> >> >> On Fri, Apr 11, 2014 at 5:31 AM, ROXANNE BEAUCLAIR >> <roxanne.beauclair@gmail.com> wrote: >>> Greetings statalisters, >>> >>> I am trying to make a graph of cumulative incidence for my two >>> competing events using stcompet. My data has left truncation so I have >>> to specify the 'entry' date when I stset my data. This is an example >>> of the code: >>> >>> stset spellend, failure(breakconcur==1) enter(time enterdate) >>> stcompet ci=ci, compet1(2) >>> twoway (line ci _t if breakconcur==1, sort lcolor(black) >>> lpattern(solid))(line ci _t if breakconcur==2, sort lcolor(black) >>> lpattern(dash)) >>> >>> Whenever I do this, the x-axis produces stata dates. However, I would >>> like it to be in days at risk. >>> >>> When I stset my data by also specifying an origin, e.g.: >>> >>> stset spellend, failure(breakconcur==1) origin(time enterdate) >>> enter(time enterdate)] >>> >>> In this case, I get the days at risk on my x-axis, but the graph >>> produces this weird upwards steep tail for my competing risk. I'm not >>> sure why its doing this in this case, but not when there are dates on >>> the x-axis. >>> >>> Can anyone tell me how I can fix this problem? >>> >>> Warm Regards, >>> -- >>> Roxanne Beauclair MA, MPH, PhD Candidate >>> International Centre for Reproductive Health (ICRH) >>> Ghent University, Belgium >>> www.icrh.org >>> >>> The South African Department of Science and Technology / National >>> Research Foundation (DST/NRF) >>> Centre of Excellence in Epidemiological Modelling and Analysis (SACEMA) >>> Stellenbosch University, South Africa >>> www.sacema.com >> * >> * 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/ > > > > -- > Roxanne Beauclair MA, MPH, PhD Candidate > International Centre for Reproductive Health (ICRH) > Ghent University, Belgium > www.icrh.org > > The South African Department of Science and Technology / National > Research Foundation (DST/NRF) > Centre of Excellence in Epidemiological Modelling and Analysis (SACEMA) > Stellenbosch University, South Africa > www.sacema.com > > Tel: +27 21 808 9236 (work) > Cell: +27 82 212 1621 (cell) > * > * 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/

**References**:**st: stcompet cumulative incidence graphs with wrong time units***From:*ROXANNE BEAUCLAIR <roxanne.beauclair@gmail.com>

**Re: st: stcompet cumulative incidence graphs with wrong time units***From:*Austin Nichols <austinnichols@gmail.com>

**Re: st: stcompet cumulative incidence graphs with wrong time units***From:*ROXANNE BEAUCLAIR <roxanne.beauclair@gmail.com>

- Prev by Date:
**Re: st: stcompet cumulative incidence graphs with wrong time units** - Next by Date:
**Re: st: Question about tesitng coefficients in the cointegrating equation with the VEC command** - Previous by thread:
**Re: st: stcompet cumulative incidence graphs with wrong time units** - Next by thread:
**st: re: standardized betas with nlcom** - Index(es):