Statalist


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

Re: st: Coding time-varying variables in Cox regression


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Coding time-varying variables in Cox regression
Date   Tue, 10 Jun 2008 10:47:31 +0100 (BST)

I misread your question. What you want is unusual, so unusual in fact
that you should realy think very very very hard whether that is realy
what you want (as may be obvious, I doubt that). 

But be that as it may, you can see that as interactions with dummies
for each period, which would result in a value 0 at periods 2-4  for
TREATMENT1, value 0 for periods 1, 3-4 for TREATMENT2, etc.

*------------------- begin example -------------------------------
drop _all
input id   time   died   TREAT1  TREAT2   TREAT3    TREAT4
      1    42     0      5       17       23        8
      2    56     1      9       3        22        16
      3    12     1      7       11       6         .
end
stset time, failure(died) id(id)
stsplit period, at(6 12 24)

forvalues i = 1/4 {
	bys id (period): replace TREAT`i' = 0 if _n != `i'
}
list
*----------------------- end example ----------------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

-- Maarten

--- Allan Garland <agar5858@shaw.ca> wrote:

> Salah,
> 
> Thanks for your answer.  The problem with that solution is that I
> need to separately assess the impact of each treatment.  Any other
> ideas?
> 
> Allan
> *
> *   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/
> 


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


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.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/



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