Dear Jose,
If I understand your question correctly, you are trying to estimate a
competing risks model with multiple events per subject (time-varying
covariates).
As you say, the first part involves estimating J different models, where you
create J different event (censor) variables. For the jth model, the
variable will take on a value of 1 if the jth event occurs and 0 if not
(either the subject is truly censored or one of the other J-1 events
occurred).
As for the multiple events per subject part, R handles this in a similar way
to Stata. Each record per subject consists of an interval with a start time
and an end time. Therefore, you need start time, stop time, and event
variables on the left hand side of the formula in the Surv() function.
Start time is either numerical or a date that indicates the beginning of an
interval, stop time indicates the end of an interval, and event is the event
variable indicating whether an event occurs at the end of the interval.
There is no need for an id() variable in R. Strictly speaking, the
estimation of the model does not require knowledge of which subject each
record belongs to. What is important are the start and stop times and the
event variable. See help("Surv") for more details, including how to deal
with other types of censoring.
So sample syntax for Zelig would be:
z.out <- zelig( Surv(start, stop, event) ~ x1 + x2, data = data, model =
"coxph")
x.out <- setx(z.out)
s.out <- sim(z.out, x = x.out)
I believe the equivalent Stata syntax would be something like this:
stset stop, id(id), failure(event) origin(start)
Details about estimation with time-varying covariates are included in the
next version of the documentation for coxph in Zelig.
Patrick
On Fri, May 30, 2008 at 11:07 AM, <aleman(a)fordham.edu> wrote:
Dear Zelig users,
A colleague and I are trying to use the survival package to run Cox models
in Zelig. We are using a partitioned likelihood approach to model several
kinds of events using Cox models. Since we have panel data, we have
multiple records per subject and the possibility that a country may
experience more than one type of event. Practically speaking, this will
require us to estimate 4 models, 1 each for each risk. The basic idea here
is that we treat the J-1 remaining risks as if they are right-censored
cases. This isolates the risk of interest. In stata this is easy, you just
use the id() option. In R this doesn't seem to be so straightforward
because the cluster function is the equivalent of the cluster() option in
Stata, but the equivalent of the id() option in Stata does not to have been
implemented. Another alternative is to use the strata () option to stratify
by event type, but the usual and mostly valid complaint against this model
is that covariate effects are constrained to be equal across risks. Is
there a way to model multiple records per subject in R while allowing for
varying covariate effects across risks?
Thanks,
Jose Aleman, Ph.D.
Assistant Professor
Political Science Department
Fordham University
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options:
http://lists.gking.harvard.edu/?info=zelig
Zelig program information:
http://gking.harvard.edu/zelig/