s-news
[Top] [All Lists]

[S] function to create df for discrete-time survival analysis

To: s-news@wubios.wustl.edu
Subject: [S] function to create df for discrete-time survival analysis
From: David Atkins <datkins@u.washington.edu>
Date: Wed, 24 Feb 1999 17:05:37 -0800 (PST)
Sender: owner-s-news@wubios.wustl.edu

A colleague of mine is interested in using a discrete-time survival
analysis (not something I'm terribly familiar with) to analyze some data
of hers.  Currently, her data include her predictors, dv (binary relapse
variable), and a weeks to relapse variable.  It looks something like the
following:

id      sex     relapse weeks   (there are other predictors besides sex)
1       male    0       4
2       male    1       2
3       female  1       3
4       female  0       4       (measured over a 4 week period)

She'd like to change her data frame to dummy code weeks and code the
relapse variable to be "positive" in the week they relapsed; so each
subject would have a number of rows equal to their weeks to relapse
variable.  Something like:

id      t1 t2 t3 t4     sex     relapse
1       1  0  0  0      male    0
1       0  1  0  0      male    0
1       0  0  1  0      male    0
1       0  0  0  1      male    0
2       1  0  0  0      male    0
2       0  1  0  0      male    1
3       1  0  0  0      female  0
3       0  1  0  0      female  0
3       0  0  1  0      female  1...

Is there an splus function to transform the first data frame into the
second? (Hope that my explanation was clear enough).

thanks in advance,

Dave Atkins

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] function to create df for discrete-time survival analysis, David Atkins <=