Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Steve Samuels <sjsamuels@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: adjusting hazard ratios in st cox using offset |
Date | Wed, 17 Oct 2012 18:15:05 -0400 |
/*You have an interesting problem, but your proposal is flawed. Consider the following simplified table for two procedures: | proc_b proc_a | 0 1 | Total -----------+----------------------+---------- 0 | . 5 | 5 1 | 5 6 | 11 -----------+----------------------+---------- Total | 5 11 | 16 You would like your model results to look like this: proc_A 1.0 proc_B ? But this is impossible: with three groups you need two indicator variables. Here is an example. You have to define what you mean by "effect of proc_B adjusted for proc_A." My suggestion would be to partition the data into two groups, those with procedure A and those without procedure A. Steve ***********Code Begins********************* capture program drop _all clear input proc_a proc_b 1 0 1 1 0 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 end // define 3 groups gen g10 = proc_a==1 & proc_b==0 gen g01 = proc_a==0 & proc_b==1 gen g11 = proc_a==1 & proc_b==1 set seed 5503211 gen stime = max(_n + 5*runiform(),1) stset stime stcox g10 g01 g11, nohr nolog //3 indicators "g11" dropped stcox proc_a proc_b, nohr nolog // 2 indicators stcox proc_b if proc_a==1, nohr nolog // the following doesn't work with only 2 procedures stcox proc_b if proc_a==0, nohr nolog ************************************************ > On Oct 16, 2012, at 12:31 AM, Will Schairer wrote: > > Hi all, > > I have a dataset of procedures multiple follow-up events with an outcome of > a complication. There are a few procedures, proc_A, proc_B, proc_C, proc_D, > proc_E, which are all 0 -no- or 1 -yes-. > > I'm trying to create an stcox model where the hazard ratios are in > reference to one of the procedures. Normally it would be fine just to set > "proc" = 1,2,3,4, or 5, and use the i.proc. However, in this data there can > be multiple procedures occurring in each visit, so I can't set just one > variable like stcox i.proc > > So, I have: > var HR > age > gender > proc_A 0.7 > proc_B 1.2 > proc_C 3.4 > proc_D 3.2 > proc_E 2.5 > > and I'd like to have: > var HR > age > gender > proc_A 1.0 > proc_B ? > proc_C ? > proc_D ? > proc_E ? > > so that the ?'s are relative to proc_A = 1.0. > > ok so my question is, can I use -stcox- age gender B C D E, offset(A) as a > way to normalize the other procedures to A? I have not found a good > detailed resource on offset, but my understanding is that it is an exposure > adjustment, so in a sense I'd be adjusting for exposure to proc A with HR = > 1.0. Or, is there another way to do this? > * * 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/